@sdeverywhere/check-core 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1523 -1466
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4773 -5447
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
- package/schema/check.schema.json +49 -0
- package/dist/index.cjs +0 -5779
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -2184
package/dist/index.d.cts
DELETED
|
@@ -1,2184 +0,0 @@
|
|
|
1
|
-
type SourceName = string;
|
|
2
|
-
type VarId = string;
|
|
3
|
-
type DatasetKey = string;
|
|
4
|
-
type Dataset = Map<number, number>;
|
|
5
|
-
type DatasetMap = Map<DatasetKey, Dataset>;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Specifies a constant override that will be applied when running the model.
|
|
9
|
-
*
|
|
10
|
-
* Unlike `InputSetting` (which works with pre-declared input variables that have
|
|
11
|
-
* defined min/max ranges), constant overrides can modify ANY constant in the model
|
|
12
|
-
* when the `customConstants` feature is enabled.
|
|
13
|
-
*/
|
|
14
|
-
interface ConstantOverride {
|
|
15
|
-
/** The variable ID of the constant to be overridden. */
|
|
16
|
-
varId: VarId;
|
|
17
|
-
/** The new value for the constant. */
|
|
18
|
-
value: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Specifies a lookup override that will be applied when running the model.
|
|
22
|
-
*
|
|
23
|
-
* The data provided here will override the default data in the generated model
|
|
24
|
-
* for the lookup or data variable identified by `varId`. When `points` is
|
|
25
|
-
* undefined, any previously-applied override for that variable will be reset
|
|
26
|
-
* back to its original data.
|
|
27
|
-
*
|
|
28
|
-
* Lookup overrides are only effective when the `customLookups` feature is
|
|
29
|
-
* enabled in the bundle.
|
|
30
|
-
*/
|
|
31
|
-
interface LookupOverride {
|
|
32
|
-
/** The variable ID of the lookup or data variable to be overridden. */
|
|
33
|
-
varId: VarId;
|
|
34
|
-
/**
|
|
35
|
-
* The lookup data as a flat array of (x,y) pairs. If undefined, the lookup
|
|
36
|
-
* data will be reset to the original data.
|
|
37
|
-
*/
|
|
38
|
-
points?: Float64Array;
|
|
39
|
-
}
|
|
40
|
-
/** A unique identifier for the scenario, derived from its input settings. */
|
|
41
|
-
type ScenarioSpecUid = string;
|
|
42
|
-
type InputPosition = 'at-default' | 'at-minimum' | 'at-maximum';
|
|
43
|
-
interface PositionSetting {
|
|
44
|
-
kind: 'position';
|
|
45
|
-
inputVarId: VarId;
|
|
46
|
-
position: InputPosition;
|
|
47
|
-
}
|
|
48
|
-
interface ValueSetting {
|
|
49
|
-
kind: 'value';
|
|
50
|
-
inputVarId: VarId;
|
|
51
|
-
value: number;
|
|
52
|
-
}
|
|
53
|
-
type InputSetting = PositionSetting | ValueSetting;
|
|
54
|
-
interface InputSettingsSpec {
|
|
55
|
-
kind: 'input-settings';
|
|
56
|
-
uid: ScenarioSpecUid;
|
|
57
|
-
settings: InputSetting[];
|
|
58
|
-
}
|
|
59
|
-
interface AllInputsSpec {
|
|
60
|
-
kind: 'all-inputs';
|
|
61
|
-
uid: ScenarioSpecUid;
|
|
62
|
-
position: InputPosition;
|
|
63
|
-
}
|
|
64
|
-
type ScenarioSpec = InputSettingsSpec | AllInputsSpec;
|
|
65
|
-
|
|
66
|
-
interface DatasetsResult {
|
|
67
|
-
/**
|
|
68
|
-
* The map of datasets for the scenario.
|
|
69
|
-
*/
|
|
70
|
-
datasetMap: DatasetMap;
|
|
71
|
-
/**
|
|
72
|
-
* The number of milliseconds that elapsed when running the model, or undefined if the model
|
|
73
|
-
* wasn't run for this scenario.
|
|
74
|
-
*/
|
|
75
|
-
modelRunTime?: number;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Options for the `getDatasetsForScenario` method.
|
|
79
|
-
*/
|
|
80
|
-
interface GetDatasetsOptions {
|
|
81
|
-
/**
|
|
82
|
-
* If defined, override the values for the specified constant variables.
|
|
83
|
-
*
|
|
84
|
-
* Unlike input settings (which work with pre-declared input variables), constant
|
|
85
|
-
* overrides can modify ANY constant in the model when the `customConstants` feature
|
|
86
|
-
* is enabled.
|
|
87
|
-
*
|
|
88
|
-
* Note that constant overrides do NOT persist across `getDatasetsForScenario` calls.
|
|
89
|
-
* They must be provided each time you want to override constants.
|
|
90
|
-
*/
|
|
91
|
-
constants?: ConstantOverride[];
|
|
92
|
-
/**
|
|
93
|
-
* If defined, override the data for the specified lookup or data variables.
|
|
94
|
-
*
|
|
95
|
-
* The data provided here will override the default data in the generated model
|
|
96
|
-
* for each variable identified by `varId`. Lookup overrides are only effective
|
|
97
|
-
* when the `customLookups` feature is enabled in the bundle.
|
|
98
|
-
*
|
|
99
|
-
* Note that lookup overrides MAY OR MAY NOT persist across `getDatasetsForScenario`
|
|
100
|
-
* calls, depending on the underlying model/runtime implementation. If you want to
|
|
101
|
-
* ensure that previously-applied lookup overrides do not take effect on subsequent
|
|
102
|
-
* runs, pass an undefined `points` array for the relevant variable to cause the
|
|
103
|
-
* lookup data to be reset to its original data.
|
|
104
|
-
*/
|
|
105
|
-
lookups?: LookupOverride[];
|
|
106
|
-
}
|
|
107
|
-
interface DataSource {
|
|
108
|
-
/**
|
|
109
|
-
* Return the datasets that result from running the given scenario.
|
|
110
|
-
*
|
|
111
|
-
* @param scenarioSpec The scenario spec that defines the inputs for the model run.
|
|
112
|
-
* @param datasetKeys The keys of the datasets to be fetched.
|
|
113
|
-
* @param options Optional configuration including constant and lookup overrides.
|
|
114
|
-
*/
|
|
115
|
-
getDatasetsForScenario(scenarioSpec: ScenarioSpec, datasetKeys: DatasetKey[], options?: GetDatasetsOptions): Promise<DatasetsResult>;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Holds information about an item related to a variable used in the model.
|
|
120
|
-
* For example, this can be used to attach information about a graph that
|
|
121
|
-
* an output variable is used in, or a slider that controls an input variable.
|
|
122
|
-
*/
|
|
123
|
-
interface RelatedItem {
|
|
124
|
-
id: string;
|
|
125
|
-
locationPath: string[];
|
|
126
|
-
}
|
|
127
|
-
/** A unique, stable input identifier. */
|
|
128
|
-
type InputId = string;
|
|
129
|
-
/**
|
|
130
|
-
* Holds information about an input variable that is controlled by a continuous range/slider.
|
|
131
|
-
*/
|
|
132
|
-
interface SliderInputVar {
|
|
133
|
-
/** Indicates that this input is controlled by a continuous range/slider. */
|
|
134
|
-
kind: 'slider';
|
|
135
|
-
/**
|
|
136
|
-
* A unique, stable identifier string for this input.
|
|
137
|
-
*
|
|
138
|
-
* This can be used to identify an input variable in a way that is resilient
|
|
139
|
-
* to the variable's name being changed between two versions of the model.
|
|
140
|
-
*
|
|
141
|
-
* For example, if both the "left" and "right" versions of the model have an
|
|
142
|
-
* input with an `inputId` of 2, but the variable is called "Variable 2" in
|
|
143
|
-
* the left and "Variable Two" in the right, the inputs can be correlated and
|
|
144
|
-
* compared despite the different variable names.
|
|
145
|
-
*/
|
|
146
|
-
inputId: InputId;
|
|
147
|
-
/** The variable identifier (typically a simplified/canonical ID, like the form used in SDE). */
|
|
148
|
-
varId: VarId;
|
|
149
|
-
/** The full variable name as used in the modeling tool. */
|
|
150
|
-
varName: string;
|
|
151
|
-
/** The default value of the input. */
|
|
152
|
-
defaultValue: number;
|
|
153
|
-
/** The minimum value of the input. */
|
|
154
|
-
minValue: number;
|
|
155
|
-
/** The maximum value of the input. */
|
|
156
|
-
maxValue: number;
|
|
157
|
-
/** The metadata for the related input control. */
|
|
158
|
-
relatedItem?: RelatedItem;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Holds information about an input variable that is controlled by a discrete on/off switch.
|
|
162
|
-
*/
|
|
163
|
-
interface SwitchInputVar {
|
|
164
|
-
/** Indicates that this input is controlled by a discrete on/off switch. */
|
|
165
|
-
kind: 'switch';
|
|
166
|
-
/**
|
|
167
|
-
* A unique, stable identifier string for this input.
|
|
168
|
-
*
|
|
169
|
-
* This can be used to identify an input variable in a way that is resilient
|
|
170
|
-
* to the variable's name being changed between two versions of the model.
|
|
171
|
-
*/
|
|
172
|
-
inputId: InputId;
|
|
173
|
-
/** The variable identifier (typically a simplified/canonical ID, like the form used in SDE). */
|
|
174
|
-
varId: VarId;
|
|
175
|
-
/** The full variable name as used in the modeling tool. */
|
|
176
|
-
varName: string;
|
|
177
|
-
/** The default value of the input. */
|
|
178
|
-
defaultValue: number;
|
|
179
|
-
/** The value of the variable when this switch is in an "off" state. */
|
|
180
|
-
offValue: number;
|
|
181
|
-
/** The value of the variable when this switch is in an "on" state. */
|
|
182
|
-
onValue: number;
|
|
183
|
-
/** The metadata for the related input control. */
|
|
184
|
-
relatedItem?: RelatedItem;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Holds information about an input variable used in the model. This is a discriminated
|
|
188
|
-
* union; use the `kind` field to determine the underlying variant.
|
|
189
|
-
*/
|
|
190
|
-
type InputVar = SliderInputVar | SwitchInputVar;
|
|
191
|
-
/**
|
|
192
|
-
* Holds information about an output variable used in the model.
|
|
193
|
-
*/
|
|
194
|
-
interface OutputVar {
|
|
195
|
-
/** The unique dataset key for this variable (it should include `sourceName` and `varId`). */
|
|
196
|
-
datasetKey: DatasetKey;
|
|
197
|
-
/**
|
|
198
|
-
* The source for the variable (e.g., undefined for a normal model output, "Data" for a variable
|
|
199
|
-
* that is defined in an external data file).
|
|
200
|
-
*/
|
|
201
|
-
sourceName?: SourceName;
|
|
202
|
-
/** The variable identifier (typically a simplified/canonical ID, like the form used in SDE). */
|
|
203
|
-
varId: VarId;
|
|
204
|
-
/** The full variable name as used in the modeling tool. */
|
|
205
|
-
varName: string;
|
|
206
|
-
/** The metadata for the related visuals/graphs in which this variable is used. */
|
|
207
|
-
relatedItems?: RelatedItem[];
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Holds information about a variable used in the model implementation.
|
|
211
|
-
*/
|
|
212
|
-
interface ImplVar {
|
|
213
|
-
/** The variable identifier, as used in SDE. */
|
|
214
|
-
varId: VarId;
|
|
215
|
-
/** The variable name, as used in the modeling tool. */
|
|
216
|
-
varName: string;
|
|
217
|
-
/** The variable type (e.g. 'level', 'const'). */
|
|
218
|
-
varType: string;
|
|
219
|
-
/** The variable index, used to reference the value in the generated model. */
|
|
220
|
-
varIndex: number;
|
|
221
|
-
/** The subscript index values, used to reference the value in the generated model. */
|
|
222
|
-
subscriptIndices?: number[];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/** The human-readable name for a group of inputs. */
|
|
226
|
-
type InputGroupName = string;
|
|
227
|
-
/** The alias name for an input. */
|
|
228
|
-
type InputAliasName = string;
|
|
229
|
-
/** The name for a custom input setting group. */
|
|
230
|
-
type InputSettingGroupId = string;
|
|
231
|
-
/** The human-readable name for a group of datasets. */
|
|
232
|
-
type DatasetGroupName = string;
|
|
233
|
-
/**
|
|
234
|
-
* Describes a group of implementation variables.
|
|
235
|
-
*/
|
|
236
|
-
interface ImplVarGroup {
|
|
237
|
-
/** The group title. */
|
|
238
|
-
title: string;
|
|
239
|
-
/**
|
|
240
|
-
* The function name in the generated model that is associated with
|
|
241
|
-
* this group. This can be used when displaying the group to change
|
|
242
|
-
* the appearance of the items in the section.
|
|
243
|
-
*/
|
|
244
|
-
fn?: string;
|
|
245
|
-
/**
|
|
246
|
-
* The keys of the variables in this group (corresponding to the
|
|
247
|
-
* `implVars` map keys). It is recommended to provide these in the
|
|
248
|
-
* order that the variables are evaluated in the generated model.
|
|
249
|
-
*/
|
|
250
|
-
datasetKeys: DatasetKey[];
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Includes the properties needed to display a legend item in the UI.
|
|
254
|
-
*/
|
|
255
|
-
interface LegendItem {
|
|
256
|
-
/** The item text. */
|
|
257
|
-
label: string;
|
|
258
|
-
/** The color of the item (in CSS/hex format). */
|
|
259
|
-
color: string;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Includes the properties needed to display a link item in the UI.
|
|
263
|
-
*/
|
|
264
|
-
interface LinkItem {
|
|
265
|
-
/** Whether content is a URL or text to be copied to the clipboard. */
|
|
266
|
-
kind: 'url' | 'copy';
|
|
267
|
-
/** The link text that appears in the UI. */
|
|
268
|
-
text: string;
|
|
269
|
-
/** The link content (a URL or text). */
|
|
270
|
-
content: string;
|
|
271
|
-
}
|
|
272
|
-
/** The identifier for a bundle-specific graph. */
|
|
273
|
-
type BundleGraphId = string;
|
|
274
|
-
/**
|
|
275
|
-
* Describes a dataset in a bundle-specific graph.
|
|
276
|
-
*/
|
|
277
|
-
interface BundleGraphDatasetSpec {
|
|
278
|
-
/** The dataset key. */
|
|
279
|
-
datasetKey: DatasetKey;
|
|
280
|
-
/** The dataset or variable name. */
|
|
281
|
-
varName: string;
|
|
282
|
-
/** The source name. */
|
|
283
|
-
sourceName?: string;
|
|
284
|
-
/** The label string (as it appears in the graph legend). */
|
|
285
|
-
label?: string;
|
|
286
|
-
/** The color of the plot (in CSS/hex format). */
|
|
287
|
-
color: string;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Describes a bundle-specific graph.
|
|
291
|
-
*/
|
|
292
|
-
interface BundleGraphSpec {
|
|
293
|
-
/** The graph identifier. */
|
|
294
|
-
id: BundleGraphId;
|
|
295
|
-
/** The graph title. */
|
|
296
|
-
title: string;
|
|
297
|
-
/** The legend items for the graph. */
|
|
298
|
-
legendItems: LegendItem[];
|
|
299
|
-
/** The datasets displayed in this graph. */
|
|
300
|
-
datasets: BundleGraphDatasetSpec[];
|
|
301
|
-
/** Metadata for the graph that can be used to diff to another graph. */
|
|
302
|
-
metadata: Map<string, string>;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Options for configuring a bundle-specific graph view.
|
|
306
|
-
*/
|
|
307
|
-
interface BundleGraphViewOptions {
|
|
308
|
-
/** Whether graph updates will be animated (default is false). */
|
|
309
|
-
animated?: boolean;
|
|
310
|
-
/** A hint that indicates the context in which the graph will be displayed. */
|
|
311
|
-
style?: 'thumbnail' | undefined;
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Allows for displaying a bundle-specific graph.
|
|
315
|
-
*/
|
|
316
|
-
interface BundleGraphView {
|
|
317
|
-
/**
|
|
318
|
-
* Update the data that is displayed in the graph.
|
|
319
|
-
*
|
|
320
|
-
* @hidden This method is optional; it is not currently used by the report UI, but may be useful
|
|
321
|
-
* for other tools that want to display bundle-specific graphs.
|
|
322
|
-
*
|
|
323
|
-
* @param datasetMap The map of datasets that contain the data to be displayed in the graph.
|
|
324
|
-
*/
|
|
325
|
-
updateData?(datasetMap: DatasetMap): void;
|
|
326
|
-
/** Destroy the underlying graph view and any associated resources. */
|
|
327
|
-
destroy(): void;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Wrapper around data that can be used to initialize a graph view.
|
|
331
|
-
*/
|
|
332
|
-
interface BundleGraphData {
|
|
333
|
-
/**
|
|
334
|
-
* Return a graph view that can be attached to the given parent element. The returned
|
|
335
|
-
* `BundleGraphView` instance will already be configured to display the data that was
|
|
336
|
-
* fetched from the model for the associated scenario.
|
|
337
|
-
*
|
|
338
|
-
* @param parent The parent element to which the graph view will be attached.
|
|
339
|
-
* @returns A `BundleGraphView` instance.
|
|
340
|
-
*/
|
|
341
|
-
createGraphView(parent: HTMLElement): BundleGraphView;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Describes the model that is contained in this bundle.
|
|
345
|
-
*/
|
|
346
|
-
interface ModelSpec {
|
|
347
|
-
/** The size of the model binary, in bytes. */
|
|
348
|
-
modelSizeInBytes: number;
|
|
349
|
-
/** The size of the static data, in bytes. */
|
|
350
|
-
dataSizeInBytes: number;
|
|
351
|
-
/** The map of all input variables in this version of the model. */
|
|
352
|
-
inputVars: Map<VarId, InputVar>;
|
|
353
|
-
/** The map of all output (and static data) variables in this version of the model. */
|
|
354
|
-
outputVars: Map<DatasetKey, OutputVar>;
|
|
355
|
-
/** The map of all variables (both internal and exported) in this version of the model. */
|
|
356
|
-
implVars: Map<DatasetKey, ImplVar>;
|
|
357
|
-
/** The groupings of internal/implementation variables in this version of the model. */
|
|
358
|
-
implVarGroups?: ImplVarGroup[];
|
|
359
|
-
/** The custom input variable aliases defined for this model. */
|
|
360
|
-
inputAliases?: Map<InputAliasName, VarId>;
|
|
361
|
-
/** The custom input variable groups defined for this model. */
|
|
362
|
-
inputGroups?: Map<InputGroupName, InputVar[]>;
|
|
363
|
-
/** The custom input setting groups defined for this model. */
|
|
364
|
-
inputSettingGroups?: Map<InputSettingGroupId, InputSetting[]>;
|
|
365
|
-
/** The custom dataset (output variable) groups defined for this model. */
|
|
366
|
-
datasetGroups?: Map<DatasetGroupName, DatasetKey[]>;
|
|
367
|
-
/** The start time (year) for the model. */
|
|
368
|
-
startTime?: number;
|
|
369
|
-
/** The end time (year) for the model. */
|
|
370
|
-
endTime?: number;
|
|
371
|
-
/** The specs for the bundled graphs. */
|
|
372
|
-
graphSpecs?: BundleGraphSpec[];
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* An interface that allows for running the bundled model under different input scenarios
|
|
376
|
-
* and capturing the resulting output data.
|
|
377
|
-
*/
|
|
378
|
-
interface BundleModel extends DataSource {
|
|
379
|
-
/** The spec for the bundled model. */
|
|
380
|
-
modelSpec: ModelSpec;
|
|
381
|
-
/**
|
|
382
|
-
* Load the data used to display the graph by running the model with inputs
|
|
383
|
-
* configured for the given scenario.
|
|
384
|
-
*
|
|
385
|
-
* The returned `BundleGraphData` instance will contain the data associated with the
|
|
386
|
-
* given graph. Calling the `createGraphView` method on the `BundleGraphData` instance
|
|
387
|
-
* will create a `BundleGraphView` that is already configured to display the data
|
|
388
|
-
* associated with the graph.
|
|
389
|
-
*
|
|
390
|
-
* This method is optional; if not implemented, custom graphs will not be displayed in
|
|
391
|
-
* the report UI.
|
|
392
|
-
*
|
|
393
|
-
* @param scenarioSpec The scenario spec that defines the inputs for the model run.
|
|
394
|
-
* @param graphId The identifier of the graph for which data will be loaded.
|
|
395
|
-
* @returns The graph data.
|
|
396
|
-
*/
|
|
397
|
-
getGraphDataForScenario?(scenarioSpec: ScenarioSpec, graphId: BundleGraphId): Promise<BundleGraphData>;
|
|
398
|
-
/**
|
|
399
|
-
* Return the links to be displayed for the graph in the given scenario.
|
|
400
|
-
*
|
|
401
|
-
* This method is optional; if not implemented, no graph links will be displayed in the report UI.
|
|
402
|
-
*
|
|
403
|
-
* @param scenarioSpec The scenario spec that defines the inputs for the model run.
|
|
404
|
-
* @param graphId The identifier of the graph for which links will be prepared.
|
|
405
|
-
* @returns An array of `LinkItem` instances.
|
|
406
|
-
*/
|
|
407
|
-
getGraphLinksForScenario?(scenarioSpec: ScenarioSpec, graphId: BundleGraphId): LinkItem[];
|
|
408
|
-
/**
|
|
409
|
-
* Return a graph view that is attached to the given element and that is prepared to display data
|
|
410
|
-
* for the given graph.
|
|
411
|
-
*
|
|
412
|
-
* Unlike `getGraphDataForScenario`, this method only creates the graph view. The data for the
|
|
413
|
-
* graph must be provided separately by calling the `updateData` method on the `BundleGraphView`
|
|
414
|
-
* instance.
|
|
415
|
-
*
|
|
416
|
-
* @hidden This method is optional; it is not currently used by the report UI, but may be useful
|
|
417
|
-
* for other tools that want to display bundle-specific graphs.
|
|
418
|
-
*
|
|
419
|
-
* @param parent The parent element to which the graph view will be attached.
|
|
420
|
-
* @param graphId The identifier of the graph for which the graph view will be prepared.
|
|
421
|
-
* @param options Optional configuration for the graph view.
|
|
422
|
-
* @returns A `BundleGraphView` instance.
|
|
423
|
-
*/
|
|
424
|
-
createGraphView?(parent: HTMLElement, graphId: BundleGraphId, options?: BundleGraphViewOptions): BundleGraphView;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Provides access to the model that is contained in this bundle for use in
|
|
428
|
-
* model-check packages.
|
|
429
|
-
*/
|
|
430
|
-
interface Bundle {
|
|
431
|
-
/**
|
|
432
|
-
* The version of the bundle. This should be incremented when there is an
|
|
433
|
-
* incompatible change to the bundle format. The model-check tools can use
|
|
434
|
-
* this value to skip tests if two bundles have different version numbers.
|
|
435
|
-
*/
|
|
436
|
-
version: number;
|
|
437
|
-
/** The spec for the bundled model. */
|
|
438
|
-
modelSpec: ModelSpec;
|
|
439
|
-
/** Asynchronously initialize the underlying model. */
|
|
440
|
-
initModel(): Promise<BundleModel>;
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Associates a name with a `Bundle`.
|
|
444
|
-
*/
|
|
445
|
-
interface NamedBundle {
|
|
446
|
-
/** The name of the bundle, for example, "Current" or "Baseline". */
|
|
447
|
-
name: string;
|
|
448
|
-
/** The associated bundle. */
|
|
449
|
-
bundle: Bundle;
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Represents a bundle that has had its model instances initialized.
|
|
453
|
-
*/
|
|
454
|
-
interface LoadedBundle {
|
|
455
|
-
/** The name of the bundle, for example, "Current" or "Baseline". */
|
|
456
|
-
name: string;
|
|
457
|
-
/** The version of the bundle. */
|
|
458
|
-
version: number;
|
|
459
|
-
/** The spec for the bundled model. */
|
|
460
|
-
modelSpec: ModelSpec;
|
|
461
|
-
/**
|
|
462
|
-
* The initialized model instances for this bundle. If `concurrency` was specified
|
|
463
|
-
* in the config, then there will be that number of model instances in this array,
|
|
464
|
-
* otherwise there will be one instance.
|
|
465
|
-
*/
|
|
466
|
-
models: BundleModel[];
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* A terse representation of a subscript.
|
|
471
|
-
*/
|
|
472
|
-
interface EncodedSubscript {
|
|
473
|
-
/** The subscript name (e.g., "Sub1"). */
|
|
474
|
-
n: string;
|
|
475
|
-
/** The subscript identifier (e.g., "_sub1"). */
|
|
476
|
-
i: string;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* A terse representation of a variable without subscripts.
|
|
480
|
-
*/
|
|
481
|
-
interface EncodedVariable {
|
|
482
|
-
/** The variable name (corresponds to the base part of `ImplVar.varName` without subscripts). */
|
|
483
|
-
n: string;
|
|
484
|
-
/** The variable identifier (corresponds to the base part of `ImplVar.varId` without subscripts). */
|
|
485
|
-
i: string;
|
|
486
|
-
/** The variable index (corresponds to `ImplVar.varIndex`). */
|
|
487
|
-
x: number;
|
|
488
|
-
}
|
|
489
|
-
/**
|
|
490
|
-
* A terse representation of a variable type.
|
|
491
|
-
*/
|
|
492
|
-
type EncodedVarType = string;
|
|
493
|
-
/**
|
|
494
|
-
* A terse representation of a variable instance as a flat array.
|
|
495
|
-
*
|
|
496
|
-
* Format: [t, v, si0, si1, ..., sx0, sx1, ...]
|
|
497
|
-
* - Element 0: The index of the associated `EncodedVarType` element in the `varTypes` array (corresponds to `ImplVar.varType`).
|
|
498
|
-
* - Element 1: The index of the associated `EncodedVariable` element in the `variables` array.
|
|
499
|
-
* - Elements 2+: If subscripts are present, first all subscript element indices, then all subscript indices:
|
|
500
|
-
* - Elements 2 to (2 + n - 1): The indices of the associated `EncodedSubscript` elements in the `subscripts` array.
|
|
501
|
-
* - Elements (2 + n) to (2 + 2n - 1): The subscript index values (corresponds to `ImplVar.subscriptIndices`).
|
|
502
|
-
*/
|
|
503
|
-
type EncodedVarInstance = number[];
|
|
504
|
-
/**
|
|
505
|
-
* The encoded representation of impl variables that eliminates redundancy.
|
|
506
|
-
*/
|
|
507
|
-
interface EncodedImplVars {
|
|
508
|
-
subscripts: EncodedSubscript[];
|
|
509
|
-
variables: EncodedVariable[];
|
|
510
|
-
varTypes: EncodedVarType[];
|
|
511
|
-
varInstances: {
|
|
512
|
-
[key: string]: EncodedVarInstance[];
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* Encode impl variable metadata into a more efficient format.
|
|
517
|
-
*
|
|
518
|
-
* This is used to reduce the size of a bundle by eliminating redundancy in variable/subscript
|
|
519
|
-
* names and identifiers. The `varInstances` object in the model listing JSON generated by the
|
|
520
|
-
* compiler includes verbose information for each variable instance. This function puts that
|
|
521
|
-
* information into a more efficient format that can be bundled as a normal JavaScript object
|
|
522
|
-
* in the model-check bundle file, and then decoded and expandedwhen the bundle is loaded.
|
|
523
|
-
*
|
|
524
|
-
* @param input The input structure mapping keys to ImplVar arrays.
|
|
525
|
-
* @returns The encoded representation.
|
|
526
|
-
*/
|
|
527
|
-
declare function encodeImplVars(input: {
|
|
528
|
-
[key: string]: ImplVar[];
|
|
529
|
-
}): EncodedImplVars;
|
|
530
|
-
/**
|
|
531
|
-
* Decode impl variables from the efficient format back to the original structure.
|
|
532
|
-
*
|
|
533
|
-
* @param encoded The encoded representation.
|
|
534
|
-
* @returns The original structure mapping keys to `ImplVar` arrays.
|
|
535
|
-
*/
|
|
536
|
-
declare function decodeImplVars(encoded: EncodedImplVars): {
|
|
537
|
-
[key: string]: ImplVar[];
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
interface CheckOptions {
|
|
541
|
-
/** The strings containing check tests in YAML format. */
|
|
542
|
-
tests: string[];
|
|
543
|
-
}
|
|
544
|
-
interface CheckConfig {
|
|
545
|
-
/** The loaded bundle being checked. */
|
|
546
|
-
bundle: LoadedBundle;
|
|
547
|
-
/** The strings containing check tests in YAML format. */
|
|
548
|
-
tests: string[];
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
type TaskKey = string;
|
|
552
|
-
type TaskExecutorKey = string;
|
|
553
|
-
interface BundleModels {
|
|
554
|
-
L?: BundleModel;
|
|
555
|
-
R: BundleModel;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Base interface for all tasks in the unified system.
|
|
559
|
-
*/
|
|
560
|
-
interface Task {
|
|
561
|
-
/** Unique key for this task instance. */
|
|
562
|
-
key: TaskKey;
|
|
563
|
-
/** The task kind. */
|
|
564
|
-
kind: string;
|
|
565
|
-
/** Process the task using the given models. */
|
|
566
|
-
process(models: BundleModels): Promise<void>;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Executes a single task using a set of `BundleModel` instances.
|
|
570
|
-
*/
|
|
571
|
-
interface TaskExecutor {
|
|
572
|
-
/**
|
|
573
|
-
* Execute the given task using the set of `BundleModel` instances
|
|
574
|
-
* associated with this executor.
|
|
575
|
-
*
|
|
576
|
-
* @param task The task to execute.
|
|
577
|
-
* @return A promise that resolves when the task is complete.
|
|
578
|
-
*/
|
|
579
|
-
execute(task: Task): Promise<void>;
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* A unified task queue that can process multiple kinds of tasks concurrently
|
|
583
|
-
* while ensuring that BundleModel instances are never accessed concurrently.
|
|
584
|
-
* This replaces the need for multiple separate TaskQueue instances.
|
|
585
|
-
*/
|
|
586
|
-
declare class TaskQueue {
|
|
587
|
-
private readonly executors;
|
|
588
|
-
/** The single instance. */
|
|
589
|
-
private static instance;
|
|
590
|
-
/** The queue of task keys, most recent at front. */
|
|
591
|
-
private readonly taskKeyQueue;
|
|
592
|
-
/** The map of tasks. */
|
|
593
|
-
private readonly taskMap;
|
|
594
|
-
/** The idle event listeners. */
|
|
595
|
-
private readonly idleListeners;
|
|
596
|
-
/** Whether tasks are being processed. */
|
|
597
|
-
private processing;
|
|
598
|
-
/** Whether `shutdown` has been called. */
|
|
599
|
-
private stopped;
|
|
600
|
-
/**
|
|
601
|
-
* @param executors The map of available task executors.
|
|
602
|
-
*/
|
|
603
|
-
constructor(executors: Map<TaskExecutorKey, TaskExecutor>);
|
|
604
|
-
/**
|
|
605
|
-
* Initialize the shared `TaskQueue` instance.
|
|
606
|
-
*
|
|
607
|
-
* @param executors The map of available task executors.
|
|
608
|
-
*/
|
|
609
|
-
static initialize(executors: Map<TaskExecutorKey, TaskExecutor>): void;
|
|
610
|
-
/**
|
|
611
|
-
* Get the shared `TaskQueue` instance.
|
|
612
|
-
*/
|
|
613
|
-
static getInstance(): TaskQueue;
|
|
614
|
-
/**
|
|
615
|
-
* Add a task to the queue.
|
|
616
|
-
*
|
|
617
|
-
* @param task The task to add.
|
|
618
|
-
*/
|
|
619
|
-
addTask(task: Task): void;
|
|
620
|
-
/**
|
|
621
|
-
* Cancel a task.
|
|
622
|
-
*
|
|
623
|
-
* @param taskKey The key of the task to cancel.
|
|
624
|
-
*/
|
|
625
|
-
cancelTask(taskKey: TaskKey): void;
|
|
626
|
-
/**
|
|
627
|
-
* Add an idle listener.
|
|
628
|
-
*
|
|
629
|
-
* @param listener The listener to add.
|
|
630
|
-
*/
|
|
631
|
-
onIdle(listener: (error?: Error) => void): void;
|
|
632
|
-
/**
|
|
633
|
-
* Remove an idle listener.
|
|
634
|
-
*
|
|
635
|
-
* @param listener The listener to remove.
|
|
636
|
-
*/
|
|
637
|
-
removeIdleListener(listener: (error?: Error) => void): void;
|
|
638
|
-
/**
|
|
639
|
-
* Notify the idle listeners.
|
|
640
|
-
*
|
|
641
|
-
* @param error The error to notify the listeners with.
|
|
642
|
-
*/
|
|
643
|
-
private notifyIdle;
|
|
644
|
-
/**
|
|
645
|
-
* Shutdown the task queue, cancelling all pending tasks.
|
|
646
|
-
*/
|
|
647
|
-
shutdown(): void;
|
|
648
|
-
private processTasksIfNeeded;
|
|
649
|
-
private processNextTasks;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
type CheckDataRequestKey = string;
|
|
653
|
-
/**
|
|
654
|
-
* Options for `requestDataset`.
|
|
655
|
-
*/
|
|
656
|
-
interface RequestDatasetOptions {
|
|
657
|
-
/** Optional constant overrides for the model. */
|
|
658
|
-
constants?: ConstantOverride[];
|
|
659
|
-
/** Optional lookup overrides for the model. */
|
|
660
|
-
lookups?: LookupOverride[];
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Coordinates on-demand loading of data used to display a graph representation
|
|
664
|
-
* of a check/predicate.
|
|
665
|
-
*/
|
|
666
|
-
declare class CheckDataCoordinator {
|
|
667
|
-
private readonly taskQueue;
|
|
668
|
-
constructor(taskQueue: TaskQueue);
|
|
669
|
-
/**
|
|
670
|
-
* Request a dataset from the model.
|
|
671
|
-
*
|
|
672
|
-
* @param requestKey The unique key for the request.
|
|
673
|
-
* @param scenarioSpec The scenario spec that defines the inputs for the model run.
|
|
674
|
-
* @param datasetKey The key of the dataset to be fetched.
|
|
675
|
-
* @param options Optional configuration including constant and lookup overrides.
|
|
676
|
-
* @param onResponse The callback that will be called with the dataset.
|
|
677
|
-
*/
|
|
678
|
-
requestDataset(requestKey: CheckDataRequestKey, scenarioSpec: ScenarioSpec, datasetKey: DatasetKey, options: RequestDatasetOptions | undefined, onResponse: (dataset: Dataset) => void): void;
|
|
679
|
-
cancelRequest(key: CheckDataRequestKey): void;
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
* Create a `CheckDataCoordinator` instance using the shared task queue.
|
|
683
|
-
*/
|
|
684
|
-
declare function createCheckDataCoordinator(): CheckDataCoordinator;
|
|
685
|
-
/**
|
|
686
|
-
* @hidden This is not part of the public API; it is exposed only for use in tests.
|
|
687
|
-
*/
|
|
688
|
-
declare function createCheckDataCoordinatorForTests(bundleModel: BundleModel): CheckDataCoordinator;
|
|
689
|
-
|
|
690
|
-
/** Spec type that allows for matching a check by group and test name. */
|
|
691
|
-
interface CheckNameSpec {
|
|
692
|
-
/** The name of a check group. */
|
|
693
|
-
groupName: string;
|
|
694
|
-
/** The name of a check test. */
|
|
695
|
-
testName: string;
|
|
696
|
-
}
|
|
697
|
-
type CheckPredicateTimeSingle = number;
|
|
698
|
-
type CheckPredicateTimeRange = [number, number];
|
|
699
|
-
interface CheckPredicateTimeOptions {
|
|
700
|
-
after_excl?: number;
|
|
701
|
-
after_incl?: number;
|
|
702
|
-
before_excl?: number;
|
|
703
|
-
before_incl?: number;
|
|
704
|
-
}
|
|
705
|
-
type CheckPredicateTimeSpec = CheckPredicateTimeSingle | CheckPredicateTimeRange | CheckPredicateTimeOptions;
|
|
706
|
-
|
|
707
|
-
type CheckDatasetError = 'no-matches-for-dataset' | 'no-matches-for-group' | 'no-matches-for-type';
|
|
708
|
-
interface CheckDataset {
|
|
709
|
-
/** The key for the matched dataset; can be undefined if no dataset matched. */
|
|
710
|
-
datasetKey?: DatasetKey;
|
|
711
|
-
/** The name of the matched dataset, or the name associated with the error, if defined. */
|
|
712
|
-
name: string;
|
|
713
|
-
/** The error info if the dataset query failed to match. */
|
|
714
|
-
error?: CheckDatasetError;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
interface CheckScenarioError {
|
|
718
|
-
kind: 'unknown-input-group' | 'empty-input-group';
|
|
719
|
-
/** The name of the input group that failed to match. */
|
|
720
|
-
name: string;
|
|
721
|
-
}
|
|
722
|
-
interface CheckScenarioInputDesc {
|
|
723
|
-
/** The name of the input. */
|
|
724
|
-
name: string;
|
|
725
|
-
/** The matched input variable; can be undefined if no input matched. */
|
|
726
|
-
inputVar?: InputVar;
|
|
727
|
-
/** The position of the input, if this is a position scenario. */
|
|
728
|
-
position?: InputPosition;
|
|
729
|
-
/** The value of the input, for the given position or explicit value. */
|
|
730
|
-
value?: number;
|
|
731
|
-
}
|
|
732
|
-
interface CheckScenario {
|
|
733
|
-
/** The spec used to configure the model with the matched input(s); can be undefined if input(s) failed to match. */
|
|
734
|
-
spec?: ScenarioSpec;
|
|
735
|
-
/** The name of the associated input group, if any. */
|
|
736
|
-
inputGroupName?: string;
|
|
737
|
-
/** The descriptions of the inputs; if empty, it is an "all inputs" scenario. */
|
|
738
|
-
inputDescs: CheckScenarioInputDesc[];
|
|
739
|
-
/** The error info if the scenario/input query failed to match. */
|
|
740
|
-
error?: CheckScenarioError;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
/**
|
|
744
|
-
* The key type for data references (in the form `<ScenarioUid::DatasetKey>`).
|
|
745
|
-
*/
|
|
746
|
-
type CheckDataRefKey = string;
|
|
747
|
-
/**
|
|
748
|
-
* The scenario and dataset referenced by a particular predicate (for cases
|
|
749
|
-
* where the check is against another dataset rather than a constant value).
|
|
750
|
-
*/
|
|
751
|
-
interface CheckDataRef {
|
|
752
|
-
/** The key for the reference; can be undefined if inputs or datasets failed to match. */
|
|
753
|
-
key?: CheckDataRefKey;
|
|
754
|
-
/** The scenario used to generate the referenced dataset. */
|
|
755
|
-
scenario: CheckScenario;
|
|
756
|
-
/** The referenced dataset. */
|
|
757
|
-
dataset: CheckDataset;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
type CheckPredicateOp = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'approx';
|
|
761
|
-
|
|
762
|
-
interface CheckResultErrorInfo {
|
|
763
|
-
kind: 'unknown-dataset' | 'unknown-input' | 'unknown-input-group' | 'empty-input-group';
|
|
764
|
-
name: string;
|
|
765
|
-
}
|
|
766
|
-
interface CheckResult {
|
|
767
|
-
status: 'passed' | 'failed' | 'error' | 'skipped';
|
|
768
|
-
message?: string;
|
|
769
|
-
failValue?: number;
|
|
770
|
-
failOp?: CheckPredicateOp;
|
|
771
|
-
failRefValue?: number;
|
|
772
|
-
failTime?: number;
|
|
773
|
-
errorInfo?: CheckResultErrorInfo;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
type CheckKey = number;
|
|
777
|
-
|
|
778
|
-
type CheckStatus = 'passed' | 'failed' | 'error' | 'skipped';
|
|
779
|
-
interface CheckPredicateOpConstantRef {
|
|
780
|
-
kind: 'constant';
|
|
781
|
-
value: number;
|
|
782
|
-
}
|
|
783
|
-
interface CheckPredicateOpDataRef {
|
|
784
|
-
kind: 'data';
|
|
785
|
-
dataRef: CheckDataRef;
|
|
786
|
-
}
|
|
787
|
-
type CheckPredicateOpRef = CheckPredicateOpConstantRef | CheckPredicateOpDataRef;
|
|
788
|
-
interface CheckPredicateReport {
|
|
789
|
-
checkKey: CheckKey;
|
|
790
|
-
result: CheckResult;
|
|
791
|
-
opRefs: Map<CheckPredicateOp, CheckPredicateOpRef>;
|
|
792
|
-
opValues: string[];
|
|
793
|
-
time?: CheckPredicateTimeSpec;
|
|
794
|
-
tolerance?: number;
|
|
795
|
-
}
|
|
796
|
-
interface CheckDatasetReport {
|
|
797
|
-
checkDataset: CheckDataset;
|
|
798
|
-
status: CheckStatus;
|
|
799
|
-
predicates: CheckPredicateReport[];
|
|
800
|
-
}
|
|
801
|
-
interface CheckScenarioReport {
|
|
802
|
-
checkScenario: CheckScenario;
|
|
803
|
-
status: CheckStatus;
|
|
804
|
-
datasets: CheckDatasetReport[];
|
|
805
|
-
}
|
|
806
|
-
interface CheckTestReport {
|
|
807
|
-
name: string;
|
|
808
|
-
status: CheckStatus;
|
|
809
|
-
scenarios: CheckScenarioReport[];
|
|
810
|
-
}
|
|
811
|
-
interface CheckGroupReport {
|
|
812
|
-
name: string;
|
|
813
|
-
tests: CheckTestReport[];
|
|
814
|
-
}
|
|
815
|
-
interface CheckReport {
|
|
816
|
-
groups: CheckGroupReport[];
|
|
817
|
-
}
|
|
818
|
-
type StyleFunc = (s: string) => string;
|
|
819
|
-
/**
|
|
820
|
-
* Return a string representation of the given scenario.
|
|
821
|
-
*
|
|
822
|
-
* @param scenario The scenario report.
|
|
823
|
-
* @param bold A function that applies bold styling to a string.
|
|
824
|
-
*/
|
|
825
|
-
declare function scenarioMessage(scenario: CheckScenarioReport, bold: StyleFunc): string;
|
|
826
|
-
/**
|
|
827
|
-
* Return a string representation of the given dataset.
|
|
828
|
-
*
|
|
829
|
-
* @param dataset The dataset report.
|
|
830
|
-
* @param bold A function that applies bold styling to a string.
|
|
831
|
-
*/
|
|
832
|
-
declare function datasetMessage(dataset: CheckDatasetReport, bold: StyleFunc): string;
|
|
833
|
-
/**
|
|
834
|
-
* Return a string representation of the given predicate.
|
|
835
|
-
*
|
|
836
|
-
* @param predicate The predicate report.
|
|
837
|
-
* @param bold A function that applies bold styling to a string.
|
|
838
|
-
*/
|
|
839
|
-
declare function predicateMessage(predicate: CheckPredicateReport, bold: StyleFunc): string;
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* A simplified/terse version of `CheckPredicateReport` that matches the
|
|
843
|
-
* format of the JSON objects emitted by the CLI in terse mode.
|
|
844
|
-
*/
|
|
845
|
-
interface CheckPredicateSummary {
|
|
846
|
-
checkKey: CheckKey;
|
|
847
|
-
result: CheckResult;
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* A simplified/terse version of `CheckReport` that matches the
|
|
851
|
-
* format of the JSON objects emitted by the CLI in terse mode.
|
|
852
|
-
* This contains predicate summaries for checks that have a status
|
|
853
|
-
* of 'failed', 'error', or 'skipped'.
|
|
854
|
-
*/
|
|
855
|
-
interface CheckSummary {
|
|
856
|
-
predicateSummaries: CheckPredicateSummary[];
|
|
857
|
-
}
|
|
858
|
-
/**
|
|
859
|
-
* Convert a full `CheckReport` to a simplified `CheckSummary` that includes
|
|
860
|
-
* failed, errored, and skipped checks.
|
|
861
|
-
*
|
|
862
|
-
* @param checkReport The full check report.
|
|
863
|
-
* @return The converted check summary.
|
|
864
|
-
*/
|
|
865
|
-
declare function checkSummaryFromReport(checkReport: CheckReport): CheckSummary;
|
|
866
|
-
/**
|
|
867
|
-
* Convert a simplified `CheckSummary` to a full `CheckReport` that restores the
|
|
868
|
-
* structure of the tests from the given configuration.
|
|
869
|
-
*
|
|
870
|
-
* @param checkConfig The config used to reconstruct the check test structure.
|
|
871
|
-
* @param checkSummary The simplified check summary.
|
|
872
|
-
* @param skipChecks The checks that were skipped when the original report was created.
|
|
873
|
-
* @return The converted check report.
|
|
874
|
-
*/
|
|
875
|
-
declare function checkReportFromSummary(checkConfig: CheckConfig, checkSummary: CheckSummary, skipChecks?: CheckNameSpec[]): CheckReport | undefined;
|
|
876
|
-
|
|
877
|
-
type ComparisonDatasetName = string;
|
|
878
|
-
type ComparisonDatasetSource = string;
|
|
879
|
-
/**
|
|
880
|
-
* Specifies a dataset (variable) used for comparison.
|
|
881
|
-
*/
|
|
882
|
-
interface ComparisonDatasetSpec {
|
|
883
|
-
kind: 'dataset';
|
|
884
|
-
/** The name of the dataset (variable). */
|
|
885
|
-
name: ComparisonDatasetName;
|
|
886
|
-
/**
|
|
887
|
-
* The source of the dataset, if it is from an external data file. If
|
|
888
|
-
* undefined, the dataset is assumed to be a model output.
|
|
889
|
-
*/
|
|
890
|
-
source?: ComparisonDatasetSource;
|
|
891
|
-
}
|
|
892
|
-
type ComparisonScenarioId = string;
|
|
893
|
-
type ComparisonScenarioTitle = string;
|
|
894
|
-
type ComparisonScenarioSubtitle = string;
|
|
895
|
-
type ComparisonScenarioInputName = string;
|
|
896
|
-
type ComparisonScenarioInputPosition = 'default' | 'min' | 'max';
|
|
897
|
-
/**
|
|
898
|
-
* Specifies an input that is set to a specific position (default / min / max).
|
|
899
|
-
*/
|
|
900
|
-
interface ComparisonScenarioInputAtPositionSpec {
|
|
901
|
-
kind: 'input-at-position';
|
|
902
|
-
/** The requested input name or alias. */
|
|
903
|
-
inputName: ComparisonScenarioInputName;
|
|
904
|
-
/** The requested position of the input. */
|
|
905
|
-
position: ComparisonScenarioInputPosition;
|
|
906
|
-
}
|
|
907
|
-
/**
|
|
908
|
-
* Specifies an input that is set to a specific number value.
|
|
909
|
-
*/
|
|
910
|
-
interface ComparisonScenarioInputAtValueSpec {
|
|
911
|
-
kind: 'input-at-value';
|
|
912
|
-
/** The requested input name or alias. */
|
|
913
|
-
inputName: ComparisonScenarioInputName;
|
|
914
|
-
/** The number value of the input. */
|
|
915
|
-
value: number;
|
|
916
|
-
}
|
|
917
|
-
/**
|
|
918
|
-
* A single input setting for a scenario. An input can be set to a specific number value,
|
|
919
|
-
* or it can be set to a "position" (default / min / max).
|
|
920
|
-
*/
|
|
921
|
-
type ComparisonScenarioInputSpec = ComparisonScenarioInputAtPositionSpec | ComparisonScenarioInputAtValueSpec;
|
|
922
|
-
/**
|
|
923
|
-
* Specifies a single scenario that sets one or more inputs to a value/position.
|
|
924
|
-
*/
|
|
925
|
-
interface ComparisonScenarioWithInputsSpec {
|
|
926
|
-
kind: 'scenario-with-inputs';
|
|
927
|
-
/** The unique identifier for the scenario. */
|
|
928
|
-
id?: ComparisonScenarioId;
|
|
929
|
-
/** The title of the scenario. */
|
|
930
|
-
title?: ComparisonScenarioTitle;
|
|
931
|
-
/** The subtitle of the scenario. */
|
|
932
|
-
subtitle?: ComparisonScenarioSubtitle;
|
|
933
|
-
/** The input settings for this scenario. */
|
|
934
|
-
inputs: ComparisonScenarioInputSpec[];
|
|
935
|
-
}
|
|
936
|
-
/**
|
|
937
|
-
* Specifies a single scenario that configures inputs differently for the two
|
|
938
|
-
* model instances.
|
|
939
|
-
*/
|
|
940
|
-
interface ComparisonScenarioWithDistinctInputsSpec {
|
|
941
|
-
kind: 'scenario-with-distinct-inputs';
|
|
942
|
-
/** The unique identifier for the scenario. */
|
|
943
|
-
id?: ComparisonScenarioId;
|
|
944
|
-
/** The title of the scenario. */
|
|
945
|
-
title?: ComparisonScenarioTitle;
|
|
946
|
-
/** The subtitle of the scenario. */
|
|
947
|
-
subtitle?: ComparisonScenarioSubtitle;
|
|
948
|
-
/** The input settings for this scenario when run with the "left" model. */
|
|
949
|
-
inputsL: ComparisonScenarioInputSpec[];
|
|
950
|
-
/** The input settings for this scenario when run with the "right" model. */
|
|
951
|
-
inputsR: ComparisonScenarioInputSpec[];
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* Specifies a single scenario that configures inputs according to the setting
|
|
955
|
-
* group defined for each model instance.
|
|
956
|
-
*/
|
|
957
|
-
interface ComparisonScenarioWithSettingGroupSpec {
|
|
958
|
-
kind: 'scenario-with-setting-group';
|
|
959
|
-
/** The unique identifier for the scenario. */
|
|
960
|
-
id?: ComparisonScenarioId;
|
|
961
|
-
/** The title of the scenario. */
|
|
962
|
-
title?: ComparisonScenarioTitle;
|
|
963
|
-
/** The subtitle of the scenario. */
|
|
964
|
-
subtitle?: ComparisonScenarioSubtitle;
|
|
965
|
-
/** The identifier of the input setting group as used in `ModelSpec.inputSettingGroups`. */
|
|
966
|
-
settingGroupId: InputSettingGroupId;
|
|
967
|
-
}
|
|
968
|
-
/**
|
|
969
|
-
* Specifies a single scenario that sets all available inputs to position.
|
|
970
|
-
*/
|
|
971
|
-
interface ComparisonScenarioWithAllInputsSpec {
|
|
972
|
-
kind: 'scenario-with-all-inputs';
|
|
973
|
-
/** The unique identifier for the scenario. */
|
|
974
|
-
id?: ComparisonScenarioId;
|
|
975
|
-
/** The title of the scenario. */
|
|
976
|
-
title?: ComparisonScenarioTitle;
|
|
977
|
-
/** The subtitle of the scenario. */
|
|
978
|
-
subtitle?: ComparisonScenarioSubtitle;
|
|
979
|
-
/** The position that will be used for all available inputs. */
|
|
980
|
-
position: ComparisonScenarioInputPosition;
|
|
981
|
-
}
|
|
982
|
-
/**
|
|
983
|
-
* Special preset that expands to many scenarios:
|
|
984
|
-
* - one scenario with all inputs at their default
|
|
985
|
-
* - two scenarios for each available input:
|
|
986
|
-
* - one scenario with the input at its minimum
|
|
987
|
-
* - one scenario with the input at its maximum
|
|
988
|
-
*/
|
|
989
|
-
interface ComparisonScenarioPresetMatrixSpec {
|
|
990
|
-
kind: 'scenario-matrix';
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
* A definition of input scenario(s). A scenario can set one input to a value/position, or it
|
|
994
|
-
* can set multiple inputs to particular values/positions.
|
|
995
|
-
*/
|
|
996
|
-
type ComparisonScenarioSpec = ComparisonScenarioWithInputsSpec | ComparisonScenarioWithDistinctInputsSpec | ComparisonScenarioWithSettingGroupSpec | ComparisonScenarioWithAllInputsSpec | ComparisonScenarioPresetMatrixSpec;
|
|
997
|
-
/** A reference to a scenario definition. */
|
|
998
|
-
interface ComparisonScenarioRefSpec {
|
|
999
|
-
kind: 'scenario-ref';
|
|
1000
|
-
/** The ID of the scenario that is referenced. */
|
|
1001
|
-
scenarioId: ComparisonScenarioId;
|
|
1002
|
-
/** The optional title that is used instead of the referenced scenario's title. */
|
|
1003
|
-
title?: ComparisonScenarioTitle;
|
|
1004
|
-
/** The optional subtitle that is used instead of the referenced scenario's subtitle. */
|
|
1005
|
-
subtitle?: ComparisonScenarioSubtitle;
|
|
1006
|
-
}
|
|
1007
|
-
/** Spec type that allows for matching a comparison scenario by title and subtitle. */
|
|
1008
|
-
interface ComparisonScenarioTitleSpec {
|
|
1009
|
-
/** The title of a comparison scenario. */
|
|
1010
|
-
title: string;
|
|
1011
|
-
/** The subtitle of a comparison scenario. */
|
|
1012
|
-
subtitle?: string;
|
|
1013
|
-
}
|
|
1014
|
-
type ComparisonScenarioGroupId = string;
|
|
1015
|
-
type ComparisonScenarioGroupTitle = string;
|
|
1016
|
-
/**
|
|
1017
|
-
* A definition of a group of input scenarios. Multiple scenarios can be grouped together under a single name, and
|
|
1018
|
-
* can later be referenced by group ID in a view definition.
|
|
1019
|
-
*/
|
|
1020
|
-
interface ComparisonScenarioGroupSpec {
|
|
1021
|
-
kind: 'scenario-group';
|
|
1022
|
-
/** The unique identifier for the group. */
|
|
1023
|
-
id?: ComparisonScenarioGroupId;
|
|
1024
|
-
/** The title of the group. */
|
|
1025
|
-
title: ComparisonScenarioGroupTitle;
|
|
1026
|
-
/** The scenarios that are included in this group. */
|
|
1027
|
-
scenarios: (ComparisonScenarioSpec | ComparisonScenarioRefSpec)[];
|
|
1028
|
-
}
|
|
1029
|
-
/** A reference to a scenario group definition. */
|
|
1030
|
-
interface ComparisonScenarioGroupRefSpec {
|
|
1031
|
-
kind: 'scenario-group-ref';
|
|
1032
|
-
/** The ID of the scenario group that is referenced. */
|
|
1033
|
-
groupId: ComparisonScenarioGroupId;
|
|
1034
|
-
}
|
|
1035
|
-
type ComparisonGraphId = string;
|
|
1036
|
-
/**
|
|
1037
|
-
* Specifies a list of graphs to be shown in a view.
|
|
1038
|
-
*/
|
|
1039
|
-
interface ComparisonGraphsArraySpec {
|
|
1040
|
-
kind: 'graphs-array';
|
|
1041
|
-
/** The array of IDs for graphs to show. */
|
|
1042
|
-
graphIds: ComparisonGraphId[];
|
|
1043
|
-
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Specifies a preset list of graphs to be shown in a view.
|
|
1046
|
-
*/
|
|
1047
|
-
interface ComparisonGraphsPresetSpec {
|
|
1048
|
-
kind: 'graphs-preset';
|
|
1049
|
-
/** The preset (currently only "all" is supported, which shows all available graphs). */
|
|
1050
|
-
preset: 'all';
|
|
1051
|
-
}
|
|
1052
|
-
type ComparisonGraphGroupId = string;
|
|
1053
|
-
/**
|
|
1054
|
-
* A definition of a group of graphs to be shown in a view. Multiple graphs can be grouped together
|
|
1055
|
-
* under a single ID, and can later be referenced by group ID in a view definition.
|
|
1056
|
-
*/
|
|
1057
|
-
interface ComparisonGraphGroupSpec {
|
|
1058
|
-
kind: 'graph-group';
|
|
1059
|
-
/** The unique identifier for the group. */
|
|
1060
|
-
id: ComparisonGraphGroupId;
|
|
1061
|
-
/** The graphs that are included in this group. */
|
|
1062
|
-
graphIds: ComparisonGraphId[];
|
|
1063
|
-
}
|
|
1064
|
-
/** A reference to a graph group definition. */
|
|
1065
|
-
interface ComparisonGraphGroupRefSpec {
|
|
1066
|
-
kind: 'graph-group-ref';
|
|
1067
|
-
/** The ID of the graph group that is referenced. */
|
|
1068
|
-
groupId: ComparisonGraphGroupId;
|
|
1069
|
-
}
|
|
1070
|
-
type ComparisonViewTitle = string;
|
|
1071
|
-
type ComparisonViewSubtitle = string;
|
|
1072
|
-
type ComparisonViewRowTitle = string;
|
|
1073
|
-
type ComparisonViewRowSubtitle = string;
|
|
1074
|
-
type ComparisonViewItemTitle = string;
|
|
1075
|
-
type ComparisonViewItemSubtitle = string;
|
|
1076
|
-
type ComparisonViewGraphOrder = 'default' | 'grouped-by-diffs';
|
|
1077
|
-
/**
|
|
1078
|
-
* Specifies a single comparison box to be shown in a view.
|
|
1079
|
-
*/
|
|
1080
|
-
interface ComparisonViewBoxSpec {
|
|
1081
|
-
kind: 'view-box';
|
|
1082
|
-
/** The title of the box. */
|
|
1083
|
-
title: ComparisonViewItemTitle;
|
|
1084
|
-
/** The subtitle of the box. */
|
|
1085
|
-
subtitle?: ComparisonViewItemSubtitle;
|
|
1086
|
-
/** The dataset shown in this comparison box. */
|
|
1087
|
-
dataset: ComparisonDatasetSpec;
|
|
1088
|
-
/** The scenario shown in this comparison box. */
|
|
1089
|
-
scenarioId: ComparisonScenarioId;
|
|
1090
|
-
}
|
|
1091
|
-
/**
|
|
1092
|
-
* Specifies a row of comparison boxes to be shown in a view.
|
|
1093
|
-
*/
|
|
1094
|
-
interface ComparisonViewRowSpec {
|
|
1095
|
-
kind: 'view-row';
|
|
1096
|
-
/** The title of the row. */
|
|
1097
|
-
title: ComparisonViewRowTitle;
|
|
1098
|
-
/** The subtitle of the row. */
|
|
1099
|
-
subtitle?: ComparisonViewRowSubtitle;
|
|
1100
|
-
/** The array of boxes to be shown in the row. */
|
|
1101
|
-
boxes: ComparisonViewBoxSpec[];
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Specifies a set of graphs to be shown in a view.
|
|
1105
|
-
*/
|
|
1106
|
-
type ComparisonViewGraphsSpec = ComparisonGraphsPresetSpec | ComparisonGraphsArraySpec | ComparisonGraphGroupRefSpec;
|
|
1107
|
-
/**
|
|
1108
|
-
* A definition of a view. A view presents a set of graphs, either for a single input scenario
|
|
1109
|
-
* or for a mix of different dataset/scenario combinations.
|
|
1110
|
-
*/
|
|
1111
|
-
interface ComparisonViewSpec {
|
|
1112
|
-
kind: 'view';
|
|
1113
|
-
/** The title of the view. If undefined, the title will be inferred from the scenario. */
|
|
1114
|
-
title?: ComparisonViewTitle;
|
|
1115
|
-
/** The subtitle of the view. If undefined, the subtitle will be inferred from the scenario. */
|
|
1116
|
-
subtitle?: ComparisonViewSubtitle;
|
|
1117
|
-
/** The scenario to be shown in the view if this is a single-scenario view. */
|
|
1118
|
-
scenarioId?: ComparisonScenarioId;
|
|
1119
|
-
/** The array of rows to be shown in the view if this is a freeform view. */
|
|
1120
|
-
rows?: ComparisonViewRowSpec[];
|
|
1121
|
-
/** The graphs to be shown in the view. */
|
|
1122
|
-
graphs?: ComparisonViewGraphsSpec;
|
|
1123
|
-
/**
|
|
1124
|
-
* The order in which the graphs will be displayed. If undefined, the graphs will be
|
|
1125
|
-
* displayed in the "default" order, i.e., in the same order that the IDs were specified.
|
|
1126
|
-
*/
|
|
1127
|
-
graphOrder?: ComparisonViewGraphOrder;
|
|
1128
|
-
}
|
|
1129
|
-
type ComparisonViewGroupTitle = string;
|
|
1130
|
-
/**
|
|
1131
|
-
* Specifies a view group with an explicit array of view definitions.
|
|
1132
|
-
*/
|
|
1133
|
-
interface ComparisonViewGroupWithViewsSpec {
|
|
1134
|
-
kind: 'view-group-with-views';
|
|
1135
|
-
/** The title of the group of views. */
|
|
1136
|
-
title: ComparisonViewGroupTitle;
|
|
1137
|
-
/** The views that are included in this group. */
|
|
1138
|
-
views: ComparisonViewSpec[];
|
|
1139
|
-
}
|
|
1140
|
-
/**
|
|
1141
|
-
* Specifies a view group by declaring the scenarios included in the group (one view per scenario), along
|
|
1142
|
-
* with a set of graphs that will shown in each view.
|
|
1143
|
-
*/
|
|
1144
|
-
interface ComparisonViewGroupWithScenariosSpec {
|
|
1145
|
-
kind: 'view-group-with-scenarios';
|
|
1146
|
-
/** The title of the group of views. */
|
|
1147
|
-
title: ComparisonViewGroupTitle;
|
|
1148
|
-
/** The scenarios to be included (one view will be created for each scenario). */
|
|
1149
|
-
scenarios: (ComparisonScenarioRefSpec | ComparisonScenarioGroupRefSpec)[];
|
|
1150
|
-
/** The graphs to be shown for each scenario view. */
|
|
1151
|
-
graphs: ComparisonViewGraphsSpec;
|
|
1152
|
-
/**
|
|
1153
|
-
* The order in which the graphs will be displayed. If undefined, the graphs will be
|
|
1154
|
-
* displayed in the "default" order, i.e., in the same order that the IDs were specified.
|
|
1155
|
-
*/
|
|
1156
|
-
graphOrder?: ComparisonViewGraphOrder;
|
|
1157
|
-
}
|
|
1158
|
-
/**
|
|
1159
|
-
* A definition of a group of views. Multiple related views can be grouped together under a single title
|
|
1160
|
-
* to make them easy to distinguish in a report.
|
|
1161
|
-
*/
|
|
1162
|
-
type ComparisonViewGroupSpec = ComparisonViewGroupWithViewsSpec | ComparisonViewGroupWithScenariosSpec;
|
|
1163
|
-
/**
|
|
1164
|
-
* Contains the scenario and view definitions from one or more sources (JSON/YAML files or manually
|
|
1165
|
-
* defined specs).
|
|
1166
|
-
*/
|
|
1167
|
-
interface ComparisonSpecs {
|
|
1168
|
-
/** The requested scenarios. */
|
|
1169
|
-
scenarios?: ComparisonScenarioSpec[];
|
|
1170
|
-
/** The requested scenario groups. */
|
|
1171
|
-
scenarioGroups?: ComparisonScenarioGroupSpec[];
|
|
1172
|
-
/** The requested graph groups. */
|
|
1173
|
-
graphGroups?: ComparisonGraphGroupSpec[];
|
|
1174
|
-
/** The requested view groups. */
|
|
1175
|
-
viewGroups?: ComparisonViewGroupSpec[];
|
|
1176
|
-
}
|
|
1177
|
-
/** A source of comparison scenario and specifications. */
|
|
1178
|
-
interface ComparisonSpecsSource {
|
|
1179
|
-
kind: 'yaml' | 'json';
|
|
1180
|
-
/** The source filename, if known. */
|
|
1181
|
-
filename?: string;
|
|
1182
|
-
/** A string containing YAML or JSON content. */
|
|
1183
|
-
content: string;
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
/** A resolved dataset that is being compared. */
|
|
1187
|
-
interface ComparisonDataset {
|
|
1188
|
-
kind: 'dataset';
|
|
1189
|
-
/** The unique key for the dataset (i.e., output variable or static data). */
|
|
1190
|
-
key: DatasetKey;
|
|
1191
|
-
/**
|
|
1192
|
-
* The resolved output variable from the "left" model that corresponds to this dataset,
|
|
1193
|
-
* or undefined if the variable is not defined in the left model.
|
|
1194
|
-
*/
|
|
1195
|
-
outputVarL?: OutputVar;
|
|
1196
|
-
/**
|
|
1197
|
-
* The resolved output variable from the "right" model that corresponds to this dataset,
|
|
1198
|
-
* or undefined if the variable is not defined in the right model.
|
|
1199
|
-
*/
|
|
1200
|
-
outputVarR?: OutputVar;
|
|
1201
|
-
}
|
|
1202
|
-
/** A unique key for a `ComparisonScenario`, generated internally for use by the library. */
|
|
1203
|
-
type ComparisonScenarioKey = string & {
|
|
1204
|
-
_brand?: 'ComparisonScenarioKey';
|
|
1205
|
-
};
|
|
1206
|
-
/** A fatal error indicating that no input variable matched the requested name. */
|
|
1207
|
-
interface ComparisonResolverUnknownInputError {
|
|
1208
|
-
kind: 'unknown-input';
|
|
1209
|
-
}
|
|
1210
|
-
/** A fatal error indicating that no input setting group matched the requested ID. */
|
|
1211
|
-
interface ComparisonResolverUnknownInputSettingGroupError {
|
|
1212
|
-
kind: 'unknown-input-setting-group';
|
|
1213
|
-
}
|
|
1214
|
-
/**
|
|
1215
|
-
* A fatal resolution error. When this is set on an input state, the scenario
|
|
1216
|
-
* cannot be run for the affected side: spec construction for that side is
|
|
1217
|
-
* skipped and downstream UI annotations render it as an error.
|
|
1218
|
-
*/
|
|
1219
|
-
type ComparisonResolverError = ComparisonResolverUnknownInputError | ComparisonResolverUnknownInputSettingGroupError;
|
|
1220
|
-
/**
|
|
1221
|
-
* A non-fatal warning indicating that the resolved value falls outside the
|
|
1222
|
-
* declared `[minValue, maxValue]` range of a slider (or is not one of the
|
|
1223
|
-
* declared values of a switch). The scenario still runs with the requested
|
|
1224
|
-
* value; consumers (e.g. UI annotations) should flag it as a warning.
|
|
1225
|
-
*/
|
|
1226
|
-
interface ComparisonResolverValueOutOfRangeWarning {
|
|
1227
|
-
kind: 'value-out-of-range';
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* A non-fatal resolution warning. Warnings do not prevent the scenario from
|
|
1231
|
-
* running; they are surfaced as annotations alongside the resolved value.
|
|
1232
|
-
*/
|
|
1233
|
-
type ComparisonResolverWarning = ComparisonResolverValueOutOfRangeWarning;
|
|
1234
|
-
/** Describes the resolution state for a scenario input relative to a specific model. */
|
|
1235
|
-
interface ComparisonScenarioInputState {
|
|
1236
|
-
/** The matched input variable; can be undefined if no input matched. */
|
|
1237
|
-
inputVar?: InputVar;
|
|
1238
|
-
/** The position of the input, if this is a position scenario. */
|
|
1239
|
-
position?: InputPosition;
|
|
1240
|
-
/** The value of the input, for the given position or explicit value. */
|
|
1241
|
-
value?: number;
|
|
1242
|
-
/** The fatal error info if the input could not be resolved. */
|
|
1243
|
-
error?: ComparisonResolverError;
|
|
1244
|
-
/**
|
|
1245
|
-
* Non-fatal advisory info about the resolved input. When set (without an
|
|
1246
|
-
* accompanying `error`), the input still resolved and the scenario can run;
|
|
1247
|
-
* consumers should surface the warning alongside the resolved value.
|
|
1248
|
-
*/
|
|
1249
|
-
warning?: ComparisonResolverWarning;
|
|
1250
|
-
}
|
|
1251
|
-
/** A scenario input that has been checked against both "left" and "right" model. */
|
|
1252
|
-
interface ComparisonScenarioInput {
|
|
1253
|
-
/** The requested name of the input. */
|
|
1254
|
-
requestedName: string;
|
|
1255
|
-
/** The resolved state of the input for the "left" model. */
|
|
1256
|
-
stateL: ComparisonScenarioInputState;
|
|
1257
|
-
/** The resolved state of the input for the "right" model. */
|
|
1258
|
-
stateR: ComparisonScenarioInputState;
|
|
1259
|
-
}
|
|
1260
|
-
/** A configuration that sets model inputs to specific values. */
|
|
1261
|
-
interface ComparisonScenarioInputSettings {
|
|
1262
|
-
kind: 'input-settings';
|
|
1263
|
-
/** The resolutions for the specified inputs in the scenario. */
|
|
1264
|
-
inputs: ComparisonScenarioInput[];
|
|
1265
|
-
/**
|
|
1266
|
-
* Whether the settings differ between the "left" and "right" models. This is
|
|
1267
|
-
* typically only used in the case of a scenario based on model-specific setting
|
|
1268
|
-
* groups, where the set of inputs or the input values differ between the two models.
|
|
1269
|
-
*/
|
|
1270
|
-
settingsDiffer?: boolean;
|
|
1271
|
-
}
|
|
1272
|
-
/** A configuration that sets all inputs in the model to a certain position. */
|
|
1273
|
-
interface ComparisonScenarioAllInputsSettings {
|
|
1274
|
-
kind: 'all-inputs-settings';
|
|
1275
|
-
/** The input position that will be applied to all available inputs. */
|
|
1276
|
-
position: InputPosition;
|
|
1277
|
-
}
|
|
1278
|
-
/**
|
|
1279
|
-
* The configuration for an input scenario, either a set of individual input settings, or one
|
|
1280
|
-
* that sets all inputs in the model to a certain position.
|
|
1281
|
-
*/
|
|
1282
|
-
type ComparisonScenarioSettings = ComparisonScenarioInputSettings | ComparisonScenarioAllInputsSettings;
|
|
1283
|
-
/** A single resolved input scenario. */
|
|
1284
|
-
interface ComparisonScenario {
|
|
1285
|
-
kind: 'scenario';
|
|
1286
|
-
/** The unique key for the scenario, generated internally for use by the library. */
|
|
1287
|
-
key: ComparisonScenarioKey;
|
|
1288
|
-
/** The unique user-defined identifier for the scenario. */
|
|
1289
|
-
id?: ComparisonScenarioId;
|
|
1290
|
-
/** The scenario title. */
|
|
1291
|
-
title: string;
|
|
1292
|
-
/** The scenario subtitle. */
|
|
1293
|
-
subtitle?: string;
|
|
1294
|
-
/** The resolved settings for the model inputs in this scenario. */
|
|
1295
|
-
settings: ComparisonScenarioSettings;
|
|
1296
|
-
/** The input scenario used to configure the "left" model, or undefined if data not available. */
|
|
1297
|
-
specL?: ScenarioSpec;
|
|
1298
|
-
/** The input scenario used to configure the "right" model, or undefined if data not available. */
|
|
1299
|
-
specR?: ScenarioSpec;
|
|
1300
|
-
}
|
|
1301
|
-
/** An unresolved input scenario reference. */
|
|
1302
|
-
interface ComparisonUnresolvedScenarioRef {
|
|
1303
|
-
kind: 'unresolved-scenario-ref';
|
|
1304
|
-
/** The ID of the referenced scenario that could not be resolved. */
|
|
1305
|
-
scenarioId: ComparisonScenarioId;
|
|
1306
|
-
}
|
|
1307
|
-
/** A resolved group of input scenarios. */
|
|
1308
|
-
interface ComparisonScenarioGroup {
|
|
1309
|
-
kind: 'scenario-group';
|
|
1310
|
-
/** The unique identifier for the group. */
|
|
1311
|
-
id?: ComparisonScenarioGroupId;
|
|
1312
|
-
/** The title of the group. */
|
|
1313
|
-
title: ComparisonScenarioGroupTitle;
|
|
1314
|
-
/**
|
|
1315
|
-
* The scenarios that are included in this group. This includes scenarios that were successfully
|
|
1316
|
-
* resolved as well as scenario references that could not be resolved.
|
|
1317
|
-
*/
|
|
1318
|
-
scenarios: (ComparisonScenario | ComparisonUnresolvedScenarioRef)[];
|
|
1319
|
-
}
|
|
1320
|
-
/** An unresolved scenario group reference. */
|
|
1321
|
-
interface ComparisonUnresolvedScenarioGroupRef {
|
|
1322
|
-
kind: 'unresolved-scenario-group-ref';
|
|
1323
|
-
/** The ID of the referenced scenario group that could not be resolved. */
|
|
1324
|
-
scenarioGroupId: ComparisonScenarioGroupId;
|
|
1325
|
-
}
|
|
1326
|
-
/** A resolved group of graphs. */
|
|
1327
|
-
interface ComparisonGraphGroup {
|
|
1328
|
-
kind: 'graph-group';
|
|
1329
|
-
/** The unique identifier for the group. */
|
|
1330
|
-
id: ComparisonScenarioGroupId;
|
|
1331
|
-
/** The graphs that are included in this group. */
|
|
1332
|
-
graphIds: ComparisonGraphId[];
|
|
1333
|
-
}
|
|
1334
|
-
/**
|
|
1335
|
-
* A resolved comparison box to be shown in a view.
|
|
1336
|
-
*/
|
|
1337
|
-
interface ComparisonViewBox {
|
|
1338
|
-
kind: 'view-box';
|
|
1339
|
-
/** The title of the box. */
|
|
1340
|
-
title: ComparisonViewItemTitle;
|
|
1341
|
-
/** The subtitle of the box. */
|
|
1342
|
-
subtitle?: ComparisonViewItemSubtitle;
|
|
1343
|
-
/** The resolved dataset shown in this comparison box. */
|
|
1344
|
-
dataset: ComparisonDataset;
|
|
1345
|
-
/** The resolved scenario shown in this comparison box. */
|
|
1346
|
-
scenario: ComparisonScenario;
|
|
1347
|
-
}
|
|
1348
|
-
/**
|
|
1349
|
-
* A resolved row of comparison boxes to be shown in a view.
|
|
1350
|
-
*/
|
|
1351
|
-
interface ComparisonViewRow {
|
|
1352
|
-
kind: 'view-row';
|
|
1353
|
-
/** The title of the row. */
|
|
1354
|
-
title: ComparisonViewRowTitle;
|
|
1355
|
-
/** The subtitle of the row. */
|
|
1356
|
-
subtitle?: ComparisonViewRowSubtitle;
|
|
1357
|
-
/** The array of resolved boxes to be shown in the row. */
|
|
1358
|
-
boxes: ComparisonViewBox[];
|
|
1359
|
-
}
|
|
1360
|
-
/**
|
|
1361
|
-
* A resolved view definition. A view presents a set of graphs, either for a single input scenario
|
|
1362
|
-
* or for a mix of different dataset/scenario combinations.
|
|
1363
|
-
*/
|
|
1364
|
-
interface ComparisonView {
|
|
1365
|
-
kind: 'view';
|
|
1366
|
-
/** The title of the view. */
|
|
1367
|
-
title: ComparisonViewTitle;
|
|
1368
|
-
/** The subtitle of the view. */
|
|
1369
|
-
subtitle?: ComparisonViewSubtitle;
|
|
1370
|
-
/** The resolved scenario to be shown in the view if this is a single-scenario view. */
|
|
1371
|
-
scenario?: ComparisonScenario;
|
|
1372
|
-
/** The array of resolved rows to be shown in the view if this is a freeform view. */
|
|
1373
|
-
rows?: ComparisonViewRow[];
|
|
1374
|
-
/** The graphs to be shown for each scenario view. */
|
|
1375
|
-
graphIds: ComparisonGraphId[];
|
|
1376
|
-
/** The order in which the graphs will be displayed. */
|
|
1377
|
-
graphOrder: ComparisonViewGraphOrder;
|
|
1378
|
-
}
|
|
1379
|
-
/** An unresolved view. */
|
|
1380
|
-
interface ComparisonUnresolvedView {
|
|
1381
|
-
kind: 'unresolved-view';
|
|
1382
|
-
/** The requested title of the view, if provided. */
|
|
1383
|
-
title?: ComparisonViewTitle;
|
|
1384
|
-
/** The requested subtitle of the view, if provided. */
|
|
1385
|
-
subtitle?: ComparisonViewSubtitle;
|
|
1386
|
-
/** The name of the referenced dataset that could not be resolved. */
|
|
1387
|
-
datasetName?: ComparisonDatasetName;
|
|
1388
|
-
/** The source of the referenced dataset that could not be resolved. */
|
|
1389
|
-
datasetSource?: ComparisonDatasetSource;
|
|
1390
|
-
/** The ID of the referenced scenario that could not be resolved. */
|
|
1391
|
-
scenarioId?: ComparisonScenarioId;
|
|
1392
|
-
/** The ID of the referenced scenario group that could not be resolved. */
|
|
1393
|
-
scenarioGroupId?: ComparisonScenarioGroupId;
|
|
1394
|
-
}
|
|
1395
|
-
/** A resolved group of compared scenario/graph views. */
|
|
1396
|
-
interface ComparisonViewGroup {
|
|
1397
|
-
kind: 'view-group';
|
|
1398
|
-
/** The title of the group of views. */
|
|
1399
|
-
title: ComparisonViewGroupTitle;
|
|
1400
|
-
/** The array of resolved (and unresolved) views that are included in this group. */
|
|
1401
|
-
views: (ComparisonView | ComparisonUnresolvedView)[];
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
/**
|
|
1405
|
-
* A summary of timing samples collected during a performance run.
|
|
1406
|
-
*/
|
|
1407
|
-
interface PerfReport {
|
|
1408
|
-
/** Minimum sample time, in milliseconds. */
|
|
1409
|
-
readonly minTime: number;
|
|
1410
|
-
/** Maximum sample time, in milliseconds. */
|
|
1411
|
-
readonly maxTime: number;
|
|
1412
|
-
/**
|
|
1413
|
-
* Trimmed mean (interquartile mean) computed from the middle 50% of samples,
|
|
1414
|
-
* in milliseconds. This is more robust against outliers than a simple mean.
|
|
1415
|
-
*/
|
|
1416
|
-
readonly avgTime: number;
|
|
1417
|
-
/** Median (50th percentile) sample time, in milliseconds. */
|
|
1418
|
-
readonly medianTime: number;
|
|
1419
|
-
/** 95th percentile sample time, in milliseconds. */
|
|
1420
|
-
readonly p95Time: number;
|
|
1421
|
-
/** Population standard deviation across all samples, in milliseconds. */
|
|
1422
|
-
readonly stdDev: number;
|
|
1423
|
-
/** All recorded sample times, sorted ascending, in milliseconds. */
|
|
1424
|
-
readonly allTimes: number[];
|
|
1425
|
-
}
|
|
1426
|
-
/**
|
|
1427
|
-
* Collect performance timing samples and produce a robust statistical summary.
|
|
1428
|
-
*/
|
|
1429
|
-
declare class PerfStats {
|
|
1430
|
-
private readonly times;
|
|
1431
|
-
/**
|
|
1432
|
-
* Record a single run time sample.
|
|
1433
|
-
*
|
|
1434
|
-
* @param timeInMillis The run time in milliseconds.
|
|
1435
|
-
*/
|
|
1436
|
-
addRun(timeInMillis: number): void;
|
|
1437
|
-
/**
|
|
1438
|
-
* Get the raw run time samples that have been recorded.
|
|
1439
|
-
*
|
|
1440
|
-
* @returns A copy of the recorded run times, in insertion order.
|
|
1441
|
-
*/
|
|
1442
|
-
getTimes(): number[];
|
|
1443
|
-
/**
|
|
1444
|
-
* Produce a `PerfReport` summarizing the recorded samples.
|
|
1445
|
-
*
|
|
1446
|
-
* @returns The summary report.
|
|
1447
|
-
*/
|
|
1448
|
-
toReport(): PerfReport;
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
interface DiffPoint {
|
|
1452
|
-
time: number;
|
|
1453
|
-
valueL: number;
|
|
1454
|
-
valueR: number;
|
|
1455
|
-
}
|
|
1456
|
-
type DiffValidity = 'neither' | 'left-only' | 'right-only' | 'both';
|
|
1457
|
-
interface DiffReport {
|
|
1458
|
-
validity: DiffValidity;
|
|
1459
|
-
minValue: number;
|
|
1460
|
-
maxValue: number;
|
|
1461
|
-
avgDiff: number;
|
|
1462
|
-
minDiff: number;
|
|
1463
|
-
maxDiff: number;
|
|
1464
|
-
maxDiffPoint: DiffPoint;
|
|
1465
|
-
}
|
|
1466
|
-
declare function diffDatasets(datasetL: Dataset | undefined, datasetR: Dataset | undefined): DiffReport;
|
|
1467
|
-
|
|
1468
|
-
/**
|
|
1469
|
-
* The report for a single comparison test (involving a dataset produced under
|
|
1470
|
-
* a specific input scenario). This includes the full `DiffReport`, whereas
|
|
1471
|
-
* a `ComparisonTestSummary` only includes the `maxDiff` value.
|
|
1472
|
-
*/
|
|
1473
|
-
interface ComparisonTestReport {
|
|
1474
|
-
/** The key of the scenario that was compared. */
|
|
1475
|
-
scenarioKey: ComparisonScenarioKey;
|
|
1476
|
-
/** The key of the dataset that was compared. */
|
|
1477
|
-
datasetKey: DatasetKey;
|
|
1478
|
-
/** The diff report for the comparison, or undefined if the test was skipped. */
|
|
1479
|
-
diffReport?: DiffReport;
|
|
1480
|
-
/**
|
|
1481
|
-
* The diff report for the baseline scenario (all inputs at default), or undefined if this
|
|
1482
|
-
* report is for the baseline scenario itself.
|
|
1483
|
-
*/
|
|
1484
|
-
baselineDiffReport?: DiffReport;
|
|
1485
|
-
}
|
|
1486
|
-
/**
|
|
1487
|
-
* A simplified/terse version of `ComparisonTestReport` that is used when writing
|
|
1488
|
-
* results to a JSON file. The object keys are terse and it only includes the
|
|
1489
|
-
* minimum set of fields (only the `maxDiff` value instead of the full `DiffReport`)
|
|
1490
|
-
* to keep the file smaller when there are many reported differences.
|
|
1491
|
-
*/
|
|
1492
|
-
interface ComparisonTestSummary {
|
|
1493
|
-
/** Short for `scenarioKey`. */
|
|
1494
|
-
s: ComparisonScenarioKey;
|
|
1495
|
-
/** Short for `datasetKey`. */
|
|
1496
|
-
d: DatasetKey;
|
|
1497
|
-
/** Short for `maxDiff`. */
|
|
1498
|
-
md?: number;
|
|
1499
|
-
/** Short for `avgDiff`. */
|
|
1500
|
-
ad?: number;
|
|
1501
|
-
/** Short for `maxDiff` relative to baseline `maxDiff`. */
|
|
1502
|
-
mdb?: number;
|
|
1503
|
-
/** Short for `avgDiff` relative to baseline `avgDiff`. */
|
|
1504
|
-
adb?: number;
|
|
1505
|
-
}
|
|
1506
|
-
/**
|
|
1507
|
-
* The roll-up report that contains the results of all individual comparison tests.
|
|
1508
|
-
*/
|
|
1509
|
-
interface ComparisonReport {
|
|
1510
|
-
/** The set of all comparison test reports. */
|
|
1511
|
-
testReports: ComparisonTestReport[];
|
|
1512
|
-
/** The perf report for the "left" model. */
|
|
1513
|
-
perfReportL: PerfReport;
|
|
1514
|
-
/** The perf report for the "right" model. */
|
|
1515
|
-
perfReportR: PerfReport;
|
|
1516
|
-
}
|
|
1517
|
-
/**
|
|
1518
|
-
* A simplified/terse version of `ComparisonReport` that only includes the minimum set
|
|
1519
|
-
* of fields needed by the reporting app (to keep the file smaller when there are many
|
|
1520
|
-
* reported differences). This only includes comparison results for which there is
|
|
1521
|
-
* a non-zero `maxDiff` value.
|
|
1522
|
-
*/
|
|
1523
|
-
interface ComparisonSummary {
|
|
1524
|
-
/** The simplified set of all terse comparison test summaries. */
|
|
1525
|
-
testSummaries: ComparisonTestSummary[];
|
|
1526
|
-
/** The perf report for the "left" model. */
|
|
1527
|
-
perfReportL: PerfReport;
|
|
1528
|
-
/** The perf report for the "right" model. */
|
|
1529
|
-
perfReportR: PerfReport;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
type ComparisonGroupKind = 'by-dataset' | 'by-scenario';
|
|
1533
|
-
type ComparisonGroupKey = string;
|
|
1534
|
-
/**
|
|
1535
|
-
* A group of comparison test summaries associated with a particular scenario or dataset.
|
|
1536
|
-
*/
|
|
1537
|
-
interface ComparisonGroup {
|
|
1538
|
-
/** The kind of group, either 'by-dataset' or 'by-scenario'. */
|
|
1539
|
-
kind: ComparisonGroupKind;
|
|
1540
|
-
/**
|
|
1541
|
-
* The unique key for this group (a `DatasetKey` if grouped by dataset, or a
|
|
1542
|
-
* `ComparisonScenarioKey` if grouped by scenario).
|
|
1543
|
-
*/
|
|
1544
|
-
key: ComparisonGroupKey;
|
|
1545
|
-
/** The comparison test summaries for this group. */
|
|
1546
|
-
testSummaries: ComparisonTestSummary[];
|
|
1547
|
-
}
|
|
1548
|
-
/** Describes the "root" or primary item for a group of comparisons. */
|
|
1549
|
-
type ComparisonGroupRoot = ComparisonDataset | ComparisonScenario;
|
|
1550
|
-
/** A summary of scores for a group of comparisons. */
|
|
1551
|
-
interface ComparisonGroupScores {
|
|
1552
|
-
/** The total number of comparisons (sample size) for this group. */
|
|
1553
|
-
totalDiffCount: number;
|
|
1554
|
-
/** The sum of the diff values for the active sort mode (e.g., `maxDiff`, `avgDiff`) for each threshold bucket. */
|
|
1555
|
-
totalDiffByBucket: number[];
|
|
1556
|
-
/** The number of comparisons that fall into each threshold bucket. */
|
|
1557
|
-
diffCountByBucket: number[];
|
|
1558
|
-
/** The percentage of comparisons that fall into each threshold bucket. */
|
|
1559
|
-
diffPercentByBucket: number[];
|
|
1560
|
-
}
|
|
1561
|
-
/**
|
|
1562
|
-
* A summary of a group of comparisons that includes the resolved scenario/dataset metadata
|
|
1563
|
-
* and score information for the group.
|
|
1564
|
-
*/
|
|
1565
|
-
interface ComparisonGroupSummary {
|
|
1566
|
-
/** The metadata for the "root" or primary item for this group of comparisons. */
|
|
1567
|
-
root: ComparisonGroupRoot;
|
|
1568
|
-
/** The group containing the comparison summaries. */
|
|
1569
|
-
group: ComparisonGroup;
|
|
1570
|
-
/** The scores for this group, or undefined if comparisons were not performed for this group. */
|
|
1571
|
-
scores?: ComparisonGroupScores;
|
|
1572
|
-
}
|
|
1573
|
-
/**
|
|
1574
|
-
* Breaks down a set of by-scenario or by-dataset groupings into distinct categories.
|
|
1575
|
-
*/
|
|
1576
|
-
interface ComparisonGroupSummariesByCategory {
|
|
1577
|
-
/**
|
|
1578
|
-
* All groups in a map, keyed by "group key" (either a dataset key or scenario key).
|
|
1579
|
-
*/
|
|
1580
|
-
allGroupSummaries: Map<ComparisonGroupKey, ComparisonGroupSummary>;
|
|
1581
|
-
/**
|
|
1582
|
-
* Groups with items that have errors (are not valid) for both "left" and "right" models.
|
|
1583
|
-
*/
|
|
1584
|
-
withErrors: ComparisonGroupSummary[];
|
|
1585
|
-
/**
|
|
1586
|
-
* Groups with items that are only valid for the "left" model (for example, datasets that
|
|
1587
|
-
* were removed and no longer available in the "right" model).
|
|
1588
|
-
*/
|
|
1589
|
-
onlyInLeft: ComparisonGroupSummary[];
|
|
1590
|
-
/**
|
|
1591
|
-
* Groups with items that are only valid for the "right" model (for example, scenarios
|
|
1592
|
-
* for inputs that were added in the "right" model).
|
|
1593
|
-
*/
|
|
1594
|
-
onlyInRight: ComparisonGroupSummary[];
|
|
1595
|
-
/**
|
|
1596
|
-
* Groups with one or more comparisons that have non-zero diff scores; the groups
|
|
1597
|
-
* will be sorted by the diff score according to the active sort mode, with higher
|
|
1598
|
-
* scores at the front of the array.
|
|
1599
|
-
*/
|
|
1600
|
-
withDiffs: ComparisonGroupSummary[];
|
|
1601
|
-
/**
|
|
1602
|
-
* Groups where all comparisons have diff scores of zero (no differences between
|
|
1603
|
-
* "left" and "right").
|
|
1604
|
-
*/
|
|
1605
|
-
withoutDiffs: ComparisonGroupSummary[];
|
|
1606
|
-
}
|
|
1607
|
-
/**
|
|
1608
|
-
* Rolls up all by-scenario and by-dataset groupings.
|
|
1609
|
-
*/
|
|
1610
|
-
interface ComparisonCategorizedResults {
|
|
1611
|
-
/** All summaries for the comparison tests that were performed. */
|
|
1612
|
-
allTestSummaries: ComparisonTestSummary[];
|
|
1613
|
-
/** The full set of by-scenario groupings. */
|
|
1614
|
-
byScenario: ComparisonGroupSummariesByCategory;
|
|
1615
|
-
/** The full set of by-dataset groupings. */
|
|
1616
|
-
byDataset: ComparisonGroupSummariesByCategory;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
/**
|
|
1620
|
-
* Provides access to the set of dataset definitions (`ComparisonDataset` instances) that are used
|
|
1621
|
-
* when comparing the two models.
|
|
1622
|
-
*/
|
|
1623
|
-
interface ComparisonDatasets {
|
|
1624
|
-
/**
|
|
1625
|
-
* Return all `ComparisonDataset` instances that are available for comparisons.
|
|
1626
|
-
*/
|
|
1627
|
-
getAllDatasets(): IterableIterator<ComparisonDataset>;
|
|
1628
|
-
/**
|
|
1629
|
-
* Return the dataset metadata for the given key.
|
|
1630
|
-
*
|
|
1631
|
-
* @param datasetKey The key for the dataset.
|
|
1632
|
-
*/
|
|
1633
|
-
getDataset(datasetKey: DatasetKey): ComparisonDataset | undefined;
|
|
1634
|
-
/**
|
|
1635
|
-
* Return the keys for the datasets that should be compared for the given scenario.
|
|
1636
|
-
*
|
|
1637
|
-
* @param scenario The scenario definition.
|
|
1638
|
-
*/
|
|
1639
|
-
getDatasetKeysForScenario(scenario: ComparisonScenario): DatasetKey[];
|
|
1640
|
-
/**
|
|
1641
|
-
* Return the reference plots that should be shown in the comparison graph for the
|
|
1642
|
-
* given dataset and scenario.
|
|
1643
|
-
*
|
|
1644
|
-
* @param datasetKey The key for the dataset.
|
|
1645
|
-
* @param scenario The scenario for which the dataset will be displayed.
|
|
1646
|
-
*/
|
|
1647
|
-
getReferencePlotsForDataset(datasetKey: DatasetKey, scenario: ComparisonScenario): ComparisonPlot[];
|
|
1648
|
-
/**
|
|
1649
|
-
* Return the context graph IDs that should be shown for the given dataset and scenario.
|
|
1650
|
-
*
|
|
1651
|
-
* @param datasetKey The key for the dataset.
|
|
1652
|
-
* @param scenario The scenario for which the dataset will be displayed.
|
|
1653
|
-
*/
|
|
1654
|
-
getContextGraphIdsForDataset(datasetKey: DatasetKey, scenario: ComparisonScenario): BundleGraphId[];
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
interface ComparisonScenarios {
|
|
1658
|
-
/**
|
|
1659
|
-
* Return all `ComparisonScenario` instances that are available for comparisons.
|
|
1660
|
-
*/
|
|
1661
|
-
getAllScenarios(): IterableIterator<ComparisonScenario>;
|
|
1662
|
-
/**
|
|
1663
|
-
* Return the scenario definition for the given key.
|
|
1664
|
-
*
|
|
1665
|
-
* @param key The key for the scenario.
|
|
1666
|
-
*/
|
|
1667
|
-
getScenario(key: ComparisonScenarioKey): ComparisonScenario | undefined;
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
/**
|
|
1671
|
-
* Describes an extra plot to be shown in a comparison graph.
|
|
1672
|
-
*/
|
|
1673
|
-
interface ComparisonPlot {
|
|
1674
|
-
/** The dataset key for the plot. */
|
|
1675
|
-
datasetKey: DatasetKey;
|
|
1676
|
-
/** The plot color. */
|
|
1677
|
-
color: string;
|
|
1678
|
-
/** The plot style. If undefined, defaults to 'normal'. */
|
|
1679
|
-
style?: 'normal' | 'dashed';
|
|
1680
|
-
/** The plot line width, in px units. If undefined, a default width will be used. */
|
|
1681
|
-
lineWidth?: number;
|
|
1682
|
-
}
|
|
1683
|
-
interface ComparisonDatasetOptions {
|
|
1684
|
-
/**
|
|
1685
|
-
* The mapping of renamed dataset keys (old or "left" name as the map key,
|
|
1686
|
-
* new or "right" name as the value).
|
|
1687
|
-
*/
|
|
1688
|
-
renamedDatasetKeys?: Map<DatasetKey, DatasetKey>;
|
|
1689
|
-
/**
|
|
1690
|
-
* An optional function that allows for limiting the datasets that are compared
|
|
1691
|
-
* for a given scenario. By default, all datasets are compared for a given
|
|
1692
|
-
* scenario, but if a custom function is provided, it can return a subset of
|
|
1693
|
-
* datasets (for example, to omit datasets that are not relevant).
|
|
1694
|
-
*/
|
|
1695
|
-
datasetKeysForScenario?: (allDatasetKeys: DatasetKey[], scenario: ComparisonScenario) => DatasetKey[];
|
|
1696
|
-
/**
|
|
1697
|
-
* An optional function that allows for including additional reference plots
|
|
1698
|
-
* on a comparison graph for a given dataset and scenario. By default, no
|
|
1699
|
-
* additional reference plots are included, but if a custom function is
|
|
1700
|
-
* provided, it can return an array of `ComparisonPlot` objects.
|
|
1701
|
-
*/
|
|
1702
|
-
referencePlotsForDataset?: (dataset: ComparisonDataset, scenario: ComparisonScenario) => ComparisonPlot[];
|
|
1703
|
-
/**
|
|
1704
|
-
* An optional function that allows for customizing the set of context graphs
|
|
1705
|
-
* that are shown for a given dataset and scenario. By default, all graphs in
|
|
1706
|
-
* which the dataset appears will be shown, but if a custom function is provided,
|
|
1707
|
-
* it can return a different set of graphs (for example, to omit graphs that are
|
|
1708
|
-
* not relevant under the given scenario).
|
|
1709
|
-
*/
|
|
1710
|
-
contextGraphIdsForDataset?: (dataset: ComparisonDataset, scenario: ComparisonScenario) => BundleGraphId[];
|
|
1711
|
-
}
|
|
1712
|
-
/**
|
|
1713
|
-
* Describes a row in the comparison report summary view.
|
|
1714
|
-
*/
|
|
1715
|
-
interface ComparisonReportSummaryRow {
|
|
1716
|
-
/** The group summary represented by the row. */
|
|
1717
|
-
groupSummary: ComparisonGroupSummary;
|
|
1718
|
-
/** The custom title for the row (this overrides the default title derived from the summary). */
|
|
1719
|
-
title?: string;
|
|
1720
|
-
/** The custom subtitle for the row (this overrides the default subtitle derived from the summary). */
|
|
1721
|
-
subtitle?: string;
|
|
1722
|
-
}
|
|
1723
|
-
/**
|
|
1724
|
-
* Describes a section in the comparison report summary view.
|
|
1725
|
-
*/
|
|
1726
|
-
interface ComparisonReportSummarySection {
|
|
1727
|
-
/** The text to display for the section header. */
|
|
1728
|
-
headerText: string;
|
|
1729
|
-
/** The summary rows to display in the section. */
|
|
1730
|
-
rows: ComparisonReportSummaryRow[];
|
|
1731
|
-
/**
|
|
1732
|
-
* The initial expanded state of the section. If undefined, defaults to 'expanded-if-diffs',
|
|
1733
|
-
* meaning the section will be initially expanded only if any rows have differences, otherwise
|
|
1734
|
-
* it will be initially collapsed.
|
|
1735
|
-
*/
|
|
1736
|
-
initialState?: 'collapsed' | 'expanded' | 'expanded-if-diffs';
|
|
1737
|
-
/**
|
|
1738
|
-
* Whether the items in the section are stable, i.e., not changing from run to run. If
|
|
1739
|
-
* undefined, defaults to false. This can be used to group items in the filter panel.
|
|
1740
|
-
* Set it to true if the group contains a stable set of rows where the order does not
|
|
1741
|
-
* change between runs. Set it to false (or leave it undefined) if the group contains
|
|
1742
|
-
* rows that have a different order between runs (for example, "Scenarios producing
|
|
1743
|
-
* differences").
|
|
1744
|
-
*/
|
|
1745
|
-
stable?: boolean;
|
|
1746
|
-
}
|
|
1747
|
-
/**
|
|
1748
|
-
* Describes an item (box) in the comparison report detail view.
|
|
1749
|
-
*/
|
|
1750
|
-
interface ComparisonReportDetailItem {
|
|
1751
|
-
/** The title of the item. */
|
|
1752
|
-
title: string;
|
|
1753
|
-
/** The subtitle of the item (if any). */
|
|
1754
|
-
subtitle?: string;
|
|
1755
|
-
/** The scenario for the item. */
|
|
1756
|
-
scenario: ComparisonScenario;
|
|
1757
|
-
/** The test summary for the item. */
|
|
1758
|
-
testSummary: ComparisonTestSummary;
|
|
1759
|
-
}
|
|
1760
|
-
/**
|
|
1761
|
-
* Describes a row in the comparison report detail view.
|
|
1762
|
-
*/
|
|
1763
|
-
interface ComparisonReportDetailRow {
|
|
1764
|
-
/** The title of the row. */
|
|
1765
|
-
title: string;
|
|
1766
|
-
/** The subtitle of the row (if any). */
|
|
1767
|
-
subtitle?: string;
|
|
1768
|
-
/** The score for the row (the meaning of the value depends on the chosen statistical method). */
|
|
1769
|
-
score: number;
|
|
1770
|
-
/** The items in this row (one item per box). */
|
|
1771
|
-
items: ComparisonReportDetailItem[];
|
|
1772
|
-
}
|
|
1773
|
-
interface ComparisonReportOptions {
|
|
1774
|
-
/**
|
|
1775
|
-
* An optional function that allows for customizing the order and grouping of
|
|
1776
|
-
* sections and rows in the "comparisons by scenario" summary view.
|
|
1777
|
-
*
|
|
1778
|
-
* @param summaries The comparison summaries, one summary per scenario.
|
|
1779
|
-
* @returns The sections to display in the "comparisons by scenario" summary view.
|
|
1780
|
-
*/
|
|
1781
|
-
summarySectionsForComparisonsByScenario?: (summaries: ComparisonGroupSummariesByCategory) => ComparisonReportSummarySection[];
|
|
1782
|
-
/**
|
|
1783
|
-
* An optional function that allows for customizing the order and grouping of
|
|
1784
|
-
* sections and rows in the "comparisons by dataset" summary view.
|
|
1785
|
-
*
|
|
1786
|
-
* @param summaries The comparison summaries, one summary per dataset.
|
|
1787
|
-
* @returns The sections to display in the "comparisons by dataset" summary view.
|
|
1788
|
-
*/
|
|
1789
|
-
summarySectionsForComparisonsByDataset?: (summaries: ComparisonGroupSummariesByCategory) => ComparisonReportSummarySection[];
|
|
1790
|
-
/**
|
|
1791
|
-
* An optional function that allows for customizing the order of rows and boxes
|
|
1792
|
-
* in the detail view for a scenario.
|
|
1793
|
-
*
|
|
1794
|
-
* @param rows The original rows to be displayed in the detail view for a scenario.
|
|
1795
|
-
* @returns The customized rows to display in the detail view for a scenario.
|
|
1796
|
-
*/
|
|
1797
|
-
detailRowsForScenario?: (rows: ComparisonReportDetailRow[]) => ComparisonReportDetailRow[];
|
|
1798
|
-
/**
|
|
1799
|
-
* An optional function that allows for customizing the order of rows and boxes
|
|
1800
|
-
* in the detail view for a dataset.
|
|
1801
|
-
*
|
|
1802
|
-
* @param rows The original rows to be displayed in the detail view for a dataset.
|
|
1803
|
-
* @returns The customized rows to display in the detail view for a dataset.
|
|
1804
|
-
*/
|
|
1805
|
-
detailRowsForDataset?: (rows: ComparisonReportDetailRow[]) => ComparisonReportDetailRow[];
|
|
1806
|
-
}
|
|
1807
|
-
interface ComparisonOptions {
|
|
1808
|
-
/** The left-side ("baseline") bundle being compared. */
|
|
1809
|
-
baseline: NamedBundle;
|
|
1810
|
-
/**
|
|
1811
|
-
* The array of thresholds used to color differences. Defaults to [1, 5, 10]
|
|
1812
|
-
* which will use buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
|
|
1813
|
-
*/
|
|
1814
|
-
thresholds?: number[];
|
|
1815
|
-
/**
|
|
1816
|
-
* The array of ratio thresholds used to color differences when relative sorting is
|
|
1817
|
-
* active. Defaults to [1, 2, 3] which will use buckets of 0, 0-1, 1-2, 2-3, and >3.
|
|
1818
|
-
*/
|
|
1819
|
-
ratioThresholds?: number[];
|
|
1820
|
-
/**
|
|
1821
|
-
* The requested comparison scenario and view specifications. These can be
|
|
1822
|
-
* specified in YAML or JSON files, or using `Spec` objects.
|
|
1823
|
-
*/
|
|
1824
|
-
specs: (ComparisonSpecs | ComparisonSpecsSource)[];
|
|
1825
|
-
/** Optional configuration for the datasets that are compared for different scenarios. */
|
|
1826
|
-
datasets?: ComparisonDatasetOptions;
|
|
1827
|
-
/** Options for customizing the comparison report. */
|
|
1828
|
-
report?: ComparisonReportOptions;
|
|
1829
|
-
}
|
|
1830
|
-
interface ComparisonConfig {
|
|
1831
|
-
/** The loaded left-side ("baseline") bundle being compared. */
|
|
1832
|
-
bundleL: LoadedBundle;
|
|
1833
|
-
/** The loaded right-side ("current") bundle being compared. */
|
|
1834
|
-
bundleR: LoadedBundle;
|
|
1835
|
-
/**
|
|
1836
|
-
* The array of thresholds used to color differences. For example, [1, 5, 10] will use
|
|
1837
|
-
* buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
|
|
1838
|
-
*/
|
|
1839
|
-
thresholds: number[];
|
|
1840
|
-
/**
|
|
1841
|
-
* The array of ratio thresholds used to color differences when relative sorting is
|
|
1842
|
-
* active. For example, [1, 2, 3] will use buckets of 0, 0-1, 1-2, 2-3, and >3.
|
|
1843
|
-
*/
|
|
1844
|
-
ratioThresholds: number[];
|
|
1845
|
-
/** The set of resolved scenarios that will be compared. */
|
|
1846
|
-
scenarios: ComparisonScenarios;
|
|
1847
|
-
/** The set of resolved datasets that will be compared. */
|
|
1848
|
-
datasets: ComparisonDatasets;
|
|
1849
|
-
/** The set of resolved view groups. */
|
|
1850
|
-
viewGroups: ComparisonViewGroup[];
|
|
1851
|
-
/** Options for customizing the comparison report. */
|
|
1852
|
-
reportOptions?: ComparisonReportOptions;
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
type ComparisonDataRequestKey = string;
|
|
1856
|
-
/**
|
|
1857
|
-
* Options for `requestDatasetMaps`.
|
|
1858
|
-
*/
|
|
1859
|
-
interface RequestDatasetMapsOptions {
|
|
1860
|
-
/** Optional constant overrides for the "left" model. */
|
|
1861
|
-
constantsL?: ConstantOverride[];
|
|
1862
|
-
/** Optional constant overrides for the "right" model. */
|
|
1863
|
-
constantsR?: ConstantOverride[];
|
|
1864
|
-
/** Optional lookup overrides for the "left" model. */
|
|
1865
|
-
lookupsL?: LookupOverride[];
|
|
1866
|
-
/** Optional lookup overrides for the "right" model. */
|
|
1867
|
-
lookupsR?: LookupOverride[];
|
|
1868
|
-
}
|
|
1869
|
-
/**
|
|
1870
|
-
* Coordinates loading of data in parallel from two models.
|
|
1871
|
-
*/
|
|
1872
|
-
declare class ComparisonDataCoordinator {
|
|
1873
|
-
private readonly taskQueue;
|
|
1874
|
-
constructor(taskQueue: TaskQueue);
|
|
1875
|
-
/**
|
|
1876
|
-
* Request datasets from the two models.
|
|
1877
|
-
*
|
|
1878
|
-
* @param requestKey The unique key for the request.
|
|
1879
|
-
* @param sourceL The source of the first ("left") dataset. If "left", the datasets will
|
|
1880
|
-
* be fetched from the "left" bundle's model, otherwise they will be fetched from the
|
|
1881
|
-
* "right" bundle's model.
|
|
1882
|
-
* @param scenarioSpecL The scenario used for the first ("left") model of the comparison.
|
|
1883
|
-
* @param sourceR The source of the second ("right") dataset. If "left", the datasets
|
|
1884
|
-
* will be fetched from the "left" bundle's model, otherwise they will be fetched from
|
|
1885
|
-
* the "right" bundle's model.
|
|
1886
|
-
* @param scenarioSpecR The scenario used for the second ("right") model of the comparison.
|
|
1887
|
-
* @param datasetKeys The keys of the datasets to be fetched.
|
|
1888
|
-
* @param options Optional configuration including constant and lookup overrides.
|
|
1889
|
-
* @param onResponse The callback that will be called with the dataset maps.
|
|
1890
|
-
*/
|
|
1891
|
-
requestDatasetMaps(requestKey: ComparisonDataRequestKey, sourceL: 'left' | 'right', scenarioSpecL: ScenarioSpec, sourceR: 'left' | 'right', scenarioSpecR: ScenarioSpec, datasetKeys: DatasetKey[], options: RequestDatasetMapsOptions | undefined, onResponse: (datasetMapL?: DatasetMap, datasetMapR?: DatasetMap) => void): void;
|
|
1892
|
-
/**
|
|
1893
|
-
* Request graph data from the two models.
|
|
1894
|
-
*
|
|
1895
|
-
* @param requestKey The unique key for the request.
|
|
1896
|
-
* @param sourceL The source of the first ("left") dataset. If "left", the datasets will
|
|
1897
|
-
* be fetched from the "left" bundle's model, otherwise they will be fetched from the
|
|
1898
|
-
* "right" bundle's model.
|
|
1899
|
-
* @param scenarioSpecL The scenario used for the first ("left") model of the comparison.
|
|
1900
|
-
* @param sourceR The source of the second ("right") dataset. If "left", the datasets
|
|
1901
|
-
* will be fetched from the "left" bundle's model, otherwise they will be fetched from
|
|
1902
|
-
* the "right" bundle's model.
|
|
1903
|
-
* @param scenarioSpecR The scenario used for the second ("right") model of the comparison.
|
|
1904
|
-
* @param graphId The ID of the graph for which data will be fetched.
|
|
1905
|
-
* @param onResponse The callback that will be called with the graph data.
|
|
1906
|
-
*/
|
|
1907
|
-
requestGraphData(requestKey: ComparisonDataRequestKey, sourceL: 'left' | 'right', scenarioSpecL: ScenarioSpec, sourceR: 'left' | 'right', scenarioSpecR: ScenarioSpec, graphId: BundleGraphId, onResponse: (graphDataL?: BundleGraphData, graphDataR?: BundleGraphData) => void): void;
|
|
1908
|
-
cancelRequest(key: ComparisonDataRequestKey): void;
|
|
1909
|
-
}
|
|
1910
|
-
declare function createComparisonDataCoordinator(): ComparisonDataCoordinator;
|
|
1911
|
-
|
|
1912
|
-
type GraphInclusion = 'neither' | 'left-only' | 'right-only' | 'both';
|
|
1913
|
-
interface GraphComparisonMetadataReport {
|
|
1914
|
-
/** The key for the metadata field. */
|
|
1915
|
-
key: string;
|
|
1916
|
-
/** The value of the metadata field in the left bundle. */
|
|
1917
|
-
valueL?: string;
|
|
1918
|
-
/** The value of the metadata field in the right bundle. */
|
|
1919
|
-
valueR?: string;
|
|
1920
|
-
}
|
|
1921
|
-
interface GraphComparisonDatasetReport {
|
|
1922
|
-
/** The dataset key. */
|
|
1923
|
-
datasetKey: DatasetKey;
|
|
1924
|
-
/** The max diff for this dataset. */
|
|
1925
|
-
maxDiff?: number;
|
|
1926
|
-
}
|
|
1927
|
-
interface GraphComparisonReport {
|
|
1928
|
-
/** Indicates which bundles the graph is defined in. */
|
|
1929
|
-
inclusion: GraphInclusion;
|
|
1930
|
-
/** The metadata fields with differences. */
|
|
1931
|
-
metadataReports: GraphComparisonMetadataReport[];
|
|
1932
|
-
/** The datasets with differences. */
|
|
1933
|
-
datasetReports: GraphComparisonDatasetReport[];
|
|
1934
|
-
}
|
|
1935
|
-
/**
|
|
1936
|
-
* Comparison the metadata and datasets for the given graphs.
|
|
1937
|
-
*
|
|
1938
|
-
* @param graphL The graph defined in the left bundle.
|
|
1939
|
-
* @param graphR The graph defined in the right bundle.
|
|
1940
|
-
* @param scenarioKey The key of the scenario used for comparing datasets.
|
|
1941
|
-
* @param testSummaries The set of test summaries from a previous comparison run.
|
|
1942
|
-
*/
|
|
1943
|
-
declare function diffGraphs(graphL: BundleGraphSpec | undefined, graphR: BundleGraphSpec | undefined, scenarioKey: ComparisonScenarioKey, testSummaries: ComparisonTestSummary[]): GraphComparisonReport;
|
|
1944
|
-
|
|
1945
|
-
/**
|
|
1946
|
-
* Convert a full `ComparisonReport` to a simplified `ComparisonSummary` that includes
|
|
1947
|
-
* the minimum set of fields needed to keep the file smaller when there are many
|
|
1948
|
-
* reported differences. This only includes comparison results for which there
|
|
1949
|
-
* is a non-zero `maxDiff` value.
|
|
1950
|
-
*
|
|
1951
|
-
* @param comparisonReport The full comparison report.
|
|
1952
|
-
* @return The terse summary.
|
|
1953
|
-
*/
|
|
1954
|
-
declare function comparisonSummaryFromReport(comparisonReport: ComparisonReport): ComparisonSummary;
|
|
1955
|
-
/**
|
|
1956
|
-
* Convert a full `ComparisonTestReport` to a terse `ComparisonTestSummary`. This will
|
|
1957
|
-
* return undefined if the test has a zero `maxDiff` value.
|
|
1958
|
-
*
|
|
1959
|
-
* @param r The full comparison test report.
|
|
1960
|
-
* @param baselineMaxDiff The max diff for the baseline scenario, or undefined if not available.
|
|
1961
|
-
* @param baselineAvgDiff The avg diff for the baseline scenario, or undefined if not available.
|
|
1962
|
-
* @return The terse comparison test summary.
|
|
1963
|
-
*/
|
|
1964
|
-
declare function testSummaryFromReport(r: ComparisonTestReport, baselineMaxDiff: number | undefined, baselineAvgDiff: number | undefined): ComparisonTestSummary | undefined;
|
|
1965
|
-
|
|
1966
|
-
/** The available sort modes for categorizing comparison groups. */
|
|
1967
|
-
type ComparisonSortMode = 'max-diff' | 'avg-diff' | 'max-diff-relative' | 'avg-diff-relative';
|
|
1968
|
-
|
|
1969
|
-
/**
|
|
1970
|
-
* Compute the overall scores for the given group of comparison test summaries.
|
|
1971
|
-
*
|
|
1972
|
-
* @param testSummaries The comparison test summaries to consider.
|
|
1973
|
-
* @param thresholds The array of thresholds that determine the buckets into which
|
|
1974
|
-
* the scores will be summarized.
|
|
1975
|
-
* @param sortMode The sort mode to determine which field to use for scoring.
|
|
1976
|
-
*/
|
|
1977
|
-
declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[], thresholds: number[], sortMode: ComparisonSortMode): ComparisonGroupScores;
|
|
1978
|
-
|
|
1979
|
-
/**
|
|
1980
|
-
* Given a set of terse test summaries (which only includes summaries for tests with non-zero `maxDiff`
|
|
1981
|
-
* scores), restore the full set of summaries and then categorize them.
|
|
1982
|
-
*
|
|
1983
|
-
* @param comparisonConfig The comparison configuration.
|
|
1984
|
-
* @param terseSummaries The set of terse test summaries.
|
|
1985
|
-
* @param sortMode The sort mode to determine which field to use for scoring.
|
|
1986
|
-
*/
|
|
1987
|
-
declare function categorizeComparisonTestSummaries(comparisonConfig: ComparisonConfig, terseSummaries: ComparisonTestSummary[], sortMode: ComparisonSortMode): ComparisonCategorizedResults;
|
|
1988
|
-
|
|
1989
|
-
/**
|
|
1990
|
-
* Additional options that are passed to `getConfigOptions`.
|
|
1991
|
-
*/
|
|
1992
|
-
interface ConfigInitOptions {
|
|
1993
|
-
/** If defined, overrides the displayed name of the baseline ("left") bundle. */
|
|
1994
|
-
bundleNameL?: string;
|
|
1995
|
-
/** If defined, overrides the displayed name of the current ("right") bundle. */
|
|
1996
|
-
bundleNameR?: string;
|
|
1997
|
-
}
|
|
1998
|
-
/**
|
|
1999
|
-
* The user-specified options used by the library to resolve and initialize a `Config` instance.
|
|
2000
|
-
*/
|
|
2001
|
-
interface ConfigOptions {
|
|
2002
|
-
/**
|
|
2003
|
-
* The bundle being checked. This bundle will also be compared against the
|
|
2004
|
-
* "baseline" bundle, if `comparison` options are defined.
|
|
2005
|
-
*/
|
|
2006
|
-
current: NamedBundle;
|
|
2007
|
-
/**
|
|
2008
|
-
* The model check options.
|
|
2009
|
-
*/
|
|
2010
|
-
check: CheckOptions;
|
|
2011
|
-
/**
|
|
2012
|
-
* The model comparison options.
|
|
2013
|
-
*/
|
|
2014
|
-
comparison?: ComparisonOptions;
|
|
2015
|
-
/**
|
|
2016
|
-
* The number of model instances to initialize for each bundle.
|
|
2017
|
-
*
|
|
2018
|
-
* If undefined, the default behavior will be used, which is to initialize a single
|
|
2019
|
-
* model instance for each bundle.
|
|
2020
|
-
*
|
|
2021
|
-
* If you set this to a value greater than 1, it will allow multiple pairs of model
|
|
2022
|
-
* instances to be run concurrently. For example, if the number of CPU cores is 8,
|
|
2023
|
-
* setting this to 4 will allow 4 pairs of model instances to be run concurrently,
|
|
2024
|
-
* using all available cores.
|
|
2025
|
-
*
|
|
2026
|
-
* If you set this to 0, the implementation will automatically choose a value based on
|
|
2027
|
-
* the number of available CPU cores (i.e., the number of cores divided by 2).
|
|
2028
|
-
*/
|
|
2029
|
-
concurrency?: number;
|
|
2030
|
-
}
|
|
2031
|
-
/**
|
|
2032
|
-
* The resolved configuration for check and comparison tests.
|
|
2033
|
-
*/
|
|
2034
|
-
interface Config {
|
|
2035
|
-
/** The resolved check test configuration. */
|
|
2036
|
-
check: CheckConfig;
|
|
2037
|
-
/** The resolved comparison test configuration. */
|
|
2038
|
-
comparison?: ComparisonConfig;
|
|
2039
|
-
}
|
|
2040
|
-
|
|
2041
|
-
declare function createConfig(options: ConfigOptions): Promise<Config>;
|
|
2042
|
-
|
|
2043
|
-
type CancelRunPerf = () => void;
|
|
2044
|
-
interface RunPerfCallbacks {
|
|
2045
|
-
onComplete?: (reportL: PerfReport, reportR: PerfReport) => void;
|
|
2046
|
-
onError?: (error: Error) => void;
|
|
2047
|
-
}
|
|
2048
|
-
interface RunPerfOptions {
|
|
2049
|
-
/** The mode to run the performance tests (default is 'serial'). */
|
|
2050
|
-
mode?: 'serial' | 'parallel';
|
|
2051
|
-
/** The number of warmups for each perf run (default is 5). */
|
|
2052
|
-
warmupCount?: number;
|
|
2053
|
-
/** The number of times to run the model for each perf run (default is 100). */
|
|
2054
|
-
runCount?: number;
|
|
2055
|
-
}
|
|
2056
|
-
/**
|
|
2057
|
-
* Run performance tests on the bundle models.
|
|
2058
|
-
*
|
|
2059
|
-
* @param callbacks The callbacks that will be notified.
|
|
2060
|
-
* @param options The options for the performance run.
|
|
2061
|
-
* @return A function that will cancel the process when invoked.
|
|
2062
|
-
*/
|
|
2063
|
-
declare function runPerf(callbacks: RunPerfCallbacks, options?: RunPerfOptions): CancelRunPerf;
|
|
2064
|
-
|
|
2065
|
-
/**
|
|
2066
|
-
* The report for a single trace comparison between two datasets.
|
|
2067
|
-
*
|
|
2068
|
-
* TODO: This is basically the same as `DiffReport`, except that it preserves the
|
|
2069
|
-
* diff points. Maybe we can combine them and make the points array an opt-in thing.
|
|
2070
|
-
*/
|
|
2071
|
-
interface TraceDatasetReport {
|
|
2072
|
-
datasetKey: DatasetKey;
|
|
2073
|
-
validity: DiffValidity;
|
|
2074
|
-
points: Map<number, DiffPoint>;
|
|
2075
|
-
minValue: number;
|
|
2076
|
-
maxValue: number;
|
|
2077
|
-
avgDiff: number;
|
|
2078
|
-
minDiff: number;
|
|
2079
|
-
maxDiff: number;
|
|
2080
|
-
maxDiffPoint: DiffPoint;
|
|
2081
|
-
}
|
|
2082
|
-
/**
|
|
2083
|
-
* The roll-up report that contains the results of the trace comparisons
|
|
2084
|
-
* for all datasets.
|
|
2085
|
-
*/
|
|
2086
|
-
interface TraceReport {
|
|
2087
|
-
datasetReports: Map<DatasetKey, TraceDatasetReport>;
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
type CancelRunTrace = () => void;
|
|
2091
|
-
interface RunTraceCallbacks {
|
|
2092
|
-
onComplete?: (traceReport: TraceReport) => void;
|
|
2093
|
-
onError?: (error: Error) => void;
|
|
2094
|
-
}
|
|
2095
|
-
interface TraceCompareToBundleOptions {
|
|
2096
|
-
kind: 'compare-to-bundle';
|
|
2097
|
-
bundleSide0: 'left' | 'right';
|
|
2098
|
-
scenarioSpec0: ScenarioSpec;
|
|
2099
|
-
bundleSide1: 'left' | 'right';
|
|
2100
|
-
scenarioSpec1: ScenarioSpec;
|
|
2101
|
-
}
|
|
2102
|
-
interface TraceCompareToExtDataOptions {
|
|
2103
|
-
kind: 'compare-to-ext-data';
|
|
2104
|
-
extData: DatasetMap;
|
|
2105
|
-
bundleSide: 'left' | 'right';
|
|
2106
|
-
scenarioSpec: ScenarioSpec;
|
|
2107
|
-
}
|
|
2108
|
-
type TraceOptions = TraceCompareToBundleOptions | TraceCompareToExtDataOptions;
|
|
2109
|
-
/**
|
|
2110
|
-
* Perform a trace run, comparing all datasets from the requested models.
|
|
2111
|
-
*
|
|
2112
|
-
* @param modelSpec The model spec that provides the datasets to be compared (usually from the "right" bundle).
|
|
2113
|
-
* @param callbacks The callbacks that will be notified.
|
|
2114
|
-
* @param options Options to control how the trace is run.
|
|
2115
|
-
* @return A function that will cancel the process when invoked.
|
|
2116
|
-
*/
|
|
2117
|
-
declare function runTrace(modelSpec: ModelSpec, callbacks: RunTraceCallbacks, options: TraceOptions): CancelRunTrace;
|
|
2118
|
-
|
|
2119
|
-
/**
|
|
2120
|
-
* The report for a single run of the full check+comparison test suite.
|
|
2121
|
-
*/
|
|
2122
|
-
interface SuiteReport {
|
|
2123
|
-
/** The check report. */
|
|
2124
|
-
checkReport: CheckReport;
|
|
2125
|
-
/** The comparison report (only defined if comparisons were enabled). */
|
|
2126
|
-
comparisonReport?: ComparisonReport;
|
|
2127
|
-
}
|
|
2128
|
-
/**
|
|
2129
|
-
* A simplified/terse version of `SuiteReport` that is used when writing
|
|
2130
|
-
* results to a JSON file. The object keys are terse and it only includes
|
|
2131
|
-
* the minimum set of fields (e.g., only the `maxDiff` value instead of the
|
|
2132
|
-
* full `DiffReport` for each comparison test) to keep the file smaller
|
|
2133
|
-
* when there are many reported differences.
|
|
2134
|
-
*/
|
|
2135
|
-
interface SuiteSummary {
|
|
2136
|
-
/** The date and time the suite was run (in ISO 8601 format, as generated by `Date.toISOString`). */
|
|
2137
|
-
date: string;
|
|
2138
|
-
/** The time in milliseconds that it took to run the suite. */
|
|
2139
|
-
elapsed: number;
|
|
2140
|
-
/** The check summary. */
|
|
2141
|
-
checkSummary: CheckSummary;
|
|
2142
|
-
/** The comparison summary (only defined if comparisons were enabled). */
|
|
2143
|
-
comparisonSummary?: ComparisonSummary;
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
type CancelRunSuite = () => void;
|
|
2147
|
-
interface RunSuiteCallbacks {
|
|
2148
|
-
onProgress?: (pct: number) => void;
|
|
2149
|
-
onComplete?: (suiteReport: SuiteReport) => void;
|
|
2150
|
-
onError?: (error: Error) => void;
|
|
2151
|
-
}
|
|
2152
|
-
interface RunSuiteOptions {
|
|
2153
|
-
/**
|
|
2154
|
-
* The check tests to skip. Note that checks are matched by group and name
|
|
2155
|
-
* (case insensitive).
|
|
2156
|
-
*/
|
|
2157
|
-
skipChecks?: CheckNameSpec[];
|
|
2158
|
-
/**
|
|
2159
|
-
* The comparison scenarios to skip. Note that scenarios are matched by
|
|
2160
|
-
* title and subtitle (case insensitive).
|
|
2161
|
-
*/
|
|
2162
|
-
skipComparisonScenarios?: ComparisonScenarioTitleSpec[];
|
|
2163
|
-
}
|
|
2164
|
-
/**
|
|
2165
|
-
* Run the full suite of checks and comparisons defined in the given configuration.
|
|
2166
|
-
*
|
|
2167
|
-
* @param config The test suite configuration.
|
|
2168
|
-
* @param callbacks The callbacks that will be notified.
|
|
2169
|
-
* @param options Options to control how the tests are run.
|
|
2170
|
-
* @return A function that will cancel the process when invoked.
|
|
2171
|
-
*/
|
|
2172
|
-
declare function runSuite(config: Config, callbacks: RunSuiteCallbacks, options?: RunSuiteOptions): CancelRunSuite;
|
|
2173
|
-
|
|
2174
|
-
/**
|
|
2175
|
-
* Convert a full `SuiteReport` to a simplified `SuiteSummary` that only includes
|
|
2176
|
-
* failed/errored checks or comparisons with differences.
|
|
2177
|
-
*
|
|
2178
|
-
* @param suiteReport The full suite report.
|
|
2179
|
-
* @param elapsedMillis The time in milliseconds that it took to run the suite.
|
|
2180
|
-
* @return The converted suite summary.
|
|
2181
|
-
*/
|
|
2182
|
-
declare function suiteSummaryFromReport(suiteReport: SuiteReport, elapsedMillis: number): SuiteSummary;
|
|
2183
|
-
|
|
2184
|
-
export { type AllInputsSpec, type Bundle, type BundleGraphData, type BundleGraphDatasetSpec, type BundleGraphId, type BundleGraphSpec, type BundleGraphView, type BundleGraphViewOptions, type BundleModel, type CancelRunPerf, type CancelRunSuite, type CancelRunTrace as CancelTrace, type CheckConfig, CheckDataCoordinator, type CheckDataRef, type CheckDataRefKey, type CheckDataRequestKey, type CheckDataset, type CheckDatasetError, type CheckDatasetReport, type CheckGroupReport, type CheckKey, type CheckNameSpec, type CheckOptions, type CheckPredicateOp, type CheckPredicateOpConstantRef, type CheckPredicateOpDataRef, type CheckPredicateOpRef, type CheckPredicateReport, type CheckPredicateSummary, type CheckPredicateTimeOptions, type CheckPredicateTimeRange, type CheckPredicateTimeSingle, type CheckPredicateTimeSpec, type CheckReport, type CheckResult, type CheckResultErrorInfo, type CheckScenario, type CheckScenarioError, type CheckScenarioInputDesc, type CheckScenarioReport, type CheckStatus, type CheckSummary, type CheckTestReport, type ComparisonCategorizedResults, type ComparisonConfig, ComparisonDataCoordinator, type ComparisonDataRequestKey, type ComparisonDataset, type ComparisonDatasetName, type ComparisonDatasetOptions, type ComparisonDatasetSource, type ComparisonDatasetSpec, type ComparisonDatasets, type ComparisonGraphGroup, type ComparisonGraphGroupId, type ComparisonGraphGroupRefSpec, type ComparisonGraphGroupSpec, type ComparisonGraphId, type ComparisonGraphsArraySpec, type ComparisonGraphsPresetSpec, type ComparisonGroup, type ComparisonGroupKey, type ComparisonGroupKind, type ComparisonGroupRoot, type ComparisonGroupScores, type ComparisonGroupSummariesByCategory, type ComparisonGroupSummary, type ComparisonOptions, type ComparisonPlot, type ComparisonReport, type ComparisonReportDetailItem, type ComparisonReportDetailRow, type ComparisonReportOptions, type ComparisonReportSummaryRow, type ComparisonReportSummarySection, type ComparisonResolverError, type ComparisonResolverUnknownInputError, type ComparisonResolverUnknownInputSettingGroupError, type ComparisonResolverValueOutOfRangeWarning, type ComparisonResolverWarning, type ComparisonScenario, type ComparisonScenarioAllInputsSettings, type ComparisonScenarioGroup, type ComparisonScenarioGroupId, type ComparisonScenarioGroupRefSpec, type ComparisonScenarioGroupSpec, type ComparisonScenarioGroupTitle, type ComparisonScenarioId, type ComparisonScenarioInput, type ComparisonScenarioInputAtPositionSpec, type ComparisonScenarioInputAtValueSpec, type ComparisonScenarioInputName, type ComparisonScenarioInputPosition, type ComparisonScenarioInputSettings, type ComparisonScenarioInputSpec, type ComparisonScenarioInputState, type ComparisonScenarioKey, type ComparisonScenarioPresetMatrixSpec, type ComparisonScenarioRefSpec, type ComparisonScenarioSettings, type ComparisonScenarioSpec, type ComparisonScenarioSubtitle, type ComparisonScenarioTitle, type ComparisonScenarioTitleSpec, type ComparisonScenarioWithAllInputsSpec, type ComparisonScenarioWithDistinctInputsSpec, type ComparisonScenarioWithInputsSpec, type ComparisonScenarioWithSettingGroupSpec, type ComparisonScenarios, type ComparisonSortMode, type ComparisonSpecs, type ComparisonSpecsSource, type ComparisonSummary, type ComparisonTestReport, type ComparisonTestSummary, type ComparisonUnresolvedScenarioGroupRef, type ComparisonUnresolvedScenarioRef, type ComparisonUnresolvedView, type ComparisonView, type ComparisonViewBox, type ComparisonViewBoxSpec, type ComparisonViewGraphOrder, type ComparisonViewGraphsSpec, type ComparisonViewGroup, type ComparisonViewGroupSpec, type ComparisonViewGroupTitle, type ComparisonViewGroupWithScenariosSpec, type ComparisonViewGroupWithViewsSpec, type ComparisonViewItemSubtitle, type ComparisonViewItemTitle, type ComparisonViewRow, type ComparisonViewRowSpec, type ComparisonViewRowSubtitle, type ComparisonViewRowTitle, type ComparisonViewSpec, type ComparisonViewSubtitle, type ComparisonViewTitle, type Config, type ConfigInitOptions, type ConfigOptions, type ConstantOverride, type DataSource, type Dataset, type DatasetGroupName, type DatasetKey, type DatasetMap, type DatasetsResult, type DiffPoint, type DiffReport, type DiffValidity, type EncodedImplVars, type EncodedSubscript, type EncodedVarInstance, type EncodedVarType, type EncodedVariable, type GetDatasetsOptions, type GraphComparisonDatasetReport, type GraphComparisonMetadataReport, type GraphComparisonReport, type GraphInclusion, type ImplVar, type ImplVarGroup, type InputAliasName, type InputGroupName, type InputId, type InputPosition, type InputSetting, type InputSettingGroupId, type InputSettingsSpec, type InputVar, type LegendItem, type LinkItem, type LoadedBundle, type LookupOverride, type ModelSpec, type NamedBundle, type OutputVar, type PerfReport, PerfStats, type PositionSetting, type RelatedItem, type RunPerfCallbacks, type RunPerfOptions, type RunSuiteCallbacks, type RunSuiteOptions, type ScenarioSpec, type ScenarioSpecUid, type SliderInputVar, type SourceName, type SuiteReport, type SuiteSummary, type SwitchInputVar, type RunTraceCallbacks as TraceCallbacks, type TraceCompareToBundleOptions, type TraceCompareToExtDataOptions, type TraceDatasetReport, type TraceOptions, type TraceReport, type ValueSetting, type VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createCheckDataCoordinator, createCheckDataCoordinatorForTests, createComparisonDataCoordinator, createConfig, datasetMessage, decodeImplVars, diffDatasets, diffGraphs, encodeImplVars, getScoresForTestSummaries, predicateMessage, runPerf, runSuite, runTrace, scenarioMessage, suiteSummaryFromReport, testSummaryFromReport };
|