@sdeverywhere/check-core 0.1.5 → 0.1.7
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.cjs +1104 -442
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +536 -108
- package/dist/index.d.ts +536 -108
- package/dist/index.js +1092 -437
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -109,26 +109,6 @@ interface OutputVar {
|
|
|
109
109
|
/** The metadata for the related visuals/graphs in which this variable is used. */
|
|
110
110
|
relatedItems?: RelatedItem[];
|
|
111
111
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Holds information about a subscript used in the model.
|
|
114
|
-
*/
|
|
115
|
-
interface Subscript {
|
|
116
|
-
/** The subscript identifier, as used in SDE. */
|
|
117
|
-
id: string;
|
|
118
|
-
/** The subscript name, as used in Vensim. */
|
|
119
|
-
name: string;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Holds information about a dimension (subscript family) used in the model.
|
|
123
|
-
*/
|
|
124
|
-
interface Dimension {
|
|
125
|
-
/** The dimension identifier, as used in SDE. */
|
|
126
|
-
id: string;
|
|
127
|
-
/** The dimension name, as used in Vensim. */
|
|
128
|
-
name: string;
|
|
129
|
-
/** The set of subscripts in this dimension. */
|
|
130
|
-
subscripts: Subscript[];
|
|
131
|
-
}
|
|
132
112
|
/**
|
|
133
113
|
* Holds information about a variable used in the model implementation.
|
|
134
114
|
*/
|
|
@@ -137,12 +117,12 @@ interface ImplVar {
|
|
|
137
117
|
varId: VarId;
|
|
138
118
|
/** The variable name, as used in the modeling tool. */
|
|
139
119
|
varName: string;
|
|
140
|
-
/** The variable index, used by SDE to reference the value in the generated model. */
|
|
141
|
-
varIndex: number;
|
|
142
|
-
/** The set of dimensions for this variable. */
|
|
143
|
-
dimensions: Dimension[];
|
|
144
120
|
/** The variable type (e.g. 'level', 'const'). */
|
|
145
121
|
varType: string;
|
|
122
|
+
/** The variable index, used to reference the value in the generated model. */
|
|
123
|
+
varIndex: number;
|
|
124
|
+
/** The subscript index values, used to reference the value in the generated model. */
|
|
125
|
+
subscriptIndices?: number[];
|
|
146
126
|
}
|
|
147
127
|
|
|
148
128
|
/** The human-readable name for a group of inputs. */
|
|
@@ -151,8 +131,27 @@ type InputGroupName = string;
|
|
|
151
131
|
type InputAliasName = string;
|
|
152
132
|
/** The name for a custom input setting group. */
|
|
153
133
|
type InputSettingGroupId = string;
|
|
154
|
-
/** The human-readable name for a group of
|
|
134
|
+
/** The human-readable name for a group of datasets. */
|
|
155
135
|
type DatasetGroupName = string;
|
|
136
|
+
/**
|
|
137
|
+
* Describes a group of implementation variables.
|
|
138
|
+
*/
|
|
139
|
+
interface ImplVarGroup {
|
|
140
|
+
/** The group title. */
|
|
141
|
+
title: string;
|
|
142
|
+
/**
|
|
143
|
+
* The function name in the generated model that is associated with
|
|
144
|
+
* this group. This can be used when displaying the group to change
|
|
145
|
+
* the appearance of the items in the section.
|
|
146
|
+
*/
|
|
147
|
+
fn?: string;
|
|
148
|
+
/**
|
|
149
|
+
* The keys of the variables in this group (corresponding to the
|
|
150
|
+
* `implVars` map keys). It is recommended to provide these in the
|
|
151
|
+
* order that the variables are evaluated in the generated model.
|
|
152
|
+
*/
|
|
153
|
+
datasetKeys: DatasetKey[];
|
|
154
|
+
}
|
|
156
155
|
/**
|
|
157
156
|
* Includes the properties needed to display a legend item in the UI.
|
|
158
157
|
*/
|
|
@@ -205,10 +204,28 @@ interface BundleGraphSpec {
|
|
|
205
204
|
/** Metadata for the graph that can be used to diff to another graph. */
|
|
206
205
|
metadata: Map<string, string>;
|
|
207
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Options for configuring a bundle-specific graph view.
|
|
209
|
+
*/
|
|
210
|
+
interface BundleGraphViewOptions {
|
|
211
|
+
/** Whether graph updates will be animated (default is false). */
|
|
212
|
+
animated?: boolean;
|
|
213
|
+
/** A hint that indicates the context in which the graph will be displayed. */
|
|
214
|
+
style?: 'thumbnail' | undefined;
|
|
215
|
+
}
|
|
208
216
|
/**
|
|
209
217
|
* Allows for displaying a bundle-specific graph.
|
|
210
218
|
*/
|
|
211
219
|
interface BundleGraphView {
|
|
220
|
+
/**
|
|
221
|
+
* Update the data that is displayed in the graph.
|
|
222
|
+
*
|
|
223
|
+
* @hidden This method is optional; it is not currently used by the report UI, but may be useful
|
|
224
|
+
* for other tools that want to display bundle-specific graphs.
|
|
225
|
+
*
|
|
226
|
+
* @param datasetMap The map of datasets that contain the data to be displayed in the graph.
|
|
227
|
+
*/
|
|
228
|
+
updateData?(datasetMap: DatasetMap): void;
|
|
212
229
|
/** Destroy the underlying graph view and any associated resources. */
|
|
213
230
|
destroy(): void;
|
|
214
231
|
}
|
|
@@ -216,8 +233,15 @@ interface BundleGraphView {
|
|
|
216
233
|
* Wrapper around data that can be used to initialize a graph view.
|
|
217
234
|
*/
|
|
218
235
|
interface BundleGraphData {
|
|
219
|
-
/**
|
|
220
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Return a graph view that can be attached to the given parent element. The returned
|
|
238
|
+
* `BundleGraphView` instance will already be configured to display the data that was
|
|
239
|
+
* fetched from the model for the associated scenario.
|
|
240
|
+
*
|
|
241
|
+
* @param parent The parent element to which the graph view will be attached.
|
|
242
|
+
* @returns A `BundleGraphView` instance.
|
|
243
|
+
*/
|
|
244
|
+
createGraphView(parent: HTMLElement): BundleGraphView;
|
|
221
245
|
}
|
|
222
246
|
/**
|
|
223
247
|
* Describes the model that is contained in this bundle.
|
|
@@ -233,6 +257,8 @@ interface ModelSpec {
|
|
|
233
257
|
outputVars: Map<DatasetKey, OutputVar>;
|
|
234
258
|
/** The map of all variables (both internal and exported) in this version of the model. */
|
|
235
259
|
implVars: Map<DatasetKey, ImplVar>;
|
|
260
|
+
/** The groupings of internal/implementation variables in this version of the model. */
|
|
261
|
+
implVarGroups?: ImplVarGroup[];
|
|
236
262
|
/** The custom input variable aliases defined for this model. */
|
|
237
263
|
inputAliases?: Map<InputAliasName, VarId>;
|
|
238
264
|
/** The custom input variable groups defined for this model. */
|
|
@@ -258,10 +284,47 @@ interface BundleModel extends DataSource {
|
|
|
258
284
|
/**
|
|
259
285
|
* Load the data used to display the graph by running the model with inputs
|
|
260
286
|
* configured for the given scenario.
|
|
287
|
+
*
|
|
288
|
+
* The returned `BundleGraphData` instance will contain the data associated with the
|
|
289
|
+
* given graph. Calling the `createGraphView` method on the `BundleGraphData` instance
|
|
290
|
+
* will create a `BundleGraphView` that is already configured to display the data
|
|
291
|
+
* associated with the graph.
|
|
292
|
+
*
|
|
293
|
+
* This method is optional; if not implemented, custom graphs will not be displayed in
|
|
294
|
+
* the report UI.
|
|
295
|
+
*
|
|
296
|
+
* @param scenarioSpec The scenario spec that defines the inputs for the model run.
|
|
297
|
+
* @param graphId The identifier of the graph for which data will be loaded.
|
|
298
|
+
* @returns The graph data.
|
|
299
|
+
*/
|
|
300
|
+
getGraphDataForScenario?(scenarioSpec: ScenarioSpec, graphId: BundleGraphId): Promise<BundleGraphData>;
|
|
301
|
+
/**
|
|
302
|
+
* Return the links to be displayed for the graph in the given scenario.
|
|
303
|
+
*
|
|
304
|
+
* This method is optional; if not implemented, no graph links will be displayed in the report UI.
|
|
305
|
+
*
|
|
306
|
+
* @param scenarioSpec The scenario spec that defines the inputs for the model run.
|
|
307
|
+
* @param graphId The identifier of the graph for which links will be prepared.
|
|
308
|
+
* @returns An array of `LinkItem` instances.
|
|
261
309
|
*/
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
|
|
310
|
+
getGraphLinksForScenario?(scenarioSpec: ScenarioSpec, graphId: BundleGraphId): LinkItem[];
|
|
311
|
+
/**
|
|
312
|
+
* Return a graph view that is attached to the given element and that is prepared to display data
|
|
313
|
+
* for the given graph.
|
|
314
|
+
*
|
|
315
|
+
* Unlike `getGraphDataForScenario`, this method only creates the graph view. The data for the
|
|
316
|
+
* graph must be provided separately by calling the `updateData` method on the `BundleGraphView`
|
|
317
|
+
* instance.
|
|
318
|
+
*
|
|
319
|
+
* @hidden This method is optional; it is not currently used by the report UI, but may be useful
|
|
320
|
+
* for other tools that want to display bundle-specific graphs.
|
|
321
|
+
*
|
|
322
|
+
* @param parent The parent element to which the graph view will be attached.
|
|
323
|
+
* @param graphId The identifier of the graph for which the graph view will be prepared.
|
|
324
|
+
* @param options Optional configuration for the graph view.
|
|
325
|
+
* @returns A `BundleGraphView` instance.
|
|
326
|
+
*/
|
|
327
|
+
createGraphView?(parent: HTMLElement, graphId: BundleGraphId, options?: BundleGraphViewOptions): BundleGraphView;
|
|
265
328
|
}
|
|
266
329
|
/**
|
|
267
330
|
* Provides access to the model that is contained in this bundle for use in
|
|
@@ -289,15 +352,204 @@ interface NamedBundle {
|
|
|
289
352
|
bundle: Bundle;
|
|
290
353
|
}
|
|
291
354
|
/**
|
|
292
|
-
* Represents a bundle that has had its model initialized.
|
|
355
|
+
* Represents a bundle that has had its model instances initialized.
|
|
293
356
|
*/
|
|
294
357
|
interface LoadedBundle {
|
|
295
358
|
/** The name of the bundle, for example, "Current" or "Baseline". */
|
|
296
359
|
name: string;
|
|
297
360
|
/** The version of the bundle. */
|
|
298
361
|
version: number;
|
|
299
|
-
/** The
|
|
300
|
-
|
|
362
|
+
/** The spec for the bundled model. */
|
|
363
|
+
modelSpec: ModelSpec;
|
|
364
|
+
/**
|
|
365
|
+
* The initialized model instances for this bundle. If `concurrency` was specified
|
|
366
|
+
* in the config, then there will be that number of model instances in this array,
|
|
367
|
+
* otherwise there will be one instance.
|
|
368
|
+
*/
|
|
369
|
+
models: BundleModel[];
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* A terse representation of a subscript.
|
|
374
|
+
*/
|
|
375
|
+
interface EncodedSubscript {
|
|
376
|
+
/** The subscript name (e.g., "Sub1"). */
|
|
377
|
+
n: string;
|
|
378
|
+
/** The subscript identifier (e.g., "_sub1"). */
|
|
379
|
+
i: string;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* A terse representation of a variable without subscripts.
|
|
383
|
+
*/
|
|
384
|
+
interface EncodedVariable {
|
|
385
|
+
/** The variable name (corresponds to the base part of `ImplVar.varName` without subscripts). */
|
|
386
|
+
n: string;
|
|
387
|
+
/** The variable identifier (corresponds to the base part of `ImplVar.varId` without subscripts). */
|
|
388
|
+
i: string;
|
|
389
|
+
/** The variable index (corresponds to `ImplVar.varIndex`). */
|
|
390
|
+
x: number;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* A terse representation of a variable type.
|
|
394
|
+
*/
|
|
395
|
+
type EncodedVarType = string;
|
|
396
|
+
/**
|
|
397
|
+
* A terse representation of a variable instance as a flat array.
|
|
398
|
+
*
|
|
399
|
+
* Format: [t, v, si0, si1, ..., sx0, sx1, ...]
|
|
400
|
+
* - Element 0: The index of the associated `EncodedVarType` element in the `varTypes` array (corresponds to `ImplVar.varType`).
|
|
401
|
+
* - Element 1: The index of the associated `EncodedVariable` element in the `variables` array.
|
|
402
|
+
* - Elements 2+: If subscripts are present, first all subscript element indices, then all subscript indices:
|
|
403
|
+
* - Elements 2 to (2 + n - 1): The indices of the associated `EncodedSubscript` elements in the `subscripts` array.
|
|
404
|
+
* - Elements (2 + n) to (2 + 2n - 1): The subscript index values (corresponds to `ImplVar.subscriptIndices`).
|
|
405
|
+
*/
|
|
406
|
+
type EncodedVarInstance = number[];
|
|
407
|
+
/**
|
|
408
|
+
* The encoded representation of impl variables that eliminates redundancy.
|
|
409
|
+
*/
|
|
410
|
+
interface EncodedImplVars {
|
|
411
|
+
subscripts: EncodedSubscript[];
|
|
412
|
+
variables: EncodedVariable[];
|
|
413
|
+
varTypes: EncodedVarType[];
|
|
414
|
+
varInstances: {
|
|
415
|
+
[key: string]: EncodedVarInstance[];
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Encode impl variable metadata into a more efficient format.
|
|
420
|
+
*
|
|
421
|
+
* This is used to reduce the size of a bundle by eliminating redundancy in variable/subscript
|
|
422
|
+
* names and identifiers. The `varInstances` object in the model listing JSON generated by the
|
|
423
|
+
* compiler includes verbose information for each variable instance. This function puts that
|
|
424
|
+
* information into a more efficient format that can be bundled as a normal JavaScript object
|
|
425
|
+
* in the model-check bundle file, and then decoded and expandedwhen the bundle is loaded.
|
|
426
|
+
*
|
|
427
|
+
* @param input The input structure mapping keys to ImplVar arrays.
|
|
428
|
+
* @returns The encoded representation.
|
|
429
|
+
*/
|
|
430
|
+
declare function encodeImplVars(input: {
|
|
431
|
+
[key: string]: ImplVar[];
|
|
432
|
+
}): EncodedImplVars;
|
|
433
|
+
/**
|
|
434
|
+
* Decode impl variables from the efficient format back to the original structure.
|
|
435
|
+
*
|
|
436
|
+
* @param encoded The encoded representation.
|
|
437
|
+
* @returns The original structure mapping keys to `ImplVar` arrays.
|
|
438
|
+
*/
|
|
439
|
+
declare function decodeImplVars(encoded: EncodedImplVars): {
|
|
440
|
+
[key: string]: ImplVar[];
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
interface CheckOptions {
|
|
444
|
+
/** The strings containing check tests in YAML format. */
|
|
445
|
+
tests: string[];
|
|
446
|
+
}
|
|
447
|
+
interface CheckConfig {
|
|
448
|
+
/** The loaded bundle being checked. */
|
|
449
|
+
bundle: LoadedBundle;
|
|
450
|
+
/** The strings containing check tests in YAML format. */
|
|
451
|
+
tests: string[];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
type TaskKey = string;
|
|
455
|
+
type TaskExecutorKey = string;
|
|
456
|
+
interface BundleModels {
|
|
457
|
+
L?: BundleModel;
|
|
458
|
+
R: BundleModel;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Base interface for all tasks in the unified system.
|
|
462
|
+
*/
|
|
463
|
+
interface Task {
|
|
464
|
+
/** Unique key for this task instance. */
|
|
465
|
+
key: TaskKey;
|
|
466
|
+
/** The task kind. */
|
|
467
|
+
kind: string;
|
|
468
|
+
/** Process the task using the given models. */
|
|
469
|
+
process(models: BundleModels): Promise<void>;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Executes a single task using a set of `BundleModel` instances.
|
|
473
|
+
*/
|
|
474
|
+
interface TaskExecutor {
|
|
475
|
+
/**
|
|
476
|
+
* Execute the given task using the set of `BundleModel` instances
|
|
477
|
+
* associated with this executor.
|
|
478
|
+
*
|
|
479
|
+
* @param task The task to execute.
|
|
480
|
+
* @return A promise that resolves when the task is complete.
|
|
481
|
+
*/
|
|
482
|
+
execute(task: Task): Promise<void>;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* A unified task queue that can process multiple kinds of tasks concurrently
|
|
486
|
+
* while ensuring that BundleModel instances are never accessed concurrently.
|
|
487
|
+
* This replaces the need for multiple separate TaskQueue instances.
|
|
488
|
+
*/
|
|
489
|
+
declare class TaskQueue {
|
|
490
|
+
private readonly executors;
|
|
491
|
+
/** The single instance. */
|
|
492
|
+
private static instance;
|
|
493
|
+
/** The queue of task keys, most recent at front. */
|
|
494
|
+
private readonly taskKeyQueue;
|
|
495
|
+
/** The map of tasks. */
|
|
496
|
+
private readonly taskMap;
|
|
497
|
+
/** The idle event listeners. */
|
|
498
|
+
private readonly idleListeners;
|
|
499
|
+
/** Whether tasks are being processed. */
|
|
500
|
+
private processing;
|
|
501
|
+
/** Whether `shutdown` has been called. */
|
|
502
|
+
private stopped;
|
|
503
|
+
/**
|
|
504
|
+
* @param executors The map of available task executors.
|
|
505
|
+
*/
|
|
506
|
+
constructor(executors: Map<TaskExecutorKey, TaskExecutor>);
|
|
507
|
+
/**
|
|
508
|
+
* Initialize the shared `TaskQueue` instance.
|
|
509
|
+
*
|
|
510
|
+
* @param executors The map of available task executors.
|
|
511
|
+
*/
|
|
512
|
+
static initialize(executors: Map<TaskExecutorKey, TaskExecutor>): void;
|
|
513
|
+
/**
|
|
514
|
+
* Get the shared `TaskQueue` instance.
|
|
515
|
+
*/
|
|
516
|
+
static getInstance(): TaskQueue;
|
|
517
|
+
/**
|
|
518
|
+
* Add a task to the queue.
|
|
519
|
+
*
|
|
520
|
+
* @param task The task to add.
|
|
521
|
+
*/
|
|
522
|
+
addTask(task: Task): void;
|
|
523
|
+
/**
|
|
524
|
+
* Cancel a task.
|
|
525
|
+
*
|
|
526
|
+
* @param taskKey The key of the task to cancel.
|
|
527
|
+
*/
|
|
528
|
+
cancelTask(taskKey: TaskKey): void;
|
|
529
|
+
/**
|
|
530
|
+
* Add an idle listener.
|
|
531
|
+
*
|
|
532
|
+
* @param listener The listener to add.
|
|
533
|
+
*/
|
|
534
|
+
onIdle(listener: (error?: Error) => void): void;
|
|
535
|
+
/**
|
|
536
|
+
* Remove an idle listener.
|
|
537
|
+
*
|
|
538
|
+
* @param listener The listener to remove.
|
|
539
|
+
*/
|
|
540
|
+
removeIdleListener(listener: (error?: Error) => void): void;
|
|
541
|
+
/**
|
|
542
|
+
* Notify the idle listeners.
|
|
543
|
+
*
|
|
544
|
+
* @param error The error to notify the listeners with.
|
|
545
|
+
*/
|
|
546
|
+
private notifyIdle;
|
|
547
|
+
/**
|
|
548
|
+
* Shutdown the task queue, cancelling all pending tasks.
|
|
549
|
+
*/
|
|
550
|
+
shutdown(): void;
|
|
551
|
+
private processTasksIfNeeded;
|
|
552
|
+
private processNextTasks;
|
|
301
553
|
}
|
|
302
554
|
|
|
303
555
|
type CheckDataRequestKey = string;
|
|
@@ -306,15 +558,27 @@ type CheckDataRequestKey = string;
|
|
|
306
558
|
* of a check/predicate.
|
|
307
559
|
*/
|
|
308
560
|
declare class CheckDataCoordinator {
|
|
309
|
-
readonly bundleModel: BundleModel;
|
|
310
561
|
private readonly taskQueue;
|
|
311
|
-
constructor(
|
|
562
|
+
constructor(taskQueue: TaskQueue);
|
|
312
563
|
requestDataset(requestKey: CheckDataRequestKey, scenarioSpec: ScenarioSpec, datasetKey: DatasetKey, onResponse: (dataset: Dataset) => void): void;
|
|
313
564
|
cancelRequest(key: CheckDataRequestKey): void;
|
|
314
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Create a `CheckDataCoordinator` instance using the shared task queue.
|
|
568
|
+
*/
|
|
569
|
+
declare function createCheckDataCoordinator(): CheckDataCoordinator;
|
|
570
|
+
/**
|
|
571
|
+
* @hidden This is not part of the public API; it is exposed only for use in tests.
|
|
572
|
+
*/
|
|
573
|
+
declare function createCheckDataCoordinatorForTests(bundleModel: BundleModel): CheckDataCoordinator;
|
|
315
574
|
|
|
316
|
-
type
|
|
317
|
-
|
|
575
|
+
/** Spec type that allows for matching a check by group and test name. */
|
|
576
|
+
interface CheckNameSpec {
|
|
577
|
+
/** The name of a check group. */
|
|
578
|
+
groupName: string;
|
|
579
|
+
/** The name of a check test. */
|
|
580
|
+
testName: string;
|
|
581
|
+
}
|
|
318
582
|
type CheckPredicateTimeSingle = number;
|
|
319
583
|
type CheckPredicateTimeRange = [number, number];
|
|
320
584
|
interface CheckPredicateTimeOptions {
|
|
@@ -325,20 +589,6 @@ interface CheckPredicateTimeOptions {
|
|
|
325
589
|
}
|
|
326
590
|
type CheckPredicateTimeSpec = CheckPredicateTimeSingle | CheckPredicateTimeRange | CheckPredicateTimeOptions;
|
|
327
591
|
|
|
328
|
-
interface CheckResultErrorInfo {
|
|
329
|
-
kind: 'unknown-dataset' | 'unknown-input' | 'unknown-input-group' | 'empty-input-group';
|
|
330
|
-
name: string;
|
|
331
|
-
}
|
|
332
|
-
interface CheckResult {
|
|
333
|
-
status: 'passed' | 'failed' | 'error';
|
|
334
|
-
message?: string;
|
|
335
|
-
failValue?: number;
|
|
336
|
-
failOp?: CheckPredicateOp;
|
|
337
|
-
failRefValue?: number;
|
|
338
|
-
failTime?: number;
|
|
339
|
-
errorInfo?: CheckResultErrorInfo;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
592
|
type CheckDatasetError = 'no-matches-for-dataset' | 'no-matches-for-group' | 'no-matches-for-type';
|
|
343
593
|
interface CheckDataset {
|
|
344
594
|
/** The key for the matched dataset; can be undefined if no dataset matched. */
|
|
@@ -392,9 +642,25 @@ interface CheckDataRef {
|
|
|
392
642
|
dataset: CheckDataset;
|
|
393
643
|
}
|
|
394
644
|
|
|
645
|
+
type CheckPredicateOp = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'approx';
|
|
646
|
+
|
|
647
|
+
interface CheckResultErrorInfo {
|
|
648
|
+
kind: 'unknown-dataset' | 'unknown-input' | 'unknown-input-group' | 'empty-input-group';
|
|
649
|
+
name: string;
|
|
650
|
+
}
|
|
651
|
+
interface CheckResult {
|
|
652
|
+
status: 'passed' | 'failed' | 'error' | 'skipped';
|
|
653
|
+
message?: string;
|
|
654
|
+
failValue?: number;
|
|
655
|
+
failOp?: CheckPredicateOp;
|
|
656
|
+
failRefValue?: number;
|
|
657
|
+
failTime?: number;
|
|
658
|
+
errorInfo?: CheckResultErrorInfo;
|
|
659
|
+
}
|
|
660
|
+
|
|
395
661
|
type CheckKey = number;
|
|
396
662
|
|
|
397
|
-
type CheckStatus = 'passed' | 'failed' | 'error';
|
|
663
|
+
type CheckStatus = 'passed' | 'failed' | 'error' | 'skipped';
|
|
398
664
|
interface CheckPredicateOpConstantRef {
|
|
399
665
|
kind: 'constant';
|
|
400
666
|
value: number;
|
|
@@ -457,17 +723,6 @@ declare function datasetMessage(dataset: CheckDatasetReport, bold: StyleFunc): s
|
|
|
457
723
|
*/
|
|
458
724
|
declare function predicateMessage(predicate: CheckPredicateReport, bold: StyleFunc): string;
|
|
459
725
|
|
|
460
|
-
interface CheckOptions {
|
|
461
|
-
/** The strings containing check tests in YAML format. */
|
|
462
|
-
tests: string[];
|
|
463
|
-
}
|
|
464
|
-
interface CheckConfig {
|
|
465
|
-
/** The loaded bundle being checked. */
|
|
466
|
-
bundle: LoadedBundle;
|
|
467
|
-
/** The strings containing check tests in YAML format. */
|
|
468
|
-
tests: string[];
|
|
469
|
-
}
|
|
470
|
-
|
|
471
726
|
/**
|
|
472
727
|
* A simplified/terse version of `CheckPredicateReport` that matches the
|
|
473
728
|
* format of the JSON objects emitted by the CLI in terse mode.
|
|
@@ -479,15 +734,15 @@ interface CheckPredicateSummary {
|
|
|
479
734
|
/**
|
|
480
735
|
* A simplified/terse version of `CheckReport` that matches the
|
|
481
736
|
* format of the JSON objects emitted by the CLI in terse mode.
|
|
482
|
-
* This
|
|
483
|
-
* of 'failed' or '
|
|
737
|
+
* This contains predicate summaries for checks that have a status
|
|
738
|
+
* of 'failed', 'error', or 'skipped'.
|
|
484
739
|
*/
|
|
485
740
|
interface CheckSummary {
|
|
486
741
|
predicateSummaries: CheckPredicateSummary[];
|
|
487
742
|
}
|
|
488
743
|
/**
|
|
489
|
-
* Convert a full `CheckReport` to a simplified `CheckSummary` that
|
|
490
|
-
* failed
|
|
744
|
+
* Convert a full `CheckReport` to a simplified `CheckSummary` that includes
|
|
745
|
+
* failed, errored, and skipped checks.
|
|
491
746
|
*
|
|
492
747
|
* @param checkReport The full check report.
|
|
493
748
|
* @return The converted check summary.
|
|
@@ -499,9 +754,10 @@ declare function checkSummaryFromReport(checkReport: CheckReport): CheckSummary;
|
|
|
499
754
|
*
|
|
500
755
|
* @param checkConfig The config used to reconstruct the check test structure.
|
|
501
756
|
* @param checkSummary The simplified check summary.
|
|
757
|
+
* @param skipChecks The checks that were skipped when the original report was created.
|
|
502
758
|
* @return The converted check report.
|
|
503
759
|
*/
|
|
504
|
-
declare function checkReportFromSummary(checkConfig: CheckConfig, checkSummary: CheckSummary): CheckReport | undefined;
|
|
760
|
+
declare function checkReportFromSummary(checkConfig: CheckConfig, checkSummary: CheckSummary, skipChecks?: CheckNameSpec[]): CheckReport | undefined;
|
|
505
761
|
|
|
506
762
|
type ComparisonDatasetName = string;
|
|
507
763
|
type ComparisonDatasetSource = string;
|
|
@@ -633,6 +889,13 @@ interface ComparisonScenarioRefSpec {
|
|
|
633
889
|
/** The optional subtitle that is used instead of the referenced scenario's subtitle. */
|
|
634
890
|
subtitle?: ComparisonScenarioSubtitle;
|
|
635
891
|
}
|
|
892
|
+
/** Spec type that allows for matching a comparison scenario by title and subtitle. */
|
|
893
|
+
interface ComparisonScenarioTitleSpec {
|
|
894
|
+
/** The title of a comparison scenario. */
|
|
895
|
+
title: string;
|
|
896
|
+
/** The subtitle of a comparison scenario. */
|
|
897
|
+
subtitle?: string;
|
|
898
|
+
}
|
|
636
899
|
type ComparisonScenarioGroupId = string;
|
|
637
900
|
type ComparisonScenarioGroupTitle = string;
|
|
638
901
|
/**
|
|
@@ -1034,9 +1297,17 @@ declare function diffDatasets(datasetL: Dataset | undefined, datasetR: Dataset |
|
|
|
1034
1297
|
* a `ComparisonTestSummary` only includes the `maxDiff` value.
|
|
1035
1298
|
*/
|
|
1036
1299
|
interface ComparisonTestReport {
|
|
1300
|
+
/** The key of the scenario that was compared. */
|
|
1037
1301
|
scenarioKey: ComparisonScenarioKey;
|
|
1302
|
+
/** The key of the dataset that was compared. */
|
|
1038
1303
|
datasetKey: DatasetKey;
|
|
1039
|
-
|
|
1304
|
+
/** The diff report for the comparison, or undefined if the test was skipped. */
|
|
1305
|
+
diffReport?: DiffReport;
|
|
1306
|
+
/**
|
|
1307
|
+
* The diff report for the baseline scenario (all inputs at default), or undefined if this
|
|
1308
|
+
* report is for the baseline scenario itself.
|
|
1309
|
+
*/
|
|
1310
|
+
baselineDiffReport?: DiffReport;
|
|
1040
1311
|
}
|
|
1041
1312
|
/**
|
|
1042
1313
|
* A simplified/terse version of `ComparisonTestReport` that is used when writing
|
|
@@ -1050,7 +1321,13 @@ interface ComparisonTestSummary {
|
|
|
1050
1321
|
/** Short for `datasetKey`. */
|
|
1051
1322
|
d: DatasetKey;
|
|
1052
1323
|
/** Short for `maxDiff`. */
|
|
1053
|
-
md
|
|
1324
|
+
md?: number;
|
|
1325
|
+
/** Short for `avgDiff`. */
|
|
1326
|
+
ad?: number;
|
|
1327
|
+
/** Short for `maxDiff` relative to baseline `maxDiff`. */
|
|
1328
|
+
mdb?: number;
|
|
1329
|
+
/** Short for `avgDiff` relative to baseline `avgDiff`. */
|
|
1330
|
+
adb?: number;
|
|
1054
1331
|
}
|
|
1055
1332
|
/**
|
|
1056
1333
|
* The roll-up report that contains the results of all individual comparison tests.
|
|
@@ -1100,8 +1377,8 @@ type ComparisonGroupRoot = ComparisonDataset | ComparisonScenario;
|
|
|
1100
1377
|
interface ComparisonGroupScores {
|
|
1101
1378
|
/** The total number of comparisons (sample size) for this group. */
|
|
1102
1379
|
totalDiffCount: number;
|
|
1103
|
-
/** The sum of the `maxDiff`
|
|
1104
|
-
|
|
1380
|
+
/** The sum of the diff values for the active sort mode (e.g., `maxDiff`, `avgDiff`) for each threshold bucket. */
|
|
1381
|
+
totalDiffByBucket: number[];
|
|
1105
1382
|
/** The number of comparisons that fall into each threshold bucket. */
|
|
1106
1383
|
diffCountByBucket: number[];
|
|
1107
1384
|
/** The percentage of comparisons that fall into each threshold bucket. */
|
|
@@ -1142,12 +1419,13 @@ interface ComparisonGroupSummariesByCategory {
|
|
|
1142
1419
|
*/
|
|
1143
1420
|
onlyInRight: ComparisonGroupSummary[];
|
|
1144
1421
|
/**
|
|
1145
|
-
* Groups with one or more comparisons that have non-zero
|
|
1146
|
-
* will be sorted by
|
|
1422
|
+
* Groups with one or more comparisons that have non-zero diff scores; the groups
|
|
1423
|
+
* will be sorted by the diff score according to the active sort mode, with higher
|
|
1424
|
+
* scores at the front of the array.
|
|
1147
1425
|
*/
|
|
1148
1426
|
withDiffs: ComparisonGroupSummary[];
|
|
1149
1427
|
/**
|
|
1150
|
-
* Groups where all comparisons have
|
|
1428
|
+
* Groups where all comparisons have diff scores of zero (no differences between
|
|
1151
1429
|
* "left" and "right").
|
|
1152
1430
|
*/
|
|
1153
1431
|
withoutDiffs: ComparisonGroupSummary[];
|
|
@@ -1282,6 +1560,15 @@ interface ComparisonReportSummarySection {
|
|
|
1282
1560
|
* it will be initially collapsed.
|
|
1283
1561
|
*/
|
|
1284
1562
|
initialState?: 'collapsed' | 'expanded' | 'expanded-if-diffs';
|
|
1563
|
+
/**
|
|
1564
|
+
* Whether the items in the section are stable, i.e., not changing from run to run. If
|
|
1565
|
+
* undefined, defaults to false. This can be used to group items in the filter panel.
|
|
1566
|
+
* Set it to true if the group contains a stable set of rows where the order does not
|
|
1567
|
+
* change between runs. Set it to false (or leave it undefined) if the group contains
|
|
1568
|
+
* rows that have a different order between runs (for example, "Scenarios producing
|
|
1569
|
+
* differences").
|
|
1570
|
+
*/
|
|
1571
|
+
stable?: boolean;
|
|
1285
1572
|
}
|
|
1286
1573
|
/**
|
|
1287
1574
|
* Describes an item (box) in the comparison report detail view.
|
|
@@ -1347,10 +1634,15 @@ interface ComparisonOptions {
|
|
|
1347
1634
|
/** The left-side ("baseline") bundle being compared. */
|
|
1348
1635
|
baseline: NamedBundle;
|
|
1349
1636
|
/**
|
|
1350
|
-
* The array of thresholds used to color differences
|
|
1351
|
-
* buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
|
|
1637
|
+
* The array of thresholds used to color differences. Defaults to [1, 5, 10]
|
|
1638
|
+
* which will use buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
|
|
1352
1639
|
*/
|
|
1353
|
-
thresholds
|
|
1640
|
+
thresholds?: number[];
|
|
1641
|
+
/**
|
|
1642
|
+
* The array of ratio thresholds used to color differences when relative sorting is
|
|
1643
|
+
* active. Defaults to [1, 2, 3] which will use buckets of 0, 0-1, 1-2, 2-3, and >3.
|
|
1644
|
+
*/
|
|
1645
|
+
ratioThresholds?: number[];
|
|
1354
1646
|
/**
|
|
1355
1647
|
* The requested comparison scenario and view specifications. These can be
|
|
1356
1648
|
* specified in YAML or JSON files, or using `Spec` objects.
|
|
@@ -1367,10 +1659,15 @@ interface ComparisonConfig {
|
|
|
1367
1659
|
/** The loaded right-side ("current") bundle being compared. */
|
|
1368
1660
|
bundleR: LoadedBundle;
|
|
1369
1661
|
/**
|
|
1370
|
-
* The array of thresholds used to color differences,
|
|
1662
|
+
* The array of thresholds used to color differences. For example, [1, 5, 10] will use
|
|
1371
1663
|
* buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
|
|
1372
1664
|
*/
|
|
1373
1665
|
thresholds: number[];
|
|
1666
|
+
/**
|
|
1667
|
+
* The array of ratio thresholds used to color differences when relative sorting is
|
|
1668
|
+
* active. For example, [1, 2, 3] will use buckets of 0, 0-1, 1-2, 2-3, and >3.
|
|
1669
|
+
*/
|
|
1670
|
+
ratioThresholds: number[];
|
|
1374
1671
|
/** The set of resolved scenarios that will be compared. */
|
|
1375
1672
|
scenarios: ComparisonScenarios;
|
|
1376
1673
|
/** The set of resolved datasets that will be compared. */
|
|
@@ -1386,16 +1683,43 @@ type ComparisonDataRequestKey = string;
|
|
|
1386
1683
|
* Coordinates loading of data in parallel from two models.
|
|
1387
1684
|
*/
|
|
1388
1685
|
declare class ComparisonDataCoordinator {
|
|
1389
|
-
readonly bundleModelL: BundleModel;
|
|
1390
|
-
readonly bundleModelR: BundleModel;
|
|
1391
1686
|
private readonly taskQueue;
|
|
1392
|
-
constructor(
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1687
|
+
constructor(taskQueue: TaskQueue);
|
|
1688
|
+
/**
|
|
1689
|
+
* Request datasets from the two models.
|
|
1690
|
+
*
|
|
1691
|
+
* @param requestKey The unique key for the request.
|
|
1692
|
+
* @param sourceL The source of the first ("left") dataset. If "left", the datasets will
|
|
1693
|
+
* be fetched from the "left" bundle's model, otherwise they will be fetched from the
|
|
1694
|
+
* "right" bundle's model.
|
|
1695
|
+
* @param scenarioSpecL The scenario used for the first ("left") model of the comparison.
|
|
1696
|
+
* @param sourceR The source of the second ("right") dataset. If "left", the datasets
|
|
1697
|
+
* will be fetched from the "left" bundle's model, otherwise they will be fetched from
|
|
1698
|
+
* the "right" bundle's model.
|
|
1699
|
+
* @param scenarioSpecR The scenario used for the second ("right") model of the comparison.
|
|
1700
|
+
* @param graphId The keys of the datasets to be fetched.
|
|
1701
|
+
* @param onResponse The callback that will be called with the dataset maps.
|
|
1702
|
+
*/
|
|
1703
|
+
requestDatasetMaps(requestKey: ComparisonDataRequestKey, sourceL: 'left' | 'right', scenarioSpecL: ScenarioSpec, sourceR: 'left' | 'right', scenarioSpecR: ScenarioSpec, datasetKeys: DatasetKey[], onResponse: (datasetMapL?: DatasetMap, datasetMapR?: DatasetMap) => void): void;
|
|
1704
|
+
/**
|
|
1705
|
+
* Request graph data from the two models.
|
|
1706
|
+
*
|
|
1707
|
+
* @param requestKey The unique key for the request.
|
|
1708
|
+
* @param sourceL The source of the first ("left") dataset. If "left", the datasets will
|
|
1709
|
+
* be fetched from the "left" bundle's model, otherwise they will be fetched from the
|
|
1710
|
+
* "right" bundle's model.
|
|
1711
|
+
* @param scenarioSpecL The scenario used for the first ("left") model of the comparison.
|
|
1712
|
+
* @param sourceR The source of the second ("right") dataset. If "left", the datasets
|
|
1713
|
+
* will be fetched from the "left" bundle's model, otherwise they will be fetched from
|
|
1714
|
+
* the "right" bundle's model.
|
|
1715
|
+
* @param scenarioSpecR The scenario used for the second ("right") model of the comparison.
|
|
1716
|
+
* @param graphId The ID of the graph for which data will be fetched.
|
|
1717
|
+
* @param onResponse The callback that will be called with the graph data.
|
|
1718
|
+
*/
|
|
1719
|
+
requestGraphData(requestKey: ComparisonDataRequestKey, sourceL: 'left' | 'right', scenarioSpecL: ScenarioSpec, sourceR: 'left' | 'right', scenarioSpecR: ScenarioSpec, graphId: BundleGraphId, onResponse: (graphDataL?: BundleGraphData, graphDataR?: BundleGraphData) => void): void;
|
|
1397
1720
|
cancelRequest(key: ComparisonDataRequestKey): void;
|
|
1398
1721
|
}
|
|
1722
|
+
declare function createComparisonDataCoordinator(): ComparisonDataCoordinator;
|
|
1399
1723
|
|
|
1400
1724
|
type GraphInclusion = 'neither' | 'left-only' | 'right-only' | 'both';
|
|
1401
1725
|
interface GraphComparisonMetadataReport {
|
|
@@ -1440,6 +1764,19 @@ declare function diffGraphs(graphL: BundleGraphSpec | undefined, graphR: BundleG
|
|
|
1440
1764
|
* @return The terse summary.
|
|
1441
1765
|
*/
|
|
1442
1766
|
declare function comparisonSummaryFromReport(comparisonReport: ComparisonReport): ComparisonSummary;
|
|
1767
|
+
/**
|
|
1768
|
+
* Convert a full `ComparisonTestReport` to a terse `ComparisonTestSummary`. This will
|
|
1769
|
+
* return undefined if the test has a zero `maxDiff` value.
|
|
1770
|
+
*
|
|
1771
|
+
* @param r The full comparison test report.
|
|
1772
|
+
* @param baselineMaxDiff The max diff for the baseline scenario, or undefined if not available.
|
|
1773
|
+
* @param baselineAvgDiff The avg diff for the baseline scenario, or undefined if not available.
|
|
1774
|
+
* @return The terse comparison test summary.
|
|
1775
|
+
*/
|
|
1776
|
+
declare function testSummaryFromReport(r: ComparisonTestReport, baselineMaxDiff: number | undefined, baselineAvgDiff: number | undefined): ComparisonTestSummary | undefined;
|
|
1777
|
+
|
|
1778
|
+
/** The available sort modes for categorizing comparison groups. */
|
|
1779
|
+
type ComparisonSortMode = 'max-diff' | 'avg-diff' | 'max-diff-relative' | 'avg-diff-relative';
|
|
1443
1780
|
|
|
1444
1781
|
/**
|
|
1445
1782
|
* Compute the overall scores for the given group of comparison test summaries.
|
|
@@ -1447,8 +1784,9 @@ declare function comparisonSummaryFromReport(comparisonReport: ComparisonReport)
|
|
|
1447
1784
|
* @param testSummaries The comparison test summaries to consider.
|
|
1448
1785
|
* @param thresholds The array of thresholds that determine the buckets into which
|
|
1449
1786
|
* the scores will be summarized.
|
|
1787
|
+
* @param sortMode The sort mode to determine which field to use for scoring.
|
|
1450
1788
|
*/
|
|
1451
|
-
declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[], thresholds: number[]): ComparisonGroupScores;
|
|
1789
|
+
declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[], thresholds: number[], sortMode: ComparisonSortMode): ComparisonGroupScores;
|
|
1452
1790
|
|
|
1453
1791
|
/**
|
|
1454
1792
|
* Given a set of terse test summaries (which only includes summaries for tests with non-zero `maxDiff`
|
|
@@ -1456,25 +1794,18 @@ declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[
|
|
|
1456
1794
|
*
|
|
1457
1795
|
* @param comparisonConfig The comparison configuration.
|
|
1458
1796
|
* @param terseSummaries The set of terse test summaries.
|
|
1797
|
+
* @param sortMode The sort mode to determine which field to use for scoring.
|
|
1459
1798
|
*/
|
|
1460
|
-
declare function categorizeComparisonTestSummaries(comparisonConfig: ComparisonConfig, terseSummaries: ComparisonTestSummary[]): ComparisonCategorizedResults;
|
|
1799
|
+
declare function categorizeComparisonTestSummaries(comparisonConfig: ComparisonConfig, terseSummaries: ComparisonTestSummary[], sortMode: ComparisonSortMode): ComparisonCategorizedResults;
|
|
1461
1800
|
|
|
1462
1801
|
/**
|
|
1463
|
-
* Additional options that are passed to `getConfigOptions`.
|
|
1464
|
-
* the `ConfigOptions`, for example, if the `simplifyScenarios` flag is true, a reduced set
|
|
1465
|
-
* of tests can be provided in the `ConfigOptions` so that the tests run faster in a local
|
|
1466
|
-
* development situation.
|
|
1802
|
+
* Additional options that are passed to `getConfigOptions`.
|
|
1467
1803
|
*/
|
|
1468
1804
|
interface ConfigInitOptions {
|
|
1469
1805
|
/** If defined, overrides the displayed name of the baseline ("left") bundle. */
|
|
1470
1806
|
bundleNameL?: string;
|
|
1471
1807
|
/** If defined, overrides the displayed name of the current ("right") bundle. */
|
|
1472
1808
|
bundleNameR?: string;
|
|
1473
|
-
/**
|
|
1474
|
-
* A hint that the user wants tests to run faster. If true, you can return a
|
|
1475
|
-
* configuration that runs a smaller subset of tests than normal.
|
|
1476
|
-
*/
|
|
1477
|
-
simplifyScenarios?: boolean;
|
|
1478
1809
|
}
|
|
1479
1810
|
/**
|
|
1480
1811
|
* The user-specified options used by the library to resolve and initialize a `Config` instance.
|
|
@@ -1493,6 +1824,21 @@ interface ConfigOptions {
|
|
|
1493
1824
|
* The model comparison options.
|
|
1494
1825
|
*/
|
|
1495
1826
|
comparison?: ComparisonOptions;
|
|
1827
|
+
/**
|
|
1828
|
+
* The number of model instances to initialize for each bundle.
|
|
1829
|
+
*
|
|
1830
|
+
* If undefined, the default behavior will be used, which is to initialize a single
|
|
1831
|
+
* model instance for each bundle.
|
|
1832
|
+
*
|
|
1833
|
+
* If you set this to a value greater than 1, it will allow multiple pairs of model
|
|
1834
|
+
* instances to be run concurrently. For example, if the number of CPU cores is 8,
|
|
1835
|
+
* setting this to 4 will allow 4 pairs of model instances to be run concurrently,
|
|
1836
|
+
* using all available cores.
|
|
1837
|
+
*
|
|
1838
|
+
* If you set this to 0, the implementation will automatically choose a value based on
|
|
1839
|
+
* the number of available CPU cores (i.e., the number of cores divided by 2).
|
|
1840
|
+
*/
|
|
1841
|
+
concurrency?: number;
|
|
1496
1842
|
}
|
|
1497
1843
|
/**
|
|
1498
1844
|
* The resolved configuration for check and comparison tests.
|
|
@@ -1506,22 +1852,89 @@ interface Config {
|
|
|
1506
1852
|
|
|
1507
1853
|
declare function createConfig(options: ConfigOptions): Promise<Config>;
|
|
1508
1854
|
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
readonly bundleModelR: BundleModel;
|
|
1512
|
-
private readonly mode;
|
|
1513
|
-
private readonly taskQueue;
|
|
1855
|
+
type CancelRunPerf = () => void;
|
|
1856
|
+
interface RunPerfCallbacks {
|
|
1514
1857
|
onComplete?: (reportL: PerfReport, reportR: PerfReport) => void;
|
|
1515
1858
|
onError?: (error: Error) => void;
|
|
1516
|
-
constructor(bundleModelL: BundleModel, bundleModelR: BundleModel, mode?: 'serial' | 'parallel');
|
|
1517
|
-
start(): void;
|
|
1518
1859
|
}
|
|
1860
|
+
interface RunPerfOptions {
|
|
1861
|
+
/** The mode to run the performance tests (default is 'serial'). */
|
|
1862
|
+
mode?: 'serial' | 'parallel';
|
|
1863
|
+
/** The number of warmups for each perf run (default is 5). */
|
|
1864
|
+
warmupCount?: number;
|
|
1865
|
+
/** The number of times to run the model for each perf run (default is 100). */
|
|
1866
|
+
runCount?: number;
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Run performance tests on the bundle models.
|
|
1870
|
+
*
|
|
1871
|
+
* @param callbacks The callbacks that will be notified.
|
|
1872
|
+
* @param options The options for the performance run.
|
|
1873
|
+
* @return A function that will cancel the process when invoked.
|
|
1874
|
+
*/
|
|
1875
|
+
declare function runPerf(callbacks: RunPerfCallbacks, options?: RunPerfOptions): CancelRunPerf;
|
|
1876
|
+
|
|
1877
|
+
/**
|
|
1878
|
+
* The report for a single trace comparison between two datasets.
|
|
1879
|
+
*
|
|
1880
|
+
* TODO: This is basically the same as `DiffReport`, except that it preserves the
|
|
1881
|
+
* diff points. Maybe we can combine them and make the points array an opt-in thing.
|
|
1882
|
+
*/
|
|
1883
|
+
interface TraceDatasetReport {
|
|
1884
|
+
datasetKey: DatasetKey;
|
|
1885
|
+
validity: DiffValidity;
|
|
1886
|
+
points: Map<number, DiffPoint>;
|
|
1887
|
+
minValue: number;
|
|
1888
|
+
maxValue: number;
|
|
1889
|
+
avgDiff: number;
|
|
1890
|
+
minDiff: number;
|
|
1891
|
+
maxDiff: number;
|
|
1892
|
+
maxDiffPoint: DiffPoint;
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* The roll-up report that contains the results of the trace comparisons
|
|
1896
|
+
* for all datasets.
|
|
1897
|
+
*/
|
|
1898
|
+
interface TraceReport {
|
|
1899
|
+
datasetReports: Map<DatasetKey, TraceDatasetReport>;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
type CancelRunTrace = () => void;
|
|
1903
|
+
interface RunTraceCallbacks {
|
|
1904
|
+
onComplete?: (traceReport: TraceReport) => void;
|
|
1905
|
+
onError?: (error: Error) => void;
|
|
1906
|
+
}
|
|
1907
|
+
interface TraceCompareToBundleOptions {
|
|
1908
|
+
kind: 'compare-to-bundle';
|
|
1909
|
+
bundleSide0: 'left' | 'right';
|
|
1910
|
+
scenarioSpec0: ScenarioSpec;
|
|
1911
|
+
bundleSide1: 'left' | 'right';
|
|
1912
|
+
scenarioSpec1: ScenarioSpec;
|
|
1913
|
+
}
|
|
1914
|
+
interface TraceCompareToExtDataOptions {
|
|
1915
|
+
kind: 'compare-to-ext-data';
|
|
1916
|
+
extData: DatasetMap;
|
|
1917
|
+
bundleSide: 'left' | 'right';
|
|
1918
|
+
scenarioSpec: ScenarioSpec;
|
|
1919
|
+
}
|
|
1920
|
+
type TraceOptions = TraceCompareToBundleOptions | TraceCompareToExtDataOptions;
|
|
1921
|
+
/**
|
|
1922
|
+
* Perform a trace run, comparing all datasets from the requested models.
|
|
1923
|
+
*
|
|
1924
|
+
* @param modelSpec The model spec that provides the datasets to be compared (usually from the "right" bundle).
|
|
1925
|
+
* @param callbacks The callbacks that will be notified.
|
|
1926
|
+
* @param options Options to control how the trace is run.
|
|
1927
|
+
* @return A function that will cancel the process when invoked.
|
|
1928
|
+
*/
|
|
1929
|
+
declare function runTrace(modelSpec: ModelSpec, callbacks: RunTraceCallbacks, options: TraceOptions): CancelRunTrace;
|
|
1519
1930
|
|
|
1520
1931
|
/**
|
|
1521
1932
|
* The report for a single run of the full check+comparison test suite.
|
|
1522
1933
|
*/
|
|
1523
1934
|
interface SuiteReport {
|
|
1935
|
+
/** The check report. */
|
|
1524
1936
|
checkReport: CheckReport;
|
|
1937
|
+
/** The comparison report (only defined if comparisons were enabled). */
|
|
1525
1938
|
comparisonReport?: ComparisonReport;
|
|
1526
1939
|
}
|
|
1527
1940
|
/**
|
|
@@ -1532,7 +1945,13 @@ interface SuiteReport {
|
|
|
1532
1945
|
* when there are many reported differences.
|
|
1533
1946
|
*/
|
|
1534
1947
|
interface SuiteSummary {
|
|
1948
|
+
/** The date and time the suite was run (in ISO 8601 format, as generated by `Date.toISOString`). */
|
|
1949
|
+
date: string;
|
|
1950
|
+
/** The time in milliseconds that it took to run the suite. */
|
|
1951
|
+
elapsed: number;
|
|
1952
|
+
/** The check summary. */
|
|
1535
1953
|
checkSummary: CheckSummary;
|
|
1954
|
+
/** The comparison summary (only defined if comparisons were enabled). */
|
|
1536
1955
|
comparisonSummary?: ComparisonSummary;
|
|
1537
1956
|
}
|
|
1538
1957
|
|
|
@@ -1543,8 +1962,16 @@ interface RunSuiteCallbacks {
|
|
|
1543
1962
|
onError?: (error: Error) => void;
|
|
1544
1963
|
}
|
|
1545
1964
|
interface RunSuiteOptions {
|
|
1546
|
-
/**
|
|
1547
|
-
|
|
1965
|
+
/**
|
|
1966
|
+
* The check tests to skip. Note that checks are matched by group and name
|
|
1967
|
+
* (case insensitive).
|
|
1968
|
+
*/
|
|
1969
|
+
skipChecks?: CheckNameSpec[];
|
|
1970
|
+
/**
|
|
1971
|
+
* The comparison scenarios to skip. Note that scenarios are matched by
|
|
1972
|
+
* title and subtitle (case insensitive).
|
|
1973
|
+
*/
|
|
1974
|
+
skipComparisonScenarios?: ComparisonScenarioTitleSpec[];
|
|
1548
1975
|
}
|
|
1549
1976
|
/**
|
|
1550
1977
|
* Run the full suite of checks and comparisons defined in the given configuration.
|
|
@@ -1561,8 +1988,9 @@ declare function runSuite(config: Config, callbacks: RunSuiteCallbacks, options?
|
|
|
1561
1988
|
* failed/errored checks or comparisons with differences.
|
|
1562
1989
|
*
|
|
1563
1990
|
* @param suiteReport The full suite report.
|
|
1991
|
+
* @param elapsedMillis The time in milliseconds that it took to run the suite.
|
|
1564
1992
|
* @return The converted suite summary.
|
|
1565
1993
|
*/
|
|
1566
|
-
declare function suiteSummaryFromReport(suiteReport: SuiteReport): SuiteSummary;
|
|
1994
|
+
declare function suiteSummaryFromReport(suiteReport: SuiteReport, elapsedMillis: number): SuiteSummary;
|
|
1567
1995
|
|
|
1568
|
-
export { type AllInputsSpec, type Bundle, type BundleGraphData, type BundleGraphDatasetSpec, type BundleGraphId, type BundleGraphSpec, type BundleGraphView, type BundleModel, CheckDataCoordinator, type CheckDataRequestKey, type CheckDatasetReport, type CheckGroupReport, type CheckKey, 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 ComparisonResolverInvalidValueError, type ComparisonResolverUnknownInputError, type ComparisonResolverUnknownInputSettingGroupError, 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 ComparisonScenarioWithAllInputsSpec, type ComparisonScenarioWithDistinctInputsSpec, type ComparisonScenarioWithInputsSpec, type ComparisonScenarioWithSettingGroupSpec, type ComparisonScenarios, 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 DataSource, type Dataset, type DatasetGroupName, type DatasetKey, type DatasetMap, type DatasetsResult, type DiffPoint, type DiffReport, type DiffValidity, type
|
|
1996
|
+
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 ComparisonResolverInvalidValueError, type ComparisonResolverUnknownInputError, type ComparisonResolverUnknownInputSettingGroupError, 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 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 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 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 SourceName, type SuiteReport, type SuiteSummary, 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 };
|