@sdeverywhere/check-core 0.1.4 → 0.1.6
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 +1227 -439
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +499 -105
- package/dist/index.d.ts +499 -105
- package/dist/index.js +1218 -437
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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,20 +117,41 @@ 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. */
|
|
149
129
|
type InputGroupName = string;
|
|
150
130
|
/** The alias name for an input. */
|
|
151
131
|
type InputAliasName = string;
|
|
152
|
-
/** The
|
|
132
|
+
/** The name for a custom input setting group. */
|
|
133
|
+
type InputSettingGroupId = string;
|
|
134
|
+
/** The human-readable name for a group of datasets. */
|
|
153
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
|
+
}
|
|
154
155
|
/**
|
|
155
156
|
* Includes the properties needed to display a legend item in the UI.
|
|
156
157
|
*/
|
|
@@ -231,10 +232,14 @@ interface ModelSpec {
|
|
|
231
232
|
outputVars: Map<DatasetKey, OutputVar>;
|
|
232
233
|
/** The map of all variables (both internal and exported) in this version of the model. */
|
|
233
234
|
implVars: Map<DatasetKey, ImplVar>;
|
|
235
|
+
/** The groupings of internal/implementation variables in this version of the model. */
|
|
236
|
+
implVarGroups?: ImplVarGroup[];
|
|
234
237
|
/** The custom input variable aliases defined for this model. */
|
|
235
238
|
inputAliases?: Map<InputAliasName, VarId>;
|
|
236
239
|
/** The custom input variable groups defined for this model. */
|
|
237
240
|
inputGroups?: Map<InputGroupName, InputVar[]>;
|
|
241
|
+
/** The custom input setting groups defined for this model. */
|
|
242
|
+
inputSettingGroups?: Map<InputSettingGroupId, InputSetting[]>;
|
|
238
243
|
/** The custom dataset (output variable) groups defined for this model. */
|
|
239
244
|
datasetGroups?: Map<DatasetGroupName, DatasetKey[]>;
|
|
240
245
|
/** The start time (year) for the model. */
|
|
@@ -285,15 +290,204 @@ interface NamedBundle {
|
|
|
285
290
|
bundle: Bundle;
|
|
286
291
|
}
|
|
287
292
|
/**
|
|
288
|
-
* Represents a bundle that has had its model initialized.
|
|
293
|
+
* Represents a bundle that has had its model instances initialized.
|
|
289
294
|
*/
|
|
290
295
|
interface LoadedBundle {
|
|
291
296
|
/** The name of the bundle, for example, "Current" or "Baseline". */
|
|
292
297
|
name: string;
|
|
293
298
|
/** The version of the bundle. */
|
|
294
299
|
version: number;
|
|
295
|
-
/** The
|
|
296
|
-
|
|
300
|
+
/** The spec for the bundled model. */
|
|
301
|
+
modelSpec: ModelSpec;
|
|
302
|
+
/**
|
|
303
|
+
* The initialized model instances for this bundle. If `concurrency` was specified
|
|
304
|
+
* in the config, then there will be that number of model instances in this array,
|
|
305
|
+
* otherwise there will be one instance.
|
|
306
|
+
*/
|
|
307
|
+
models: BundleModel[];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* A terse representation of a subscript.
|
|
312
|
+
*/
|
|
313
|
+
interface EncodedSubscript {
|
|
314
|
+
/** The subscript name (e.g., "Sub1"). */
|
|
315
|
+
n: string;
|
|
316
|
+
/** The subscript identifier (e.g., "_sub1"). */
|
|
317
|
+
i: string;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* A terse representation of a variable without subscripts.
|
|
321
|
+
*/
|
|
322
|
+
interface EncodedVariable {
|
|
323
|
+
/** The variable name (corresponds to the base part of `ImplVar.varName` without subscripts). */
|
|
324
|
+
n: string;
|
|
325
|
+
/** The variable identifier (corresponds to the base part of `ImplVar.varId` without subscripts). */
|
|
326
|
+
i: string;
|
|
327
|
+
/** The variable index (corresponds to `ImplVar.varIndex`). */
|
|
328
|
+
x: number;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* A terse representation of a variable type.
|
|
332
|
+
*/
|
|
333
|
+
type EncodedVarType = string;
|
|
334
|
+
/**
|
|
335
|
+
* A terse representation of a variable instance as a flat array.
|
|
336
|
+
*
|
|
337
|
+
* Format: [t, v, si0, si1, ..., sx0, sx1, ...]
|
|
338
|
+
* - Element 0: The index of the associated `EncodedVarType` element in the `varTypes` array (corresponds to `ImplVar.varType`).
|
|
339
|
+
* - Element 1: The index of the associated `EncodedVariable` element in the `variables` array.
|
|
340
|
+
* - Elements 2+: If subscripts are present, first all subscript element indices, then all subscript indices:
|
|
341
|
+
* - Elements 2 to (2 + n - 1): The indices of the associated `EncodedSubscript` elements in the `subscripts` array.
|
|
342
|
+
* - Elements (2 + n) to (2 + 2n - 1): The subscript index values (corresponds to `ImplVar.subscriptIndices`).
|
|
343
|
+
*/
|
|
344
|
+
type EncodedVarInstance = number[];
|
|
345
|
+
/**
|
|
346
|
+
* The encoded representation of impl variables that eliminates redundancy.
|
|
347
|
+
*/
|
|
348
|
+
interface EncodedImplVars {
|
|
349
|
+
subscripts: EncodedSubscript[];
|
|
350
|
+
variables: EncodedVariable[];
|
|
351
|
+
varTypes: EncodedVarType[];
|
|
352
|
+
varInstances: {
|
|
353
|
+
[key: string]: EncodedVarInstance[];
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Encode impl variable metadata into a more efficient format.
|
|
358
|
+
*
|
|
359
|
+
* This is used to reduce the size of a bundle by eliminating redundancy in variable/subscript
|
|
360
|
+
* names and identifiers. The `varInstances` object in the model listing JSON generated by the
|
|
361
|
+
* compiler includes verbose information for each variable instance. This function puts that
|
|
362
|
+
* information into a more efficient format that can be bundled as a normal JavaScript object
|
|
363
|
+
* in the model-check bundle file, and then decoded and expandedwhen the bundle is loaded.
|
|
364
|
+
*
|
|
365
|
+
* @param input The input structure mapping keys to ImplVar arrays.
|
|
366
|
+
* @returns The encoded representation.
|
|
367
|
+
*/
|
|
368
|
+
declare function encodeImplVars(input: {
|
|
369
|
+
[key: string]: ImplVar[];
|
|
370
|
+
}): EncodedImplVars;
|
|
371
|
+
/**
|
|
372
|
+
* Decode impl variables from the efficient format back to the original structure.
|
|
373
|
+
*
|
|
374
|
+
* @param encoded The encoded representation.
|
|
375
|
+
* @returns The original structure mapping keys to `ImplVar` arrays.
|
|
376
|
+
*/
|
|
377
|
+
declare function decodeImplVars(encoded: EncodedImplVars): {
|
|
378
|
+
[key: string]: ImplVar[];
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
interface CheckOptions {
|
|
382
|
+
/** The strings containing check tests in YAML format. */
|
|
383
|
+
tests: string[];
|
|
384
|
+
}
|
|
385
|
+
interface CheckConfig {
|
|
386
|
+
/** The loaded bundle being checked. */
|
|
387
|
+
bundle: LoadedBundle;
|
|
388
|
+
/** The strings containing check tests in YAML format. */
|
|
389
|
+
tests: string[];
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
type TaskKey = string;
|
|
393
|
+
type TaskExecutorKey = string;
|
|
394
|
+
interface BundleModels {
|
|
395
|
+
L?: BundleModel;
|
|
396
|
+
R: BundleModel;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Base interface for all tasks in the unified system.
|
|
400
|
+
*/
|
|
401
|
+
interface Task {
|
|
402
|
+
/** Unique key for this task instance. */
|
|
403
|
+
key: TaskKey;
|
|
404
|
+
/** The task kind. */
|
|
405
|
+
kind: string;
|
|
406
|
+
/** Process the task using the given models. */
|
|
407
|
+
process(models: BundleModels): Promise<void>;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Executes a single task using a set of `BundleModel` instances.
|
|
411
|
+
*/
|
|
412
|
+
interface TaskExecutor {
|
|
413
|
+
/**
|
|
414
|
+
* Execute the given task using the set of `BundleModel` instances
|
|
415
|
+
* associated with this executor.
|
|
416
|
+
*
|
|
417
|
+
* @param task The task to execute.
|
|
418
|
+
* @return A promise that resolves when the task is complete.
|
|
419
|
+
*/
|
|
420
|
+
execute(task: Task): Promise<void>;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* A unified task queue that can process multiple kinds of tasks concurrently
|
|
424
|
+
* while ensuring that BundleModel instances are never accessed concurrently.
|
|
425
|
+
* This replaces the need for multiple separate TaskQueue instances.
|
|
426
|
+
*/
|
|
427
|
+
declare class TaskQueue {
|
|
428
|
+
private readonly executors;
|
|
429
|
+
/** The single instance. */
|
|
430
|
+
private static instance;
|
|
431
|
+
/** The queue of task keys, most recent at front. */
|
|
432
|
+
private readonly taskKeyQueue;
|
|
433
|
+
/** The map of tasks. */
|
|
434
|
+
private readonly taskMap;
|
|
435
|
+
/** The idle event listeners. */
|
|
436
|
+
private readonly idleListeners;
|
|
437
|
+
/** Whether tasks are being processed. */
|
|
438
|
+
private processing;
|
|
439
|
+
/** Whether `shutdown` has been called. */
|
|
440
|
+
private stopped;
|
|
441
|
+
/**
|
|
442
|
+
* @param executors The map of available task executors.
|
|
443
|
+
*/
|
|
444
|
+
constructor(executors: Map<TaskExecutorKey, TaskExecutor>);
|
|
445
|
+
/**
|
|
446
|
+
* Initialize the shared `TaskQueue` instance.
|
|
447
|
+
*
|
|
448
|
+
* @param executors The map of available task executors.
|
|
449
|
+
*/
|
|
450
|
+
static initialize(executors: Map<TaskExecutorKey, TaskExecutor>): void;
|
|
451
|
+
/**
|
|
452
|
+
* Get the shared `TaskQueue` instance.
|
|
453
|
+
*/
|
|
454
|
+
static getInstance(): TaskQueue;
|
|
455
|
+
/**
|
|
456
|
+
* Add a task to the queue.
|
|
457
|
+
*
|
|
458
|
+
* @param task The task to add.
|
|
459
|
+
*/
|
|
460
|
+
addTask(task: Task): void;
|
|
461
|
+
/**
|
|
462
|
+
* Cancel a task.
|
|
463
|
+
*
|
|
464
|
+
* @param taskKey The key of the task to cancel.
|
|
465
|
+
*/
|
|
466
|
+
cancelTask(taskKey: TaskKey): void;
|
|
467
|
+
/**
|
|
468
|
+
* Add an idle listener.
|
|
469
|
+
*
|
|
470
|
+
* @param listener The listener to add.
|
|
471
|
+
*/
|
|
472
|
+
onIdle(listener: (error?: Error) => void): void;
|
|
473
|
+
/**
|
|
474
|
+
* Remove an idle listener.
|
|
475
|
+
*
|
|
476
|
+
* @param listener The listener to remove.
|
|
477
|
+
*/
|
|
478
|
+
removeIdleListener(listener: (error?: Error) => void): void;
|
|
479
|
+
/**
|
|
480
|
+
* Notify the idle listeners.
|
|
481
|
+
*
|
|
482
|
+
* @param error The error to notify the listeners with.
|
|
483
|
+
*/
|
|
484
|
+
private notifyIdle;
|
|
485
|
+
/**
|
|
486
|
+
* Shutdown the task queue, cancelling all pending tasks.
|
|
487
|
+
*/
|
|
488
|
+
shutdown(): void;
|
|
489
|
+
private processTasksIfNeeded;
|
|
490
|
+
private processNextTasks;
|
|
297
491
|
}
|
|
298
492
|
|
|
299
493
|
type CheckDataRequestKey = string;
|
|
@@ -302,15 +496,27 @@ type CheckDataRequestKey = string;
|
|
|
302
496
|
* of a check/predicate.
|
|
303
497
|
*/
|
|
304
498
|
declare class CheckDataCoordinator {
|
|
305
|
-
readonly bundleModel: BundleModel;
|
|
306
499
|
private readonly taskQueue;
|
|
307
|
-
constructor(
|
|
500
|
+
constructor(taskQueue: TaskQueue);
|
|
308
501
|
requestDataset(requestKey: CheckDataRequestKey, scenarioSpec: ScenarioSpec, datasetKey: DatasetKey, onResponse: (dataset: Dataset) => void): void;
|
|
309
502
|
cancelRequest(key: CheckDataRequestKey): void;
|
|
310
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Create a `CheckDataCoordinator` instance using the shared task queue.
|
|
506
|
+
*/
|
|
507
|
+
declare function createCheckDataCoordinator(): CheckDataCoordinator;
|
|
508
|
+
/**
|
|
509
|
+
* @hidden This is not part of the public API; it is exposed only for use in tests.
|
|
510
|
+
*/
|
|
511
|
+
declare function createCheckDataCoordinatorForTests(bundleModel: BundleModel): CheckDataCoordinator;
|
|
311
512
|
|
|
312
|
-
type
|
|
313
|
-
|
|
513
|
+
/** Spec type that allows for matching a check by group and test name. */
|
|
514
|
+
interface CheckNameSpec {
|
|
515
|
+
/** The name of a check group. */
|
|
516
|
+
groupName: string;
|
|
517
|
+
/** The name of a check test. */
|
|
518
|
+
testName: string;
|
|
519
|
+
}
|
|
314
520
|
type CheckPredicateTimeSingle = number;
|
|
315
521
|
type CheckPredicateTimeRange = [number, number];
|
|
316
522
|
interface CheckPredicateTimeOptions {
|
|
@@ -321,20 +527,6 @@ interface CheckPredicateTimeOptions {
|
|
|
321
527
|
}
|
|
322
528
|
type CheckPredicateTimeSpec = CheckPredicateTimeSingle | CheckPredicateTimeRange | CheckPredicateTimeOptions;
|
|
323
529
|
|
|
324
|
-
interface CheckResultErrorInfo {
|
|
325
|
-
kind: 'unknown-dataset' | 'unknown-input' | 'unknown-input-group' | 'empty-input-group';
|
|
326
|
-
name: string;
|
|
327
|
-
}
|
|
328
|
-
interface CheckResult {
|
|
329
|
-
status: 'passed' | 'failed' | 'error';
|
|
330
|
-
message?: string;
|
|
331
|
-
failValue?: number;
|
|
332
|
-
failOp?: CheckPredicateOp;
|
|
333
|
-
failRefValue?: number;
|
|
334
|
-
failTime?: number;
|
|
335
|
-
errorInfo?: CheckResultErrorInfo;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
530
|
type CheckDatasetError = 'no-matches-for-dataset' | 'no-matches-for-group' | 'no-matches-for-type';
|
|
339
531
|
interface CheckDataset {
|
|
340
532
|
/** The key for the matched dataset; can be undefined if no dataset matched. */
|
|
@@ -388,9 +580,25 @@ interface CheckDataRef {
|
|
|
388
580
|
dataset: CheckDataset;
|
|
389
581
|
}
|
|
390
582
|
|
|
583
|
+
type CheckPredicateOp = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'approx';
|
|
584
|
+
|
|
585
|
+
interface CheckResultErrorInfo {
|
|
586
|
+
kind: 'unknown-dataset' | 'unknown-input' | 'unknown-input-group' | 'empty-input-group';
|
|
587
|
+
name: string;
|
|
588
|
+
}
|
|
589
|
+
interface CheckResult {
|
|
590
|
+
status: 'passed' | 'failed' | 'error' | 'skipped';
|
|
591
|
+
message?: string;
|
|
592
|
+
failValue?: number;
|
|
593
|
+
failOp?: CheckPredicateOp;
|
|
594
|
+
failRefValue?: number;
|
|
595
|
+
failTime?: number;
|
|
596
|
+
errorInfo?: CheckResultErrorInfo;
|
|
597
|
+
}
|
|
598
|
+
|
|
391
599
|
type CheckKey = number;
|
|
392
600
|
|
|
393
|
-
type CheckStatus = 'passed' | 'failed' | 'error';
|
|
601
|
+
type CheckStatus = 'passed' | 'failed' | 'error' | 'skipped';
|
|
394
602
|
interface CheckPredicateOpConstantRef {
|
|
395
603
|
kind: 'constant';
|
|
396
604
|
value: number;
|
|
@@ -453,17 +661,6 @@ declare function datasetMessage(dataset: CheckDatasetReport, bold: StyleFunc): s
|
|
|
453
661
|
*/
|
|
454
662
|
declare function predicateMessage(predicate: CheckPredicateReport, bold: StyleFunc): string;
|
|
455
663
|
|
|
456
|
-
interface CheckOptions {
|
|
457
|
-
/** The strings containing check tests in YAML format. */
|
|
458
|
-
tests: string[];
|
|
459
|
-
}
|
|
460
|
-
interface CheckConfig {
|
|
461
|
-
/** The loaded bundle being checked. */
|
|
462
|
-
bundle: LoadedBundle;
|
|
463
|
-
/** The strings containing check tests in YAML format. */
|
|
464
|
-
tests: string[];
|
|
465
|
-
}
|
|
466
|
-
|
|
467
664
|
/**
|
|
468
665
|
* A simplified/terse version of `CheckPredicateReport` that matches the
|
|
469
666
|
* format of the JSON objects emitted by the CLI in terse mode.
|
|
@@ -475,15 +672,15 @@ interface CheckPredicateSummary {
|
|
|
475
672
|
/**
|
|
476
673
|
* A simplified/terse version of `CheckReport` that matches the
|
|
477
674
|
* format of the JSON objects emitted by the CLI in terse mode.
|
|
478
|
-
* This
|
|
479
|
-
* of 'failed' or '
|
|
675
|
+
* This contains predicate summaries for checks that have a status
|
|
676
|
+
* of 'failed', 'error', or 'skipped'.
|
|
480
677
|
*/
|
|
481
678
|
interface CheckSummary {
|
|
482
679
|
predicateSummaries: CheckPredicateSummary[];
|
|
483
680
|
}
|
|
484
681
|
/**
|
|
485
|
-
* Convert a full `CheckReport` to a simplified `CheckSummary` that
|
|
486
|
-
* failed
|
|
682
|
+
* Convert a full `CheckReport` to a simplified `CheckSummary` that includes
|
|
683
|
+
* failed, errored, and skipped checks.
|
|
487
684
|
*
|
|
488
685
|
* @param checkReport The full check report.
|
|
489
686
|
* @return The converted check summary.
|
|
@@ -495,9 +692,10 @@ declare function checkSummaryFromReport(checkReport: CheckReport): CheckSummary;
|
|
|
495
692
|
*
|
|
496
693
|
* @param checkConfig The config used to reconstruct the check test structure.
|
|
497
694
|
* @param checkSummary The simplified check summary.
|
|
695
|
+
* @param skipChecks The checks that were skipped when the original report was created.
|
|
498
696
|
* @return The converted check report.
|
|
499
697
|
*/
|
|
500
|
-
declare function checkReportFromSummary(checkConfig: CheckConfig, checkSummary: CheckSummary): CheckReport | undefined;
|
|
698
|
+
declare function checkReportFromSummary(checkConfig: CheckConfig, checkSummary: CheckSummary, skipChecks?: CheckNameSpec[]): CheckReport | undefined;
|
|
501
699
|
|
|
502
700
|
type ComparisonDatasetName = string;
|
|
503
701
|
type ComparisonDatasetSource = string;
|
|
@@ -575,6 +773,21 @@ interface ComparisonScenarioWithDistinctInputsSpec {
|
|
|
575
773
|
/** The input settings for this scenario when run with the "right" model. */
|
|
576
774
|
inputsR: ComparisonScenarioInputSpec[];
|
|
577
775
|
}
|
|
776
|
+
/**
|
|
777
|
+
* Specifies a single scenario that configures inputs according to the setting
|
|
778
|
+
* group defined for each model instance.
|
|
779
|
+
*/
|
|
780
|
+
interface ComparisonScenarioWithSettingGroupSpec {
|
|
781
|
+
kind: 'scenario-with-setting-group';
|
|
782
|
+
/** The unique identifier for the scenario. */
|
|
783
|
+
id?: ComparisonScenarioId;
|
|
784
|
+
/** The title of the scenario. */
|
|
785
|
+
title?: ComparisonScenarioTitle;
|
|
786
|
+
/** The subtitle of the scenario. */
|
|
787
|
+
subtitle?: ComparisonScenarioSubtitle;
|
|
788
|
+
/** The identifier of the input setting group as used in `ModelSpec.inputSettingGroups`. */
|
|
789
|
+
settingGroupId: InputSettingGroupId;
|
|
790
|
+
}
|
|
578
791
|
/**
|
|
579
792
|
* Specifies a single scenario that sets all available inputs to position.
|
|
580
793
|
*/
|
|
@@ -603,7 +816,7 @@ interface ComparisonScenarioPresetMatrixSpec {
|
|
|
603
816
|
* A definition of input scenario(s). A scenario can set one input to a value/position, or it
|
|
604
817
|
* can set multiple inputs to particular values/positions.
|
|
605
818
|
*/
|
|
606
|
-
type ComparisonScenarioSpec = ComparisonScenarioWithInputsSpec | ComparisonScenarioWithDistinctInputsSpec | ComparisonScenarioWithAllInputsSpec | ComparisonScenarioPresetMatrixSpec;
|
|
819
|
+
type ComparisonScenarioSpec = ComparisonScenarioWithInputsSpec | ComparisonScenarioWithDistinctInputsSpec | ComparisonScenarioWithSettingGroupSpec | ComparisonScenarioWithAllInputsSpec | ComparisonScenarioPresetMatrixSpec;
|
|
607
820
|
/** A reference to a scenario definition. */
|
|
608
821
|
interface ComparisonScenarioRefSpec {
|
|
609
822
|
kind: 'scenario-ref';
|
|
@@ -614,6 +827,13 @@ interface ComparisonScenarioRefSpec {
|
|
|
614
827
|
/** The optional subtitle that is used instead of the referenced scenario's subtitle. */
|
|
615
828
|
subtitle?: ComparisonScenarioSubtitle;
|
|
616
829
|
}
|
|
830
|
+
/** Spec type that allows for matching a comparison scenario by title and subtitle. */
|
|
831
|
+
interface ComparisonScenarioTitleSpec {
|
|
832
|
+
/** The title of a comparison scenario. */
|
|
833
|
+
title: string;
|
|
834
|
+
/** The subtitle of a comparison scenario. */
|
|
835
|
+
subtitle?: string;
|
|
836
|
+
}
|
|
617
837
|
type ComparisonScenarioGroupId = string;
|
|
618
838
|
type ComparisonScenarioGroupTitle = string;
|
|
619
839
|
/**
|
|
@@ -809,10 +1029,13 @@ type ComparisonScenarioKey = string & {
|
|
|
809
1029
|
interface ComparisonResolverUnknownInputError {
|
|
810
1030
|
kind: 'unknown-input';
|
|
811
1031
|
}
|
|
1032
|
+
interface ComparisonResolverUnknownInputSettingGroupError {
|
|
1033
|
+
kind: 'unknown-input-setting-group';
|
|
1034
|
+
}
|
|
812
1035
|
interface ComparisonResolverInvalidValueError {
|
|
813
1036
|
kind: 'invalid-value';
|
|
814
1037
|
}
|
|
815
|
-
type ComparisonResolverError = ComparisonResolverUnknownInputError | ComparisonResolverInvalidValueError;
|
|
1038
|
+
type ComparisonResolverError = ComparisonResolverUnknownInputError | ComparisonResolverUnknownInputSettingGroupError | ComparisonResolverInvalidValueError;
|
|
816
1039
|
/** Describes the resolution state for a scenario input relative to a specific model. */
|
|
817
1040
|
interface ComparisonScenarioInputState {
|
|
818
1041
|
/** The matched input variable; can be undefined if no input matched. */
|
|
@@ -838,6 +1061,12 @@ interface ComparisonScenarioInputSettings {
|
|
|
838
1061
|
kind: 'input-settings';
|
|
839
1062
|
/** The resolutions for the specified inputs in the scenario. */
|
|
840
1063
|
inputs: ComparisonScenarioInput[];
|
|
1064
|
+
/**
|
|
1065
|
+
* Whether the settings differ between the "left" and "right" models. This is
|
|
1066
|
+
* typically only used in the case of a scenario based on model-specific setting
|
|
1067
|
+
* groups, where the set of inputs or the input values differ between the two models.
|
|
1068
|
+
*/
|
|
1069
|
+
settingsDiffer?: boolean;
|
|
841
1070
|
}
|
|
842
1071
|
/** A configuration that sets all inputs in the model to a certain position. */
|
|
843
1072
|
interface ComparisonScenarioAllInputsSettings {
|
|
@@ -1006,9 +1235,17 @@ declare function diffDatasets(datasetL: Dataset | undefined, datasetR: Dataset |
|
|
|
1006
1235
|
* a `ComparisonTestSummary` only includes the `maxDiff` value.
|
|
1007
1236
|
*/
|
|
1008
1237
|
interface ComparisonTestReport {
|
|
1238
|
+
/** The key of the scenario that was compared. */
|
|
1009
1239
|
scenarioKey: ComparisonScenarioKey;
|
|
1240
|
+
/** The key of the dataset that was compared. */
|
|
1010
1241
|
datasetKey: DatasetKey;
|
|
1011
|
-
|
|
1242
|
+
/** The diff report for the comparison, or undefined if the test was skipped. */
|
|
1243
|
+
diffReport?: DiffReport;
|
|
1244
|
+
/**
|
|
1245
|
+
* The diff report for the baseline scenario (all inputs at default), or undefined if this
|
|
1246
|
+
* report is for the baseline scenario itself.
|
|
1247
|
+
*/
|
|
1248
|
+
baselineDiffReport?: DiffReport;
|
|
1012
1249
|
}
|
|
1013
1250
|
/**
|
|
1014
1251
|
* A simplified/terse version of `ComparisonTestReport` that is used when writing
|
|
@@ -1022,7 +1259,13 @@ interface ComparisonTestSummary {
|
|
|
1022
1259
|
/** Short for `datasetKey`. */
|
|
1023
1260
|
d: DatasetKey;
|
|
1024
1261
|
/** Short for `maxDiff`. */
|
|
1025
|
-
md
|
|
1262
|
+
md?: number;
|
|
1263
|
+
/** Short for `avgDiff`. */
|
|
1264
|
+
ad?: number;
|
|
1265
|
+
/** Short for `maxDiff` relative to baseline `maxDiff`. */
|
|
1266
|
+
mdb?: number;
|
|
1267
|
+
/** Short for `avgDiff` relative to baseline `avgDiff`. */
|
|
1268
|
+
adb?: number;
|
|
1026
1269
|
}
|
|
1027
1270
|
/**
|
|
1028
1271
|
* The roll-up report that contains the results of all individual comparison tests.
|
|
@@ -1072,8 +1315,8 @@ type ComparisonGroupRoot = ComparisonDataset | ComparisonScenario;
|
|
|
1072
1315
|
interface ComparisonGroupScores {
|
|
1073
1316
|
/** The total number of comparisons (sample size) for this group. */
|
|
1074
1317
|
totalDiffCount: number;
|
|
1075
|
-
/** The sum of the `maxDiff`
|
|
1076
|
-
|
|
1318
|
+
/** The sum of the diff values for the active sort mode (e.g., `maxDiff`, `avgDiff`) for each threshold bucket. */
|
|
1319
|
+
totalDiffByBucket: number[];
|
|
1077
1320
|
/** The number of comparisons that fall into each threshold bucket. */
|
|
1078
1321
|
diffCountByBucket: number[];
|
|
1079
1322
|
/** The percentage of comparisons that fall into each threshold bucket. */
|
|
@@ -1114,12 +1357,13 @@ interface ComparisonGroupSummariesByCategory {
|
|
|
1114
1357
|
*/
|
|
1115
1358
|
onlyInRight: ComparisonGroupSummary[];
|
|
1116
1359
|
/**
|
|
1117
|
-
* Groups with one or more comparisons that have non-zero
|
|
1118
|
-
* will be sorted by
|
|
1360
|
+
* Groups with one or more comparisons that have non-zero diff scores; the groups
|
|
1361
|
+
* will be sorted by the diff score according to the active sort mode, with higher
|
|
1362
|
+
* scores at the front of the array.
|
|
1119
1363
|
*/
|
|
1120
1364
|
withDiffs: ComparisonGroupSummary[];
|
|
1121
1365
|
/**
|
|
1122
|
-
* Groups where all comparisons have
|
|
1366
|
+
* Groups where all comparisons have diff scores of zero (no differences between
|
|
1123
1367
|
* "left" and "right").
|
|
1124
1368
|
*/
|
|
1125
1369
|
withoutDiffs: ComparisonGroupSummary[];
|
|
@@ -1254,6 +1498,15 @@ interface ComparisonReportSummarySection {
|
|
|
1254
1498
|
* it will be initially collapsed.
|
|
1255
1499
|
*/
|
|
1256
1500
|
initialState?: 'collapsed' | 'expanded' | 'expanded-if-diffs';
|
|
1501
|
+
/**
|
|
1502
|
+
* Whether the items in the section are stable, i.e., not changing from run to run. If
|
|
1503
|
+
* undefined, defaults to false. This can be used to group items in the filter panel.
|
|
1504
|
+
* Set it to true if the group contains a stable set of rows where the order does not
|
|
1505
|
+
* change between runs. Set it to false (or leave it undefined) if the group contains
|
|
1506
|
+
* rows that have a different order between runs (for example, "Scenarios producing
|
|
1507
|
+
* differences").
|
|
1508
|
+
*/
|
|
1509
|
+
stable?: boolean;
|
|
1257
1510
|
}
|
|
1258
1511
|
/**
|
|
1259
1512
|
* Describes an item (box) in the comparison report detail view.
|
|
@@ -1319,10 +1572,15 @@ interface ComparisonOptions {
|
|
|
1319
1572
|
/** The left-side ("baseline") bundle being compared. */
|
|
1320
1573
|
baseline: NamedBundle;
|
|
1321
1574
|
/**
|
|
1322
|
-
* The array of thresholds used to color differences
|
|
1323
|
-
* buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
|
|
1575
|
+
* The array of thresholds used to color differences. Defaults to [1, 5, 10]
|
|
1576
|
+
* which will use buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
|
|
1324
1577
|
*/
|
|
1325
|
-
thresholds
|
|
1578
|
+
thresholds?: number[];
|
|
1579
|
+
/**
|
|
1580
|
+
* The array of ratio thresholds used to color differences when relative sorting is
|
|
1581
|
+
* active. Defaults to [1, 2, 3] which will use buckets of 0, 0-1, 1-2, 2-3, and >3.
|
|
1582
|
+
*/
|
|
1583
|
+
ratioThresholds?: number[];
|
|
1326
1584
|
/**
|
|
1327
1585
|
* The requested comparison scenario and view specifications. These can be
|
|
1328
1586
|
* specified in YAML or JSON files, or using `Spec` objects.
|
|
@@ -1339,10 +1597,15 @@ interface ComparisonConfig {
|
|
|
1339
1597
|
/** The loaded right-side ("current") bundle being compared. */
|
|
1340
1598
|
bundleR: LoadedBundle;
|
|
1341
1599
|
/**
|
|
1342
|
-
* The array of thresholds used to color differences,
|
|
1600
|
+
* The array of thresholds used to color differences. For example, [1, 5, 10] will use
|
|
1343
1601
|
* buckets of 0%, 0-1%, 1-5%, 5-10%, and >10%.
|
|
1344
1602
|
*/
|
|
1345
1603
|
thresholds: number[];
|
|
1604
|
+
/**
|
|
1605
|
+
* The array of ratio thresholds used to color differences when relative sorting is
|
|
1606
|
+
* active. For example, [1, 2, 3] will use buckets of 0, 0-1, 1-2, 2-3, and >3.
|
|
1607
|
+
*/
|
|
1608
|
+
ratioThresholds: number[];
|
|
1346
1609
|
/** The set of resolved scenarios that will be compared. */
|
|
1347
1610
|
scenarios: ComparisonScenarios;
|
|
1348
1611
|
/** The set of resolved datasets that will be compared. */
|
|
@@ -1358,16 +1621,43 @@ type ComparisonDataRequestKey = string;
|
|
|
1358
1621
|
* Coordinates loading of data in parallel from two models.
|
|
1359
1622
|
*/
|
|
1360
1623
|
declare class ComparisonDataCoordinator {
|
|
1361
|
-
readonly bundleModelL: BundleModel;
|
|
1362
|
-
readonly bundleModelR: BundleModel;
|
|
1363
1624
|
private readonly taskQueue;
|
|
1364
|
-
constructor(
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1625
|
+
constructor(taskQueue: TaskQueue);
|
|
1626
|
+
/**
|
|
1627
|
+
* Request datasets from the two models.
|
|
1628
|
+
*
|
|
1629
|
+
* @param requestKey The unique key for the request.
|
|
1630
|
+
* @param sourceL The source of the first ("left") dataset. If "left", the datasets will
|
|
1631
|
+
* be fetched from the "left" bundle's model, otherwise they will be fetched from the
|
|
1632
|
+
* "right" bundle's model.
|
|
1633
|
+
* @param scenarioSpecL The scenario used for the first ("left") model of the comparison.
|
|
1634
|
+
* @param sourceR The source of the second ("right") dataset. If "left", the datasets
|
|
1635
|
+
* will be fetched from the "left" bundle's model, otherwise they will be fetched from
|
|
1636
|
+
* the "right" bundle's model.
|
|
1637
|
+
* @param scenarioSpecR The scenario used for the second ("right") model of the comparison.
|
|
1638
|
+
* @param graphId The keys of the datasets to be fetched.
|
|
1639
|
+
* @param onResponse The callback that will be called with the dataset maps.
|
|
1640
|
+
*/
|
|
1641
|
+
requestDatasetMaps(requestKey: ComparisonDataRequestKey, sourceL: 'left' | 'right', scenarioSpecL: ScenarioSpec, sourceR: 'left' | 'right', scenarioSpecR: ScenarioSpec, datasetKeys: DatasetKey[], onResponse: (datasetMapL?: DatasetMap, datasetMapR?: DatasetMap) => void): void;
|
|
1642
|
+
/**
|
|
1643
|
+
* Request graph data from the two models.
|
|
1644
|
+
*
|
|
1645
|
+
* @param requestKey The unique key for the request.
|
|
1646
|
+
* @param sourceL The source of the first ("left") dataset. If "left", the datasets will
|
|
1647
|
+
* be fetched from the "left" bundle's model, otherwise they will be fetched from the
|
|
1648
|
+
* "right" bundle's model.
|
|
1649
|
+
* @param scenarioSpecL The scenario used for the first ("left") model of the comparison.
|
|
1650
|
+
* @param sourceR The source of the second ("right") dataset. If "left", the datasets
|
|
1651
|
+
* will be fetched from the "left" bundle's model, otherwise they will be fetched from
|
|
1652
|
+
* the "right" bundle's model.
|
|
1653
|
+
* @param scenarioSpecR The scenario used for the second ("right") model of the comparison.
|
|
1654
|
+
* @param graphId The ID of the graph for which data will be fetched.
|
|
1655
|
+
* @param onResponse The callback that will be called with the graph data.
|
|
1656
|
+
*/
|
|
1657
|
+
requestGraphData(requestKey: ComparisonDataRequestKey, sourceL: 'left' | 'right', scenarioSpecL: ScenarioSpec, sourceR: 'left' | 'right', scenarioSpecR: ScenarioSpec, graphId: BundleGraphId, onResponse: (graphDataL?: BundleGraphData, graphDataR?: BundleGraphData) => void): void;
|
|
1369
1658
|
cancelRequest(key: ComparisonDataRequestKey): void;
|
|
1370
1659
|
}
|
|
1660
|
+
declare function createComparisonDataCoordinator(): ComparisonDataCoordinator;
|
|
1371
1661
|
|
|
1372
1662
|
type GraphInclusion = 'neither' | 'left-only' | 'right-only' | 'both';
|
|
1373
1663
|
interface GraphComparisonMetadataReport {
|
|
@@ -1412,6 +1702,19 @@ declare function diffGraphs(graphL: BundleGraphSpec | undefined, graphR: BundleG
|
|
|
1412
1702
|
* @return The terse summary.
|
|
1413
1703
|
*/
|
|
1414
1704
|
declare function comparisonSummaryFromReport(comparisonReport: ComparisonReport): ComparisonSummary;
|
|
1705
|
+
/**
|
|
1706
|
+
* Convert a full `ComparisonTestReport` to a terse `ComparisonTestSummary`. This will
|
|
1707
|
+
* return undefined if the test has a zero `maxDiff` value.
|
|
1708
|
+
*
|
|
1709
|
+
* @param r The full comparison test report.
|
|
1710
|
+
* @param baselineMaxDiff The max diff for the baseline scenario, or undefined if not available.
|
|
1711
|
+
* @param baselineAvgDiff The avg diff for the baseline scenario, or undefined if not available.
|
|
1712
|
+
* @return The terse comparison test summary.
|
|
1713
|
+
*/
|
|
1714
|
+
declare function testSummaryFromReport(r: ComparisonTestReport, baselineMaxDiff: number | undefined, baselineAvgDiff: number | undefined): ComparisonTestSummary | undefined;
|
|
1715
|
+
|
|
1716
|
+
/** The available sort modes for categorizing comparison groups. */
|
|
1717
|
+
type ComparisonSortMode = 'max-diff' | 'avg-diff' | 'max-diff-relative' | 'avg-diff-relative';
|
|
1415
1718
|
|
|
1416
1719
|
/**
|
|
1417
1720
|
* Compute the overall scores for the given group of comparison test summaries.
|
|
@@ -1419,8 +1722,9 @@ declare function comparisonSummaryFromReport(comparisonReport: ComparisonReport)
|
|
|
1419
1722
|
* @param testSummaries The comparison test summaries to consider.
|
|
1420
1723
|
* @param thresholds The array of thresholds that determine the buckets into which
|
|
1421
1724
|
* the scores will be summarized.
|
|
1725
|
+
* @param sortMode The sort mode to determine which field to use for scoring.
|
|
1422
1726
|
*/
|
|
1423
|
-
declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[], thresholds: number[]): ComparisonGroupScores;
|
|
1727
|
+
declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[], thresholds: number[], sortMode: ComparisonSortMode): ComparisonGroupScores;
|
|
1424
1728
|
|
|
1425
1729
|
/**
|
|
1426
1730
|
* Given a set of terse test summaries (which only includes summaries for tests with non-zero `maxDiff`
|
|
@@ -1428,25 +1732,18 @@ declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[
|
|
|
1428
1732
|
*
|
|
1429
1733
|
* @param comparisonConfig The comparison configuration.
|
|
1430
1734
|
* @param terseSummaries The set of terse test summaries.
|
|
1735
|
+
* @param sortMode The sort mode to determine which field to use for scoring.
|
|
1431
1736
|
*/
|
|
1432
|
-
declare function categorizeComparisonTestSummaries(comparisonConfig: ComparisonConfig, terseSummaries: ComparisonTestSummary[]): ComparisonCategorizedResults;
|
|
1737
|
+
declare function categorizeComparisonTestSummaries(comparisonConfig: ComparisonConfig, terseSummaries: ComparisonTestSummary[], sortMode: ComparisonSortMode): ComparisonCategorizedResults;
|
|
1433
1738
|
|
|
1434
1739
|
/**
|
|
1435
|
-
* Additional options that are passed to `getConfigOptions`.
|
|
1436
|
-
* the `ConfigOptions`, for example, if the `simplifyScenarios` flag is true, a reduced set
|
|
1437
|
-
* of tests can be provided in the `ConfigOptions` so that the tests run faster in a local
|
|
1438
|
-
* development situation.
|
|
1740
|
+
* Additional options that are passed to `getConfigOptions`.
|
|
1439
1741
|
*/
|
|
1440
1742
|
interface ConfigInitOptions {
|
|
1441
1743
|
/** If defined, overrides the displayed name of the baseline ("left") bundle. */
|
|
1442
1744
|
bundleNameL?: string;
|
|
1443
1745
|
/** If defined, overrides the displayed name of the current ("right") bundle. */
|
|
1444
1746
|
bundleNameR?: string;
|
|
1445
|
-
/**
|
|
1446
|
-
* A hint that the user wants tests to run faster. If true, you can return a
|
|
1447
|
-
* configuration that runs a smaller subset of tests than normal.
|
|
1448
|
-
*/
|
|
1449
|
-
simplifyScenarios?: boolean;
|
|
1450
1747
|
}
|
|
1451
1748
|
/**
|
|
1452
1749
|
* The user-specified options used by the library to resolve and initialize a `Config` instance.
|
|
@@ -1465,6 +1762,21 @@ interface ConfigOptions {
|
|
|
1465
1762
|
* The model comparison options.
|
|
1466
1763
|
*/
|
|
1467
1764
|
comparison?: ComparisonOptions;
|
|
1765
|
+
/**
|
|
1766
|
+
* The number of model instances to initialize for each bundle.
|
|
1767
|
+
*
|
|
1768
|
+
* If undefined, the default behavior will be used, which is to initialize a single
|
|
1769
|
+
* model instance for each bundle.
|
|
1770
|
+
*
|
|
1771
|
+
* If you set this to a value greater than 1, it will allow multiple pairs of model
|
|
1772
|
+
* instances to be run concurrently. For example, if the number of CPU cores is 8,
|
|
1773
|
+
* setting this to 4 will allow 4 pairs of model instances to be run concurrently,
|
|
1774
|
+
* using all available cores.
|
|
1775
|
+
*
|
|
1776
|
+
* If you set this to 0, the implementation will automatically choose a value based on
|
|
1777
|
+
* the number of available CPU cores (i.e., the number of cores divided by 2).
|
|
1778
|
+
*/
|
|
1779
|
+
concurrency?: number;
|
|
1468
1780
|
}
|
|
1469
1781
|
/**
|
|
1470
1782
|
* The resolved configuration for check and comparison tests.
|
|
@@ -1478,22 +1790,89 @@ interface Config {
|
|
|
1478
1790
|
|
|
1479
1791
|
declare function createConfig(options: ConfigOptions): Promise<Config>;
|
|
1480
1792
|
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
readonly bundleModelR: BundleModel;
|
|
1484
|
-
private readonly mode;
|
|
1485
|
-
private readonly taskQueue;
|
|
1793
|
+
type CancelRunPerf = () => void;
|
|
1794
|
+
interface RunPerfCallbacks {
|
|
1486
1795
|
onComplete?: (reportL: PerfReport, reportR: PerfReport) => void;
|
|
1487
1796
|
onError?: (error: Error) => void;
|
|
1488
|
-
constructor(bundleModelL: BundleModel, bundleModelR: BundleModel, mode?: 'serial' | 'parallel');
|
|
1489
|
-
start(): void;
|
|
1490
1797
|
}
|
|
1798
|
+
interface RunPerfOptions {
|
|
1799
|
+
/** The mode to run the performance tests (default is 'serial'). */
|
|
1800
|
+
mode?: 'serial' | 'parallel';
|
|
1801
|
+
/** The number of warmups for each perf run (default is 5). */
|
|
1802
|
+
warmupCount?: number;
|
|
1803
|
+
/** The number of times to run the model for each perf run (default is 100). */
|
|
1804
|
+
runCount?: number;
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Run performance tests on the bundle models.
|
|
1808
|
+
*
|
|
1809
|
+
* @param callbacks The callbacks that will be notified.
|
|
1810
|
+
* @param options The options for the performance run.
|
|
1811
|
+
* @return A function that will cancel the process when invoked.
|
|
1812
|
+
*/
|
|
1813
|
+
declare function runPerf(callbacks: RunPerfCallbacks, options?: RunPerfOptions): CancelRunPerf;
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* The report for a single trace comparison between two datasets.
|
|
1817
|
+
*
|
|
1818
|
+
* TODO: This is basically the same as `DiffReport`, except that it preserves the
|
|
1819
|
+
* diff points. Maybe we can combine them and make the points array an opt-in thing.
|
|
1820
|
+
*/
|
|
1821
|
+
interface TraceDatasetReport {
|
|
1822
|
+
datasetKey: DatasetKey;
|
|
1823
|
+
validity: DiffValidity;
|
|
1824
|
+
points: Map<number, DiffPoint>;
|
|
1825
|
+
minValue: number;
|
|
1826
|
+
maxValue: number;
|
|
1827
|
+
avgDiff: number;
|
|
1828
|
+
minDiff: number;
|
|
1829
|
+
maxDiff: number;
|
|
1830
|
+
maxDiffPoint: DiffPoint;
|
|
1831
|
+
}
|
|
1832
|
+
/**
|
|
1833
|
+
* The roll-up report that contains the results of the trace comparisons
|
|
1834
|
+
* for all datasets.
|
|
1835
|
+
*/
|
|
1836
|
+
interface TraceReport {
|
|
1837
|
+
datasetReports: Map<DatasetKey, TraceDatasetReport>;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
type CancelRunTrace = () => void;
|
|
1841
|
+
interface RunTraceCallbacks {
|
|
1842
|
+
onComplete?: (traceReport: TraceReport) => void;
|
|
1843
|
+
onError?: (error: Error) => void;
|
|
1844
|
+
}
|
|
1845
|
+
interface TraceCompareToBundleOptions {
|
|
1846
|
+
kind: 'compare-to-bundle';
|
|
1847
|
+
bundleSide0: 'left' | 'right';
|
|
1848
|
+
scenarioSpec0: ScenarioSpec;
|
|
1849
|
+
bundleSide1: 'left' | 'right';
|
|
1850
|
+
scenarioSpec1: ScenarioSpec;
|
|
1851
|
+
}
|
|
1852
|
+
interface TraceCompareToExtDataOptions {
|
|
1853
|
+
kind: 'compare-to-ext-data';
|
|
1854
|
+
extData: DatasetMap;
|
|
1855
|
+
bundleSide: 'left' | 'right';
|
|
1856
|
+
scenarioSpec: ScenarioSpec;
|
|
1857
|
+
}
|
|
1858
|
+
type TraceOptions = TraceCompareToBundleOptions | TraceCompareToExtDataOptions;
|
|
1859
|
+
/**
|
|
1860
|
+
* Perform a trace run, comparing all datasets from the requested models.
|
|
1861
|
+
*
|
|
1862
|
+
* @param modelSpec The model spec that provides the datasets to be compared (usually from the "right" bundle).
|
|
1863
|
+
* @param callbacks The callbacks that will be notified.
|
|
1864
|
+
* @param options Options to control how the trace is run.
|
|
1865
|
+
* @return A function that will cancel the process when invoked.
|
|
1866
|
+
*/
|
|
1867
|
+
declare function runTrace(modelSpec: ModelSpec, callbacks: RunTraceCallbacks, options: TraceOptions): CancelRunTrace;
|
|
1491
1868
|
|
|
1492
1869
|
/**
|
|
1493
1870
|
* The report for a single run of the full check+comparison test suite.
|
|
1494
1871
|
*/
|
|
1495
1872
|
interface SuiteReport {
|
|
1873
|
+
/** The check report. */
|
|
1496
1874
|
checkReport: CheckReport;
|
|
1875
|
+
/** The comparison report (only defined if comparisons were enabled). */
|
|
1497
1876
|
comparisonReport?: ComparisonReport;
|
|
1498
1877
|
}
|
|
1499
1878
|
/**
|
|
@@ -1504,7 +1883,13 @@ interface SuiteReport {
|
|
|
1504
1883
|
* when there are many reported differences.
|
|
1505
1884
|
*/
|
|
1506
1885
|
interface SuiteSummary {
|
|
1886
|
+
/** The date and time the suite was run (in ISO 8601 format, as generated by `Date.toISOString`). */
|
|
1887
|
+
date: string;
|
|
1888
|
+
/** The time in milliseconds that it took to run the suite. */
|
|
1889
|
+
elapsed: number;
|
|
1890
|
+
/** The check summary. */
|
|
1507
1891
|
checkSummary: CheckSummary;
|
|
1892
|
+
/** The comparison summary (only defined if comparisons were enabled). */
|
|
1508
1893
|
comparisonSummary?: ComparisonSummary;
|
|
1509
1894
|
}
|
|
1510
1895
|
|
|
@@ -1515,8 +1900,16 @@ interface RunSuiteCallbacks {
|
|
|
1515
1900
|
onError?: (error: Error) => void;
|
|
1516
1901
|
}
|
|
1517
1902
|
interface RunSuiteOptions {
|
|
1518
|
-
/**
|
|
1519
|
-
|
|
1903
|
+
/**
|
|
1904
|
+
* The check tests to skip. Note that checks are matched by group and name
|
|
1905
|
+
* (case insensitive).
|
|
1906
|
+
*/
|
|
1907
|
+
skipChecks?: CheckNameSpec[];
|
|
1908
|
+
/**
|
|
1909
|
+
* The comparison scenarios to skip. Note that scenarios are matched by
|
|
1910
|
+
* title and subtitle (case insensitive).
|
|
1911
|
+
*/
|
|
1912
|
+
skipComparisonScenarios?: ComparisonScenarioTitleSpec[];
|
|
1520
1913
|
}
|
|
1521
1914
|
/**
|
|
1522
1915
|
* Run the full suite of checks and comparisons defined in the given configuration.
|
|
@@ -1533,8 +1926,9 @@ declare function runSuite(config: Config, callbacks: RunSuiteCallbacks, options?
|
|
|
1533
1926
|
* failed/errored checks or comparisons with differences.
|
|
1534
1927
|
*
|
|
1535
1928
|
* @param suiteReport The full suite report.
|
|
1929
|
+
* @param elapsedMillis The time in milliseconds that it took to run the suite.
|
|
1536
1930
|
* @return The converted suite summary.
|
|
1537
1931
|
*/
|
|
1538
|
-
declare function suiteSummaryFromReport(suiteReport: SuiteReport): SuiteSummary;
|
|
1932
|
+
declare function suiteSummaryFromReport(suiteReport: SuiteReport, elapsedMillis: number): SuiteSummary;
|
|
1539
1933
|
|
|
1540
|
-
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 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 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
|
|
1934
|
+
export { type AllInputsSpec, type Bundle, type BundleGraphData, type BundleGraphDatasetSpec, type BundleGraphId, type BundleGraphSpec, type BundleGraphView, 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 };
|