@sdeverywhere/check-core 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- declare type SourceName = string;
2
- declare type VarId = string;
3
- declare type DatasetKey = string;
4
- declare type Dataset = Map<number, number>;
5
- declare type DatasetMap = Map<DatasetKey, Dataset>;
1
+ type SourceName = string;
2
+ type VarId = string;
3
+ type DatasetKey = string;
4
+ type Dataset = Map<number, number>;
5
+ type DatasetMap = Map<DatasetKey, Dataset>;
6
6
 
7
7
  /** A unique identifier for the scenario, derived from its input settings. */
8
- declare type ScenarioSpecUid = string;
9
- declare type InputPosition = 'at-default' | 'at-minimum' | 'at-maximum';
8
+ type ScenarioSpecUid = string;
9
+ type InputPosition = 'at-default' | 'at-minimum' | 'at-maximum';
10
10
  interface PositionSetting {
11
11
  kind: 'position';
12
12
  inputVarId: VarId;
@@ -17,7 +17,7 @@ interface ValueSetting {
17
17
  inputVarId: VarId;
18
18
  value: number;
19
19
  }
20
- declare type InputSetting = PositionSetting | ValueSetting;
20
+ type InputSetting = PositionSetting | ValueSetting;
21
21
  interface InputSettingsSpec {
22
22
  kind: 'input-settings';
23
23
  uid: ScenarioSpecUid;
@@ -28,7 +28,7 @@ interface AllInputsSpec {
28
28
  uid: ScenarioSpecUid;
29
29
  position: InputPosition;
30
30
  }
31
- declare type ScenarioSpec = InputSettingsSpec | AllInputsSpec;
31
+ type ScenarioSpec = InputSettingsSpec | AllInputsSpec;
32
32
 
33
33
  interface DatasetsResult {
34
34
  /**
@@ -56,7 +56,7 @@ interface RelatedItem {
56
56
  locationPath: string[];
57
57
  }
58
58
  /** A unique, stable input identifier. */
59
- declare type InputId = string;
59
+ type InputId = string;
60
60
  /**
61
61
  * Holds information about an input variable used in the model.
62
62
  */
@@ -145,6 +145,12 @@ interface ImplVar {
145
145
  varType: string;
146
146
  }
147
147
 
148
+ /** The human-readable name for a group of inputs. */
149
+ type InputGroupName = string;
150
+ /** The alias name for an input. */
151
+ type InputAliasName = string;
152
+ /** The human-readable name for a group of dataset. */
153
+ type DatasetGroupName = string;
148
154
  /**
149
155
  * Includes the properties needed to display a legend item in the UI.
150
156
  */
@@ -165,7 +171,8 @@ interface LinkItem {
165
171
  /** The link content (a URL or text). */
166
172
  content: string;
167
173
  }
168
- declare type BundleGraphId = string;
174
+ /** The identifier for a bundle-specific graph. */
175
+ type BundleGraphId = string;
169
176
  /**
170
177
  * Describes a dataset in a bundle-specific graph.
171
178
  */
@@ -225,11 +232,11 @@ interface ModelSpec {
225
232
  /** The map of all variables (both internal and exported) in this version of the model. */
226
233
  implVars: Map<DatasetKey, ImplVar>;
227
234
  /** The custom input variable aliases defined for this model. */
228
- inputAliases?: Map<string, VarId>;
235
+ inputAliases?: Map<InputAliasName, VarId>;
229
236
  /** The custom input variable groups defined for this model. */
230
- inputGroups?: Map<string, InputVar[]>;
237
+ inputGroups?: Map<InputGroupName, InputVar[]>;
231
238
  /** The custom dataset (output variable) groups defined for this model. */
232
- datasetGroups?: Map<string, DatasetKey[]>;
239
+ datasetGroups?: Map<DatasetGroupName, DatasetKey[]>;
233
240
  /** The start time (year) for the model. */
234
241
  startTime?: number;
235
242
  /** The end time (year) for the model. */
@@ -289,7 +296,7 @@ interface LoadedBundle {
289
296
  model: BundleModel;
290
297
  }
291
298
 
292
- declare type CheckDataRequestKey = string;
299
+ type CheckDataRequestKey = string;
293
300
  /**
294
301
  * Coordinates on-demand loading of data used to display a graph representation
295
302
  * of a check/predicate.
@@ -302,17 +309,17 @@ declare class CheckDataCoordinator {
302
309
  cancelRequest(key: CheckDataRequestKey): void;
303
310
  }
304
311
 
305
- declare type CheckPredicateOp = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'approx';
312
+ type CheckPredicateOp = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'approx';
306
313
 
307
- declare type CheckPredicateTimeSingle = number;
308
- declare type CheckPredicateTimeRange = [number, number];
314
+ type CheckPredicateTimeSingle = number;
315
+ type CheckPredicateTimeRange = [number, number];
309
316
  interface CheckPredicateTimeOptions {
310
317
  after_excl?: number;
311
318
  after_incl?: number;
312
319
  before_excl?: number;
313
320
  before_incl?: number;
314
321
  }
315
- declare type CheckPredicateTimeSpec = CheckPredicateTimeSingle | CheckPredicateTimeRange | CheckPredicateTimeOptions;
322
+ type CheckPredicateTimeSpec = CheckPredicateTimeSingle | CheckPredicateTimeRange | CheckPredicateTimeOptions;
316
323
 
317
324
  interface CheckResultErrorInfo {
318
325
  kind: 'unknown-dataset' | 'unknown-input' | 'unknown-input-group' | 'empty-input-group';
@@ -328,7 +335,7 @@ interface CheckResult {
328
335
  errorInfo?: CheckResultErrorInfo;
329
336
  }
330
337
 
331
- declare type CheckDatasetError = 'no-matches-for-dataset' | 'no-matches-for-group' | 'no-matches-for-type';
338
+ type CheckDatasetError = 'no-matches-for-dataset' | 'no-matches-for-group' | 'no-matches-for-type';
332
339
  interface CheckDataset {
333
340
  /** The key for the matched dataset; can be undefined if no dataset matched. */
334
341
  datasetKey?: DatasetKey;
@@ -367,7 +374,7 @@ interface CheckScenario {
367
374
  /**
368
375
  * The key type for data references (in the form `<ScenarioUid::DatasetKey>`).
369
376
  */
370
- declare type CheckDataRefKey = string;
377
+ type CheckDataRefKey = string;
371
378
  /**
372
379
  * The scenario and dataset referenced by a particular predicate (for cases
373
380
  * where the check is against another dataset rather than a constant value).
@@ -381,9 +388,9 @@ interface CheckDataRef {
381
388
  dataset: CheckDataset;
382
389
  }
383
390
 
384
- declare type CheckKey = number;
391
+ type CheckKey = number;
385
392
 
386
- declare type CheckStatus = 'passed' | 'failed' | 'error';
393
+ type CheckStatus = 'passed' | 'failed' | 'error';
387
394
  interface CheckPredicateOpConstantRef {
388
395
  kind: 'constant';
389
396
  value: number;
@@ -392,7 +399,7 @@ interface CheckPredicateOpDataRef {
392
399
  kind: 'data';
393
400
  dataRef: CheckDataRef;
394
401
  }
395
- declare type CheckPredicateOpRef = CheckPredicateOpConstantRef | CheckPredicateOpDataRef;
402
+ type CheckPredicateOpRef = CheckPredicateOpConstantRef | CheckPredicateOpDataRef;
396
403
  interface CheckPredicateReport {
397
404
  checkKey: CheckKey;
398
405
  result: CheckResult;
@@ -423,7 +430,7 @@ interface CheckGroupReport {
423
430
  interface CheckReport {
424
431
  groups: CheckGroupReport[];
425
432
  }
426
- declare type StyleFunc = (s: string) => string;
433
+ type StyleFunc = (s: string) => string;
427
434
  /**
428
435
  * Return a string representation of the given scenario.
429
436
  *
@@ -492,11 +499,26 @@ declare function checkSummaryFromReport(checkReport: CheckReport): CheckSummary;
492
499
  */
493
500
  declare function checkReportFromSummary(checkConfig: CheckConfig, checkSummary: CheckSummary): CheckReport | undefined;
494
501
 
495
- declare type ComparisonScenarioId = string;
496
- declare type ComparisonScenarioTitle = string;
497
- declare type ComparisonScenarioSubtitle = string;
498
- declare type ComparisonScenarioInputName = string;
499
- declare type ComparisonScenarioInputPosition = 'default' | 'min' | 'max';
502
+ type ComparisonDatasetName = string;
503
+ type ComparisonDatasetSource = string;
504
+ /**
505
+ * Specifies a dataset (variable) used for comparison.
506
+ */
507
+ interface ComparisonDatasetSpec {
508
+ kind: 'dataset';
509
+ /** The name of the dataset (variable). */
510
+ name: ComparisonDatasetName;
511
+ /**
512
+ * The source of the dataset, if it is from an external data file. If
513
+ * undefined, the dataset is assumed to be a model output.
514
+ */
515
+ source?: ComparisonDatasetSource;
516
+ }
517
+ type ComparisonScenarioId = string;
518
+ type ComparisonScenarioTitle = string;
519
+ type ComparisonScenarioSubtitle = string;
520
+ type ComparisonScenarioInputName = string;
521
+ type ComparisonScenarioInputPosition = 'default' | 'min' | 'max';
500
522
  /**
501
523
  * Specifies an input that is set to a specific position (default / min / max).
502
524
  */
@@ -521,7 +543,7 @@ interface ComparisonScenarioInputAtValueSpec {
521
543
  * A single input setting for a scenario. An input can be set to a specific number value,
522
544
  * or it can be set to a "position" (default / min / max).
523
545
  */
524
- declare type ComparisonScenarioInputSpec = ComparisonScenarioInputAtPositionSpec | ComparisonScenarioInputAtValueSpec;
546
+ type ComparisonScenarioInputSpec = ComparisonScenarioInputAtPositionSpec | ComparisonScenarioInputAtValueSpec;
525
547
  /**
526
548
  * Specifies a single scenario that sets one or more inputs to a value/position.
527
549
  */
@@ -536,6 +558,23 @@ interface ComparisonScenarioWithInputsSpec {
536
558
  /** The input settings for this scenario. */
537
559
  inputs: ComparisonScenarioInputSpec[];
538
560
  }
561
+ /**
562
+ * Specifies a single scenario that configures inputs differently for the two
563
+ * model instances.
564
+ */
565
+ interface ComparisonScenarioWithDistinctInputsSpec {
566
+ kind: 'scenario-with-distinct-inputs';
567
+ /** The unique identifier for the scenario. */
568
+ id?: ComparisonScenarioId;
569
+ /** The title of the scenario. */
570
+ title?: ComparisonScenarioTitle;
571
+ /** The subtitle of the scenario. */
572
+ subtitle?: ComparisonScenarioSubtitle;
573
+ /** The input settings for this scenario when run with the "left" model. */
574
+ inputsL: ComparisonScenarioInputSpec[];
575
+ /** The input settings for this scenario when run with the "right" model. */
576
+ inputsR: ComparisonScenarioInputSpec[];
577
+ }
539
578
  /**
540
579
  * Specifies a single scenario that sets all available inputs to position.
541
580
  */
@@ -564,7 +603,7 @@ interface ComparisonScenarioPresetMatrixSpec {
564
603
  * A definition of input scenario(s). A scenario can set one input to a value/position, or it
565
604
  * can set multiple inputs to particular values/positions.
566
605
  */
567
- declare type ComparisonScenarioSpec = ComparisonScenarioWithInputsSpec | ComparisonScenarioWithAllInputsSpec | ComparisonScenarioPresetMatrixSpec;
606
+ type ComparisonScenarioSpec = ComparisonScenarioWithInputsSpec | ComparisonScenarioWithDistinctInputsSpec | ComparisonScenarioWithAllInputsSpec | ComparisonScenarioPresetMatrixSpec;
568
607
  /** A reference to a scenario definition. */
569
608
  interface ComparisonScenarioRefSpec {
570
609
  kind: 'scenario-ref';
@@ -575,8 +614,8 @@ interface ComparisonScenarioRefSpec {
575
614
  /** The optional subtitle that is used instead of the referenced scenario's subtitle. */
576
615
  subtitle?: ComparisonScenarioSubtitle;
577
616
  }
578
- declare type ComparisonScenarioGroupId = string;
579
- declare type ComparisonScenarioGroupTitle = string;
617
+ type ComparisonScenarioGroupId = string;
618
+ type ComparisonScenarioGroupTitle = string;
580
619
  /**
581
620
  * A definition of a group of input scenarios. Multiple scenarios can be grouped together under a single name, and
582
621
  * can later be referenced by group ID in a view definition.
@@ -596,44 +635,101 @@ interface ComparisonScenarioGroupRefSpec {
596
635
  /** The ID of the scenario group that is referenced. */
597
636
  groupId: ComparisonScenarioGroupId;
598
637
  }
599
- declare type ComparisonViewTitle = string;
600
- declare type ComparisonViewSubtitle = string;
601
- declare type ComparisonViewGraphId = string;
638
+ type ComparisonGraphId = string;
602
639
  /**
603
640
  * Specifies a list of graphs to be shown in a view.
604
641
  */
605
- interface ComparisonViewGraphsArraySpec {
642
+ interface ComparisonGraphsArraySpec {
606
643
  kind: 'graphs-array';
607
644
  /** The array of IDs for graphs to show. */
608
- graphIds: ComparisonViewGraphId[];
645
+ graphIds: ComparisonGraphId[];
609
646
  }
610
647
  /**
611
648
  * Specifies a preset list of graphs to be shown in a view.
612
649
  */
613
- interface ComparisonViewGraphsPresetSpec {
650
+ interface ComparisonGraphsPresetSpec {
614
651
  kind: 'graphs-preset';
615
652
  /** The preset (currently only "all" is supported, which shows all available graphs). */
616
653
  preset: 'all';
617
654
  }
655
+ type ComparisonGraphGroupId = string;
656
+ /**
657
+ * A definition of a group of graphs to be shown in a view. Multiple graphs can be grouped together
658
+ * under a single ID, and can later be referenced by group ID in a view definition.
659
+ */
660
+ interface ComparisonGraphGroupSpec {
661
+ kind: 'graph-group';
662
+ /** The unique identifier for the group. */
663
+ id: ComparisonGraphGroupId;
664
+ /** The graphs that are included in this group. */
665
+ graphIds: ComparisonGraphId[];
666
+ }
667
+ /** A reference to a graph group definition. */
668
+ interface ComparisonGraphGroupRefSpec {
669
+ kind: 'graph-group-ref';
670
+ /** The ID of the graph group that is referenced. */
671
+ groupId: ComparisonGraphGroupId;
672
+ }
673
+ type ComparisonViewTitle = string;
674
+ type ComparisonViewSubtitle = string;
675
+ type ComparisonViewRowTitle = string;
676
+ type ComparisonViewRowSubtitle = string;
677
+ type ComparisonViewItemTitle = string;
678
+ type ComparisonViewItemSubtitle = string;
679
+ type ComparisonViewGraphOrder = 'default' | 'grouped-by-diffs';
680
+ /**
681
+ * Specifies a single comparison box to be shown in a view.
682
+ */
683
+ interface ComparisonViewBoxSpec {
684
+ kind: 'view-box';
685
+ /** The title of the box. */
686
+ title: ComparisonViewItemTitle;
687
+ /** The subtitle of the box. */
688
+ subtitle?: ComparisonViewItemSubtitle;
689
+ /** The dataset shown in this comparison box. */
690
+ dataset: ComparisonDatasetSpec;
691
+ /** The scenario shown in this comparison box. */
692
+ scenarioId: ComparisonScenarioId;
693
+ }
694
+ /**
695
+ * Specifies a row of comparison boxes to be shown in a view.
696
+ */
697
+ interface ComparisonViewRowSpec {
698
+ kind: 'view-row';
699
+ /** The title of the row. */
700
+ title: ComparisonViewRowTitle;
701
+ /** The subtitle of the row. */
702
+ subtitle?: ComparisonViewRowSubtitle;
703
+ /** The array of boxes to be shown in the row. */
704
+ boxes: ComparisonViewBoxSpec[];
705
+ }
618
706
  /**
619
707
  * Specifies a set of graphs to be shown in a view.
620
708
  */
621
- declare type ComparisonViewGraphsSpec = ComparisonViewGraphsArraySpec | ComparisonViewGraphsPresetSpec;
709
+ type ComparisonViewGraphsSpec = ComparisonGraphsPresetSpec | ComparisonGraphsArraySpec | ComparisonGraphGroupRefSpec;
622
710
  /**
623
- * A definition of a view. A view presents a set of graphs for a single input scenario.
711
+ * A definition of a view. A view presents a set of graphs, either for a single input scenario
712
+ * or for a mix of different dataset/scenario combinations.
624
713
  */
625
714
  interface ComparisonViewSpec {
626
715
  kind: 'view';
627
716
  /** The title of the view. If undefined, the title will be inferred from the scenario. */
628
717
  title?: ComparisonViewTitle;
629
718
  /** The subtitle of the view. If undefined, the subtitle will be inferred from the scenario. */
630
- subtitle?: ComparisonViewGroupTitle;
631
- /** The scenario to be shown in the view. */
632
- scenarioId: ComparisonScenarioId;
633
- /** The graphs to be shown for each scenario view. */
634
- graphs: ComparisonViewGraphsSpec;
719
+ subtitle?: ComparisonViewSubtitle;
720
+ /** The scenario to be shown in the view if this is a single-scenario view. */
721
+ scenarioId?: ComparisonScenarioId;
722
+ /** The array of rows to be shown in the view if this is a freeform view. */
723
+ rows?: ComparisonViewRowSpec[];
724
+ /** The graphs to be shown in the view. */
725
+ graphs?: ComparisonViewGraphsSpec;
726
+ /**
727
+ * The order in which the graphs will be displayed. If undefined, the graphs will be
728
+ * displayed in the "default" order, i.e., in the same order that the IDs were specified.
729
+ */
730
+ graphOrder?: ComparisonViewGraphOrder;
635
731
  }
636
- declare type ComparisonViewGroupTitle = string;
732
+ type ComparisonViewGroupTitle = string;
637
733
  /**
638
734
  * Specifies a view group with an explicit array of view definitions.
639
735
  */
@@ -656,23 +752,30 @@ interface ComparisonViewGroupWithScenariosSpec {
656
752
  scenarios: (ComparisonScenarioRefSpec | ComparisonScenarioGroupRefSpec)[];
657
753
  /** The graphs to be shown for each scenario view. */
658
754
  graphs: ComparisonViewGraphsSpec;
755
+ /**
756
+ * The order in which the graphs will be displayed. If undefined, the graphs will be
757
+ * displayed in the "default" order, i.e., in the same order that the IDs were specified.
758
+ */
759
+ graphOrder?: ComparisonViewGraphOrder;
659
760
  }
660
761
  /**
661
762
  * A definition of a group of views. Multiple related views can be grouped together under a single title
662
763
  * to make them easy to distinguish in a report.
663
764
  */
664
- declare type ComparisonViewGroupSpec = ComparisonViewGroupWithViewsSpec | ComparisonViewGroupWithScenariosSpec;
765
+ type ComparisonViewGroupSpec = ComparisonViewGroupWithViewsSpec | ComparisonViewGroupWithScenariosSpec;
665
766
  /**
666
767
  * Contains the scenario and view definitions from one or more sources (JSON/YAML files or manually
667
768
  * defined specs).
668
769
  */
669
770
  interface ComparisonSpecs {
670
771
  /** The requested scenarios. */
671
- scenarios: ComparisonScenarioSpec[];
772
+ scenarios?: ComparisonScenarioSpec[];
672
773
  /** The requested scenario groups. */
673
- scenarioGroups: ComparisonScenarioGroupSpec[];
774
+ scenarioGroups?: ComparisonScenarioGroupSpec[];
775
+ /** The requested graph groups. */
776
+ graphGroups?: ComparisonGraphGroupSpec[];
674
777
  /** The requested view groups. */
675
- viewGroups: ComparisonViewGroupSpec[];
778
+ viewGroups?: ComparisonViewGroupSpec[];
676
779
  }
677
780
  /** A source of comparison scenario and specifications. */
678
781
  interface ComparisonSpecsSource {
@@ -700,7 +803,7 @@ interface ComparisonDataset {
700
803
  outputVarR?: OutputVar;
701
804
  }
702
805
  /** A unique key for a `ComparisonScenario`, generated internally for use by the library. */
703
- declare type ComparisonScenarioKey = string & {
806
+ type ComparisonScenarioKey = string & {
704
807
  _brand?: 'ComparisonScenarioKey';
705
808
  };
706
809
  interface ComparisonResolverUnknownInputError {
@@ -709,7 +812,7 @@ interface ComparisonResolverUnknownInputError {
709
812
  interface ComparisonResolverInvalidValueError {
710
813
  kind: 'invalid-value';
711
814
  }
712
- declare type ComparisonResolverError = ComparisonResolverUnknownInputError | ComparisonResolverInvalidValueError;
815
+ type ComparisonResolverError = ComparisonResolverUnknownInputError | ComparisonResolverInvalidValueError;
713
816
  /** Describes the resolution state for a scenario input relative to a specific model. */
714
817
  interface ComparisonScenarioInputState {
715
818
  /** The matched input variable; can be undefined if no input matched. */
@@ -746,7 +849,7 @@ interface ComparisonScenarioAllInputsSettings {
746
849
  * The configuration for an input scenario, either a set of individual input settings, or one
747
850
  * that sets all inputs in the model to a certain position.
748
851
  */
749
- declare type ComparisonScenarioSettings = ComparisonScenarioInputSettings | ComparisonScenarioAllInputsSettings;
852
+ type ComparisonScenarioSettings = ComparisonScenarioInputSettings | ComparisonScenarioAllInputsSettings;
750
853
  /** A single resolved input scenario. */
751
854
  interface ComparisonScenario {
752
855
  kind: 'scenario';
@@ -779,7 +882,7 @@ interface ComparisonScenarioGroup {
779
882
  /** The title of the group. */
780
883
  title: ComparisonScenarioGroupTitle;
781
884
  /**
782
- * The scenarios that are included in this group. This includes scenario that were successfully
885
+ * The scenarios that are included in this group. This includes scenarios that were successfully
783
886
  * resolved as well as scenario references that could not be resolved.
784
887
  */
785
888
  scenarios: (ComparisonScenario | ComparisonUnresolvedScenarioRef)[];
@@ -790,17 +893,58 @@ interface ComparisonUnresolvedScenarioGroupRef {
790
893
  /** The ID of the referenced scenario group that could not be resolved. */
791
894
  scenarioGroupId: ComparisonScenarioGroupId;
792
895
  }
793
- /** A resolved view definition. A view presents a set of graphs for a single input scenario. */
896
+ /** A resolved group of graphs. */
897
+ interface ComparisonGraphGroup {
898
+ kind: 'graph-group';
899
+ /** The unique identifier for the group. */
900
+ id: ComparisonScenarioGroupId;
901
+ /** The graphs that are included in this group. */
902
+ graphIds: ComparisonGraphId[];
903
+ }
904
+ /**
905
+ * A resolved comparison box to be shown in a view.
906
+ */
907
+ interface ComparisonViewBox {
908
+ kind: 'view-box';
909
+ /** The title of the box. */
910
+ title: ComparisonViewItemTitle;
911
+ /** The subtitle of the box. */
912
+ subtitle?: ComparisonViewItemSubtitle;
913
+ /** The resolved dataset shown in this comparison box. */
914
+ dataset: ComparisonDataset;
915
+ /** The resolved scenario shown in this comparison box. */
916
+ scenario: ComparisonScenario;
917
+ }
918
+ /**
919
+ * A resolved row of comparison boxes to be shown in a view.
920
+ */
921
+ interface ComparisonViewRow {
922
+ kind: 'view-row';
923
+ /** The title of the row. */
924
+ title: ComparisonViewRowTitle;
925
+ /** The subtitle of the row. */
926
+ subtitle?: ComparisonViewRowSubtitle;
927
+ /** The array of resolved boxes to be shown in the row. */
928
+ boxes: ComparisonViewBox[];
929
+ }
930
+ /**
931
+ * A resolved view definition. A view presents a set of graphs, either for a single input scenario
932
+ * or for a mix of different dataset/scenario combinations.
933
+ */
794
934
  interface ComparisonView {
795
935
  kind: 'view';
796
936
  /** The title of the view. */
797
937
  title: ComparisonViewTitle;
798
938
  /** The subtitle of the view. */
799
939
  subtitle?: ComparisonViewSubtitle;
800
- /** The resolved scenario to be shown in the view. */
801
- scenario: ComparisonScenario;
940
+ /** The resolved scenario to be shown in the view if this is a single-scenario view. */
941
+ scenario?: ComparisonScenario;
942
+ /** The array of resolved rows to be shown in the view if this is a freeform view. */
943
+ rows?: ComparisonViewRow[];
802
944
  /** The graphs to be shown for each scenario view. */
803
- graphs: 'all' | ComparisonViewGraphId[];
945
+ graphIds: ComparisonGraphId[];
946
+ /** The order in which the graphs will be displayed. */
947
+ graphOrder: ComparisonViewGraphOrder;
804
948
  }
805
949
  /** An unresolved view. */
806
950
  interface ComparisonUnresolvedView {
@@ -809,6 +953,10 @@ interface ComparisonUnresolvedView {
809
953
  title?: ComparisonViewTitle;
810
954
  /** The requested subtitle of the view, if provided. */
811
955
  subtitle?: ComparisonViewSubtitle;
956
+ /** The name of the referenced dataset that could not be resolved. */
957
+ datasetName?: ComparisonDatasetName;
958
+ /** The source of the referenced dataset that could not be resolved. */
959
+ datasetSource?: ComparisonDatasetSource;
812
960
  /** The ID of the referenced scenario that could not be resolved. */
813
961
  scenarioId?: ComparisonScenarioId;
814
962
  /** The ID of the referenced scenario group that could not be resolved. */
@@ -844,6 +992,21 @@ interface ComparisonDatasets {
844
992
  * @param scenario The scenario definition.
845
993
  */
846
994
  getDatasetKeysForScenario(scenario: ComparisonScenario): DatasetKey[];
995
+ /**
996
+ * Return the reference plots that should be shown in the comparison graph for the
997
+ * given dataset and scenario.
998
+ *
999
+ * @param datasetKey The key for the dataset.
1000
+ * @param scenario The scenario for which the dataset will be displayed.
1001
+ */
1002
+ getReferencePlotsForDataset(datasetKey: DatasetKey, scenario: ComparisonScenario): ComparisonPlot[];
1003
+ /**
1004
+ * Return the context graph IDs that should be shown for the given dataset and scenario.
1005
+ *
1006
+ * @param datasetKey The key for the dataset.
1007
+ * @param scenario The scenario for which the dataset will be displayed.
1008
+ */
1009
+ getContextGraphIdsForDataset(datasetKey: DatasetKey, scenario: ComparisonScenario): BundleGraphId[];
847
1010
  }
848
1011
 
849
1012
  interface ComparisonScenarios {
@@ -859,6 +1022,19 @@ interface ComparisonScenarios {
859
1022
  getScenario(key: ComparisonScenarioKey): ComparisonScenario | undefined;
860
1023
  }
861
1024
 
1025
+ /**
1026
+ * Describes an extra plot to be shown in a comparison graph.
1027
+ */
1028
+ interface ComparisonPlot {
1029
+ /** The dataset key for the plot. */
1030
+ datasetKey: DatasetKey;
1031
+ /** The plot color. */
1032
+ color: string;
1033
+ /** The plot style. If undefined, defaults to 'normal'. */
1034
+ style?: 'normal' | 'dashed';
1035
+ /** The plot line width, in px units. If undefined, a default width will be used. */
1036
+ lineWidth?: number;
1037
+ }
862
1038
  interface ComparisonDatasetOptions {
863
1039
  /**
864
1040
  * The mapping of renamed dataset keys (old or "left" name as the map key,
@@ -872,6 +1048,21 @@ interface ComparisonDatasetOptions {
872
1048
  * datasets (for example, to omit datasets that are not relevant).
873
1049
  */
874
1050
  datasetKeysForScenario?: (allDatasetKeys: DatasetKey[], scenario: ComparisonScenario) => DatasetKey[];
1051
+ /**
1052
+ * An optional function that allows for including additional reference plots
1053
+ * on a comparison graph for a given dataset and scenario. By default, no
1054
+ * additional reference plots are included, but if a custom function is
1055
+ * provided, it can return an array of `ComparisonPlot` objects.
1056
+ */
1057
+ referencePlotsForDataset?: (dataset: ComparisonDataset, scenario: ComparisonScenario) => ComparisonPlot[];
1058
+ /**
1059
+ * An optional function that allows for customizing the set of context graphs
1060
+ * that are shown for a given dataset and scenario. By default, all graphs in
1061
+ * which the dataset appears will be shown, but if a custom function is provided,
1062
+ * it can return a different set of graphs (for example, to omit graphs that are
1063
+ * not relevant under the given scenario).
1064
+ */
1065
+ contextGraphIdsForDataset?: (dataset: ComparisonDataset, scenario: ComparisonScenario) => BundleGraphId[];
875
1066
  }
876
1067
  interface ComparisonOptions {
877
1068
  /** The left-side ("baseline") bundle being compared. */
@@ -907,7 +1098,7 @@ interface ComparisonConfig {
907
1098
  viewGroups: ComparisonViewGroup[];
908
1099
  }
909
1100
 
910
- declare type ComparisonDataRequestKey = string;
1101
+ type ComparisonDataRequestKey = string;
911
1102
  /**
912
1103
  * Coordinates loading of data in parallel from two models.
913
1104
  */
@@ -928,7 +1119,7 @@ interface DiffPoint {
928
1119
  valueL: number;
929
1120
  valueR: number;
930
1121
  }
931
- declare type DiffValidity = 'neither' | 'left-only' | 'right-only' | 'both';
1122
+ type DiffValidity = 'neither' | 'left-only' | 'right-only' | 'both';
932
1123
  interface DiffReport {
933
1124
  validity: DiffValidity;
934
1125
  minValue: number;
@@ -1002,7 +1193,7 @@ interface ComparisonSummary {
1002
1193
  perfReportR: PerfReport;
1003
1194
  }
1004
1195
 
1005
- declare type GraphInclusion = 'neither' | 'left-only' | 'right-only' | 'both';
1196
+ type GraphInclusion = 'neither' | 'left-only' | 'right-only' | 'both';
1006
1197
  interface GraphComparisonMetadataReport {
1007
1198
  /** The key for the metadata field. */
1008
1199
  key: string;
@@ -1046,8 +1237,8 @@ declare function diffGraphs(graphL: BundleGraphSpec | undefined, graphR: BundleG
1046
1237
  */
1047
1238
  declare function comparisonSummaryFromReport(comparisonReport: ComparisonReport): ComparisonSummary;
1048
1239
 
1049
- declare type ComparisonGroupKind = 'by-dataset' | 'by-scenario';
1050
- declare type ComparisonGroupKey = string;
1240
+ type ComparisonGroupKind = 'by-dataset' | 'by-scenario';
1241
+ type ComparisonGroupKey = string;
1051
1242
  /**
1052
1243
  * A group of comparison test summaries associated with a particular scenario or dataset.
1053
1244
  */
@@ -1063,7 +1254,7 @@ interface ComparisonGroup {
1063
1254
  testSummaries: ComparisonTestSummary[];
1064
1255
  }
1065
1256
  /** Describes the "root" or primary item for a group of comparisons. */
1066
- declare type ComparisonGroupRoot = ComparisonDataset | ComparisonScenario;
1257
+ type ComparisonGroupRoot = ComparisonDataset | ComparisonScenario;
1067
1258
  /** A summary of scores for a group of comparisons. */
1068
1259
  interface ComparisonGroupScores {
1069
1260
  /** The total number of comparisons (sample size) for this group. */
@@ -1124,12 +1315,23 @@ interface ComparisonGroupSummariesByCategory {
1124
1315
  * Rolls up all by-scenario and by-dataset groupings.
1125
1316
  */
1126
1317
  interface ComparisonCategorizedResults {
1318
+ /** All summaries for the comparison tests that were performed. */
1319
+ allTestSummaries: ComparisonTestSummary[];
1127
1320
  /** The full set of by-scenario groupings. */
1128
1321
  byScenario: ComparisonGroupSummariesByCategory;
1129
1322
  /** The full set of by-dataset groupings. */
1130
1323
  byDataset: ComparisonGroupSummariesByCategory;
1131
1324
  }
1132
1325
 
1326
+ /**
1327
+ * Compute the overall scores for the given group of comparison test summaries.
1328
+ *
1329
+ * @param testSummaries The comparison test summaries to consider.
1330
+ * @param thresholds The array of thresholds that determine the buckets into which
1331
+ * the scores will be summarized.
1332
+ */
1333
+ declare function getScoresForTestSummaries(testSummaries: ComparisonTestSummary[], thresholds: number[]): ComparisonGroupScores;
1334
+
1133
1335
  /**
1134
1336
  * Given a set of terse test summaries (which only includes summaries for tests with non-zero `maxDiff`
1135
1337
  * scores), restore the full set of summaries and then categorize them.
@@ -1216,7 +1418,7 @@ interface SuiteSummary {
1216
1418
  comparisonSummary?: ComparisonSummary;
1217
1419
  }
1218
1420
 
1219
- declare type CancelRunSuite = () => void;
1421
+ type CancelRunSuite = () => void;
1220
1422
  interface RunSuiteCallbacks {
1221
1423
  onProgress?: (pct: number) => void;
1222
1424
  onComplete?: (suiteReport: SuiteReport) => void;
@@ -1245,4 +1447,4 @@ declare function runSuite(config: Config, callbacks: RunSuiteCallbacks, options?
1245
1447
  */
1246
1448
  declare function suiteSummaryFromReport(suiteReport: SuiteReport): SuiteSummary;
1247
1449
 
1248
- export { AllInputsSpec, Bundle, BundleGraphData, BundleGraphDatasetSpec, BundleGraphId, BundleGraphSpec, BundleGraphView, BundleModel, CheckDataCoordinator, CheckDataRequestKey, CheckDatasetReport, CheckGroupReport, CheckKey, CheckPredicateOp, CheckPredicateOpConstantRef, CheckPredicateOpDataRef, CheckPredicateOpRef, CheckPredicateReport, CheckPredicateSummary, CheckPredicateTimeOptions, CheckPredicateTimeRange, CheckPredicateTimeSingle, CheckPredicateTimeSpec, CheckReport, CheckResult, CheckResultErrorInfo, CheckScenario, CheckScenarioError, CheckScenarioInputDesc, CheckScenarioReport, CheckStatus, CheckSummary, CheckTestReport, ComparisonCategorizedResults, ComparisonConfig, ComparisonDataCoordinator, ComparisonDataRequestKey, ComparisonDataset, ComparisonDatasetOptions, ComparisonDatasets, ComparisonGroup, ComparisonGroupKey, ComparisonGroupKind, ComparisonGroupRoot, ComparisonGroupScores, ComparisonGroupSummariesByCategory, ComparisonGroupSummary, ComparisonOptions, ComparisonReport, ComparisonResolverError, ComparisonResolverInvalidValueError, ComparisonResolverUnknownInputError, ComparisonScenario, ComparisonScenarioAllInputsSettings, ComparisonScenarioGroup, ComparisonScenarioGroupId, ComparisonScenarioGroupRefSpec, ComparisonScenarioGroupSpec, ComparisonScenarioGroupTitle, ComparisonScenarioId, ComparisonScenarioInput, ComparisonScenarioInputAtPositionSpec, ComparisonScenarioInputAtValueSpec, ComparisonScenarioInputName, ComparisonScenarioInputPosition, ComparisonScenarioInputSettings, ComparisonScenarioInputSpec, ComparisonScenarioInputState, ComparisonScenarioKey, ComparisonScenarioPresetMatrixSpec, ComparisonScenarioRefSpec, ComparisonScenarioSettings, ComparisonScenarioSpec, ComparisonScenarioSubtitle, ComparisonScenarioTitle, ComparisonScenarioWithAllInputsSpec, ComparisonScenarioWithInputsSpec, ComparisonScenarios, ComparisonSpecs, ComparisonSpecsSource, ComparisonSummary, ComparisonTestReport, ComparisonTestSummary, ComparisonUnresolvedScenarioGroupRef, ComparisonUnresolvedScenarioRef, ComparisonUnresolvedView, ComparisonView, ComparisonViewGraphId, ComparisonViewGraphsArraySpec, ComparisonViewGraphsPresetSpec, ComparisonViewGraphsSpec, ComparisonViewGroup, ComparisonViewGroupSpec, ComparisonViewGroupTitle, ComparisonViewGroupWithScenariosSpec, ComparisonViewGroupWithViewsSpec, ComparisonViewSpec, ComparisonViewSubtitle, ComparisonViewTitle, Config, ConfigInitOptions, ConfigOptions, DataSource, Dataset, DatasetKey, DatasetMap, DatasetsResult, DiffPoint, DiffReport, DiffValidity, Dimension, GraphComparisonDatasetReport, GraphComparisonMetadataReport, GraphComparisonReport, GraphInclusion, ImplVar, InputId, InputPosition, InputSetting, InputSettingsSpec, InputVar, LegendItem, LinkItem, LoadedBundle, ModelSpec, NamedBundle, OutputVar, PerfReport, PerfRunner, PerfStats, PositionSetting, RelatedItem, RunSuiteCallbacks, RunSuiteOptions, ScenarioSpec, ScenarioSpecUid, SourceName, Subscript, SuiteReport, SuiteSummary, ValueSetting, VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createConfig, datasetMessage, diffDatasets, diffGraphs, predicateMessage, runSuite, scenarioMessage, suiteSummaryFromReport };
1450
+ 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 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 Dimension, type GraphComparisonDatasetReport, type GraphComparisonMetadataReport, type GraphComparisonReport, type GraphInclusion, type ImplVar, type InputAliasName, type InputGroupName, type InputId, type InputPosition, type InputSetting, type InputSettingsSpec, type InputVar, type LegendItem, type LinkItem, type LoadedBundle, type ModelSpec, type NamedBundle, type OutputVar, type PerfReport, PerfRunner, PerfStats, type PositionSetting, type RelatedItem, type RunSuiteCallbacks, type RunSuiteOptions, type ScenarioSpec, type ScenarioSpecUid, type SourceName, type Subscript, type SuiteReport, type SuiteSummary, type ValueSetting, type VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createConfig, datasetMessage, diffDatasets, diffGraphs, getScoresForTestSummaries, predicateMessage, runSuite, scenarioMessage, suiteSummaryFromReport };