@sdeverywhere/check-core 0.1.13 → 0.1.14

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.cts CHANGED
@@ -745,10 +745,14 @@ interface CheckScenario {
745
745
  */
746
746
  type CheckDataRefKey = string;
747
747
  /**
748
- * The scenario and dataset referenced by a particular predicate (for cases
749
- * where the check is against another dataset rather than a constant value).
748
+ * The operation used to combine multiple referenced datasets into a single dataset.
750
749
  */
751
- interface CheckDataRef {
750
+ type CheckDataRefOp = 'sum';
751
+ /**
752
+ * A single dataset (along with the scenario used to produce it) that is referenced
753
+ * by a predicate. Each of these corresponds to one data fetch.
754
+ */
755
+ interface CheckRefDataset {
752
756
  /** The key for the reference; can be undefined if inputs or datasets failed to match. */
753
757
  key?: CheckDataRefKey;
754
758
  /** The scenario used to generate the referenced dataset. */
@@ -756,6 +760,17 @@ interface CheckDataRef {
756
760
  /** The referenced dataset. */
757
761
  dataset: CheckDataset;
758
762
  }
763
+ /**
764
+ * The dataset(s) referenced by a particular predicate op (for cases where the check
765
+ * is against other datasets rather than a constant value). When more than one dataset
766
+ * is referenced, the `op` determines how they are combined into a single dataset.
767
+ */
768
+ interface CheckDataRef {
769
+ /** The operation used to combine the referenced datasets; undefined if there is a single dataset. */
770
+ op?: CheckDataRefOp;
771
+ /** The referenced datasets. */
772
+ refs: CheckRefDataset[];
773
+ }
759
774
 
760
775
  type CheckPredicateOp = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'approx';
761
776
 
@@ -2181,4 +2196,4 @@ declare function runSuite(config: Config, callbacks: RunSuiteCallbacks, options?
2181
2196
  */
2182
2197
  declare function suiteSummaryFromReport(suiteReport: SuiteReport, elapsedMillis: number): SuiteSummary;
2183
2198
 
2184
- export { type AllInputsSpec, type Bundle, type BundleGraphData, type BundleGraphDatasetSpec, type BundleGraphId, type BundleGraphSpec, type BundleGraphView, type BundleGraphViewOptions, type BundleModel, type CancelRunPerf, type CancelRunSuite, type CancelRunTrace as CancelTrace, type CheckConfig, CheckDataCoordinator, type CheckDataRef, type CheckDataRefKey, type CheckDataRequestKey, type CheckDataset, type CheckDatasetError, type CheckDatasetReport, type CheckGroupReport, type CheckKey, type CheckNameSpec, type CheckOptions, type CheckPredicateOp, type CheckPredicateOpConstantRef, type CheckPredicateOpDataRef, type CheckPredicateOpRef, type CheckPredicateReport, type CheckPredicateSummary, type CheckPredicateTimeOptions, type CheckPredicateTimeRange, type CheckPredicateTimeSingle, type CheckPredicateTimeSpec, type CheckReport, type CheckResult, type CheckResultErrorInfo, type CheckScenario, type CheckScenarioError, type CheckScenarioInputDesc, type CheckScenarioReport, type CheckStatus, type CheckSummary, type CheckTestReport, type ComparisonCategorizedResults, type ComparisonConfig, ComparisonDataCoordinator, type ComparisonDataRequestKey, type ComparisonDataset, type ComparisonDatasetName, type ComparisonDatasetOptions, type ComparisonDatasetSource, type ComparisonDatasetSpec, type ComparisonDatasets, type ComparisonGraphGroup, type ComparisonGraphGroupId, type ComparisonGraphGroupRefSpec, type ComparisonGraphGroupSpec, type ComparisonGraphId, type ComparisonGraphsArraySpec, type ComparisonGraphsPresetSpec, type ComparisonGroup, type ComparisonGroupKey, type ComparisonGroupKind, type ComparisonGroupRoot, type ComparisonGroupScores, type ComparisonGroupSummariesByCategory, type ComparisonGroupSummary, type ComparisonOptions, type ComparisonPlot, type ComparisonReport, type ComparisonReportDetailItem, type ComparisonReportDetailRow, type ComparisonReportOptions, type ComparisonReportSummaryRow, type ComparisonReportSummarySection, type ComparisonResolverError, type ComparisonResolverUnknownInputError, type ComparisonResolverUnknownInputSettingGroupError, type ComparisonResolverValueOutOfRangeWarning, type ComparisonResolverWarning, type ComparisonScenario, type ComparisonScenarioAllInputsSettings, type ComparisonScenarioGroup, type ComparisonScenarioGroupId, type ComparisonScenarioGroupRefSpec, type ComparisonScenarioGroupSpec, type ComparisonScenarioGroupTitle, type ComparisonScenarioId, type ComparisonScenarioInput, type ComparisonScenarioInputAtPositionSpec, type ComparisonScenarioInputAtValueSpec, type ComparisonScenarioInputName, type ComparisonScenarioInputPosition, type ComparisonScenarioInputSettings, type ComparisonScenarioInputSpec, type ComparisonScenarioInputState, type ComparisonScenarioKey, type ComparisonScenarioPresetMatrixSpec, type ComparisonScenarioRefSpec, type ComparisonScenarioSettings, type ComparisonScenarioSpec, type ComparisonScenarioSubtitle, type ComparisonScenarioTitle, type ComparisonScenarioTitleSpec, type ComparisonScenarioWithAllInputsSpec, type ComparisonScenarioWithDistinctInputsSpec, type ComparisonScenarioWithInputsSpec, type ComparisonScenarioWithSettingGroupSpec, type ComparisonScenarios, type ComparisonSortMode, type ComparisonSpecs, type ComparisonSpecsSource, type ComparisonSummary, type ComparisonTestReport, type ComparisonTestSummary, type ComparisonUnresolvedScenarioGroupRef, type ComparisonUnresolvedScenarioRef, type ComparisonUnresolvedView, type ComparisonView, type ComparisonViewBox, type ComparisonViewBoxSpec, type ComparisonViewGraphOrder, type ComparisonViewGraphsSpec, type ComparisonViewGroup, type ComparisonViewGroupSpec, type ComparisonViewGroupTitle, type ComparisonViewGroupWithScenariosSpec, type ComparisonViewGroupWithViewsSpec, type ComparisonViewItemSubtitle, type ComparisonViewItemTitle, type ComparisonViewRow, type ComparisonViewRowSpec, type ComparisonViewRowSubtitle, type ComparisonViewRowTitle, type ComparisonViewSpec, type ComparisonViewSubtitle, type ComparisonViewTitle, type Config, type ConfigInitOptions, type ConfigOptions, type ConstantOverride, type DataSource, type Dataset, type DatasetGroupName, type DatasetKey, type DatasetMap, type DatasetsResult, type DiffPoint, type DiffReport, type DiffValidity, type EncodedImplVars, type EncodedSubscript, type EncodedVarInstance, type EncodedVarType, type EncodedVariable, type GetDatasetsOptions, type GraphComparisonDatasetReport, type GraphComparisonMetadataReport, type GraphComparisonReport, type GraphInclusion, type ImplVar, type ImplVarGroup, type InputAliasName, type InputGroupName, type InputId, type InputPosition, type InputSetting, type InputSettingGroupId, type InputSettingsSpec, type InputVar, type LegendItem, type LinkItem, type LoadedBundle, type LookupOverride, type ModelSpec, type NamedBundle, type OutputVar, type PerfReport, PerfStats, type PositionSetting, type RelatedItem, type RunPerfCallbacks, type RunPerfOptions, type RunSuiteCallbacks, type RunSuiteOptions, type ScenarioSpec, type ScenarioSpecUid, type SliderInputVar, type SourceName, type SuiteReport, type SuiteSummary, type SwitchInputVar, type RunTraceCallbacks as TraceCallbacks, type TraceCompareToBundleOptions, type TraceCompareToExtDataOptions, type TraceDatasetReport, type TraceOptions, type TraceReport, type ValueSetting, type VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createCheckDataCoordinator, createCheckDataCoordinatorForTests, createComparisonDataCoordinator, createConfig, datasetMessage, decodeImplVars, diffDatasets, diffGraphs, encodeImplVars, getScoresForTestSummaries, predicateMessage, runPerf, runSuite, runTrace, scenarioMessage, suiteSummaryFromReport, testSummaryFromReport };
2199
+ export { type AllInputsSpec, type Bundle, type BundleGraphData, type BundleGraphDatasetSpec, type BundleGraphId, type BundleGraphSpec, type BundleGraphView, type BundleGraphViewOptions, type BundleModel, type CancelRunPerf, type CancelRunSuite, type CancelRunTrace as CancelTrace, type CheckConfig, CheckDataCoordinator, type CheckDataRef, type CheckDataRefKey, type CheckDataRefOp, 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 CheckRefDataset, type CheckReport, type CheckResult, type CheckResultErrorInfo, type CheckScenario, type CheckScenarioError, type CheckScenarioInputDesc, type CheckScenarioReport, type CheckStatus, type CheckSummary, type CheckTestReport, type ComparisonCategorizedResults, type ComparisonConfig, ComparisonDataCoordinator, type ComparisonDataRequestKey, type ComparisonDataset, type ComparisonDatasetName, type ComparisonDatasetOptions, type ComparisonDatasetSource, type ComparisonDatasetSpec, type ComparisonDatasets, type ComparisonGraphGroup, type ComparisonGraphGroupId, type ComparisonGraphGroupRefSpec, type ComparisonGraphGroupSpec, type ComparisonGraphId, type ComparisonGraphsArraySpec, type ComparisonGraphsPresetSpec, type ComparisonGroup, type ComparisonGroupKey, type ComparisonGroupKind, type ComparisonGroupRoot, type ComparisonGroupScores, type ComparisonGroupSummariesByCategory, type ComparisonGroupSummary, type ComparisonOptions, type ComparisonPlot, type ComparisonReport, type ComparisonReportDetailItem, type ComparisonReportDetailRow, type ComparisonReportOptions, type ComparisonReportSummaryRow, type ComparisonReportSummarySection, type ComparisonResolverError, type ComparisonResolverUnknownInputError, type ComparisonResolverUnknownInputSettingGroupError, type ComparisonResolverValueOutOfRangeWarning, type ComparisonResolverWarning, type ComparisonScenario, type ComparisonScenarioAllInputsSettings, type ComparisonScenarioGroup, type ComparisonScenarioGroupId, type ComparisonScenarioGroupRefSpec, type ComparisonScenarioGroupSpec, type ComparisonScenarioGroupTitle, type ComparisonScenarioId, type ComparisonScenarioInput, type ComparisonScenarioInputAtPositionSpec, type ComparisonScenarioInputAtValueSpec, type ComparisonScenarioInputName, type ComparisonScenarioInputPosition, type ComparisonScenarioInputSettings, type ComparisonScenarioInputSpec, type ComparisonScenarioInputState, type ComparisonScenarioKey, type ComparisonScenarioPresetMatrixSpec, type ComparisonScenarioRefSpec, type ComparisonScenarioSettings, type ComparisonScenarioSpec, type ComparisonScenarioSubtitle, type ComparisonScenarioTitle, type ComparisonScenarioTitleSpec, type ComparisonScenarioWithAllInputsSpec, type ComparisonScenarioWithDistinctInputsSpec, type ComparisonScenarioWithInputsSpec, type ComparisonScenarioWithSettingGroupSpec, type ComparisonScenarios, type ComparisonSortMode, type ComparisonSpecs, type ComparisonSpecsSource, type ComparisonSummary, type ComparisonTestReport, type ComparisonTestSummary, type ComparisonUnresolvedScenarioGroupRef, type ComparisonUnresolvedScenarioRef, type ComparisonUnresolvedView, type ComparisonView, type ComparisonViewBox, type ComparisonViewBoxSpec, type ComparisonViewGraphOrder, type ComparisonViewGraphsSpec, type ComparisonViewGroup, type ComparisonViewGroupSpec, type ComparisonViewGroupTitle, type ComparisonViewGroupWithScenariosSpec, type ComparisonViewGroupWithViewsSpec, type ComparisonViewItemSubtitle, type ComparisonViewItemTitle, type ComparisonViewRow, type ComparisonViewRowSpec, type ComparisonViewRowSubtitle, type ComparisonViewRowTitle, type ComparisonViewSpec, type ComparisonViewSubtitle, type ComparisonViewTitle, type Config, type ConfigInitOptions, type ConfigOptions, type ConstantOverride, type DataSource, type Dataset, type DatasetGroupName, type DatasetKey, type DatasetMap, type DatasetsResult, type DiffPoint, type DiffReport, type DiffValidity, type EncodedImplVars, type EncodedSubscript, type EncodedVarInstance, type EncodedVarType, type EncodedVariable, type GetDatasetsOptions, type GraphComparisonDatasetReport, type GraphComparisonMetadataReport, type GraphComparisonReport, type GraphInclusion, type ImplVar, type ImplVarGroup, type InputAliasName, type InputGroupName, type InputId, type InputPosition, type InputSetting, type InputSettingGroupId, type InputSettingsSpec, type InputVar, type LegendItem, type LinkItem, type LoadedBundle, type LookupOverride, type ModelSpec, type NamedBundle, type OutputVar, type PerfReport, PerfStats, type PositionSetting, type RelatedItem, type RunPerfCallbacks, type RunPerfOptions, type RunSuiteCallbacks, type RunSuiteOptions, type ScenarioSpec, type ScenarioSpecUid, type SliderInputVar, type SourceName, type SuiteReport, type SuiteSummary, type SwitchInputVar, type RunTraceCallbacks as TraceCallbacks, type TraceCompareToBundleOptions, type TraceCompareToExtDataOptions, type TraceDatasetReport, type TraceOptions, type TraceReport, type ValueSetting, type VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createCheckDataCoordinator, createCheckDataCoordinatorForTests, createComparisonDataCoordinator, createConfig, datasetMessage, decodeImplVars, diffDatasets, diffGraphs, encodeImplVars, getScoresForTestSummaries, predicateMessage, runPerf, runSuite, runTrace, scenarioMessage, suiteSummaryFromReport, testSummaryFromReport };
package/dist/index.d.ts CHANGED
@@ -745,10 +745,14 @@ interface CheckScenario {
745
745
  */
746
746
  type CheckDataRefKey = string;
747
747
  /**
748
- * The scenario and dataset referenced by a particular predicate (for cases
749
- * where the check is against another dataset rather than a constant value).
748
+ * The operation used to combine multiple referenced datasets into a single dataset.
750
749
  */
751
- interface CheckDataRef {
750
+ type CheckDataRefOp = 'sum';
751
+ /**
752
+ * A single dataset (along with the scenario used to produce it) that is referenced
753
+ * by a predicate. Each of these corresponds to one data fetch.
754
+ */
755
+ interface CheckRefDataset {
752
756
  /** The key for the reference; can be undefined if inputs or datasets failed to match. */
753
757
  key?: CheckDataRefKey;
754
758
  /** The scenario used to generate the referenced dataset. */
@@ -756,6 +760,17 @@ interface CheckDataRef {
756
760
  /** The referenced dataset. */
757
761
  dataset: CheckDataset;
758
762
  }
763
+ /**
764
+ * The dataset(s) referenced by a particular predicate op (for cases where the check
765
+ * is against other datasets rather than a constant value). When more than one dataset
766
+ * is referenced, the `op` determines how they are combined into a single dataset.
767
+ */
768
+ interface CheckDataRef {
769
+ /** The operation used to combine the referenced datasets; undefined if there is a single dataset. */
770
+ op?: CheckDataRefOp;
771
+ /** The referenced datasets. */
772
+ refs: CheckRefDataset[];
773
+ }
759
774
 
760
775
  type CheckPredicateOp = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'approx';
761
776
 
@@ -2181,4 +2196,4 @@ declare function runSuite(config: Config, callbacks: RunSuiteCallbacks, options?
2181
2196
  */
2182
2197
  declare function suiteSummaryFromReport(suiteReport: SuiteReport, elapsedMillis: number): SuiteSummary;
2183
2198
 
2184
- export { type AllInputsSpec, type Bundle, type BundleGraphData, type BundleGraphDatasetSpec, type BundleGraphId, type BundleGraphSpec, type BundleGraphView, type BundleGraphViewOptions, type BundleModel, type CancelRunPerf, type CancelRunSuite, type CancelRunTrace as CancelTrace, type CheckConfig, CheckDataCoordinator, type CheckDataRef, type CheckDataRefKey, type CheckDataRequestKey, type CheckDataset, type CheckDatasetError, type CheckDatasetReport, type CheckGroupReport, type CheckKey, type CheckNameSpec, type CheckOptions, type CheckPredicateOp, type CheckPredicateOpConstantRef, type CheckPredicateOpDataRef, type CheckPredicateOpRef, type CheckPredicateReport, type CheckPredicateSummary, type CheckPredicateTimeOptions, type CheckPredicateTimeRange, type CheckPredicateTimeSingle, type CheckPredicateTimeSpec, type CheckReport, type CheckResult, type CheckResultErrorInfo, type CheckScenario, type CheckScenarioError, type CheckScenarioInputDesc, type CheckScenarioReport, type CheckStatus, type CheckSummary, type CheckTestReport, type ComparisonCategorizedResults, type ComparisonConfig, ComparisonDataCoordinator, type ComparisonDataRequestKey, type ComparisonDataset, type ComparisonDatasetName, type ComparisonDatasetOptions, type ComparisonDatasetSource, type ComparisonDatasetSpec, type ComparisonDatasets, type ComparisonGraphGroup, type ComparisonGraphGroupId, type ComparisonGraphGroupRefSpec, type ComparisonGraphGroupSpec, type ComparisonGraphId, type ComparisonGraphsArraySpec, type ComparisonGraphsPresetSpec, type ComparisonGroup, type ComparisonGroupKey, type ComparisonGroupKind, type ComparisonGroupRoot, type ComparisonGroupScores, type ComparisonGroupSummariesByCategory, type ComparisonGroupSummary, type ComparisonOptions, type ComparisonPlot, type ComparisonReport, type ComparisonReportDetailItem, type ComparisonReportDetailRow, type ComparisonReportOptions, type ComparisonReportSummaryRow, type ComparisonReportSummarySection, type ComparisonResolverError, type ComparisonResolverUnknownInputError, type ComparisonResolverUnknownInputSettingGroupError, type ComparisonResolverValueOutOfRangeWarning, type ComparisonResolverWarning, type ComparisonScenario, type ComparisonScenarioAllInputsSettings, type ComparisonScenarioGroup, type ComparisonScenarioGroupId, type ComparisonScenarioGroupRefSpec, type ComparisonScenarioGroupSpec, type ComparisonScenarioGroupTitle, type ComparisonScenarioId, type ComparisonScenarioInput, type ComparisonScenarioInputAtPositionSpec, type ComparisonScenarioInputAtValueSpec, type ComparisonScenarioInputName, type ComparisonScenarioInputPosition, type ComparisonScenarioInputSettings, type ComparisonScenarioInputSpec, type ComparisonScenarioInputState, type ComparisonScenarioKey, type ComparisonScenarioPresetMatrixSpec, type ComparisonScenarioRefSpec, type ComparisonScenarioSettings, type ComparisonScenarioSpec, type ComparisonScenarioSubtitle, type ComparisonScenarioTitle, type ComparisonScenarioTitleSpec, type ComparisonScenarioWithAllInputsSpec, type ComparisonScenarioWithDistinctInputsSpec, type ComparisonScenarioWithInputsSpec, type ComparisonScenarioWithSettingGroupSpec, type ComparisonScenarios, type ComparisonSortMode, type ComparisonSpecs, type ComparisonSpecsSource, type ComparisonSummary, type ComparisonTestReport, type ComparisonTestSummary, type ComparisonUnresolvedScenarioGroupRef, type ComparisonUnresolvedScenarioRef, type ComparisonUnresolvedView, type ComparisonView, type ComparisonViewBox, type ComparisonViewBoxSpec, type ComparisonViewGraphOrder, type ComparisonViewGraphsSpec, type ComparisonViewGroup, type ComparisonViewGroupSpec, type ComparisonViewGroupTitle, type ComparisonViewGroupWithScenariosSpec, type ComparisonViewGroupWithViewsSpec, type ComparisonViewItemSubtitle, type ComparisonViewItemTitle, type ComparisonViewRow, type ComparisonViewRowSpec, type ComparisonViewRowSubtitle, type ComparisonViewRowTitle, type ComparisonViewSpec, type ComparisonViewSubtitle, type ComparisonViewTitle, type Config, type ConfigInitOptions, type ConfigOptions, type ConstantOverride, type DataSource, type Dataset, type DatasetGroupName, type DatasetKey, type DatasetMap, type DatasetsResult, type DiffPoint, type DiffReport, type DiffValidity, type EncodedImplVars, type EncodedSubscript, type EncodedVarInstance, type EncodedVarType, type EncodedVariable, type GetDatasetsOptions, type GraphComparisonDatasetReport, type GraphComparisonMetadataReport, type GraphComparisonReport, type GraphInclusion, type ImplVar, type ImplVarGroup, type InputAliasName, type InputGroupName, type InputId, type InputPosition, type InputSetting, type InputSettingGroupId, type InputSettingsSpec, type InputVar, type LegendItem, type LinkItem, type LoadedBundle, type LookupOverride, type ModelSpec, type NamedBundle, type OutputVar, type PerfReport, PerfStats, type PositionSetting, type RelatedItem, type RunPerfCallbacks, type RunPerfOptions, type RunSuiteCallbacks, type RunSuiteOptions, type ScenarioSpec, type ScenarioSpecUid, type SliderInputVar, type SourceName, type SuiteReport, type SuiteSummary, type SwitchInputVar, type RunTraceCallbacks as TraceCallbacks, type TraceCompareToBundleOptions, type TraceCompareToExtDataOptions, type TraceDatasetReport, type TraceOptions, type TraceReport, type ValueSetting, type VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createCheckDataCoordinator, createCheckDataCoordinatorForTests, createComparisonDataCoordinator, createConfig, datasetMessage, decodeImplVars, diffDatasets, diffGraphs, encodeImplVars, getScoresForTestSummaries, predicateMessage, runPerf, runSuite, runTrace, scenarioMessage, suiteSummaryFromReport, testSummaryFromReport };
2199
+ export { type AllInputsSpec, type Bundle, type BundleGraphData, type BundleGraphDatasetSpec, type BundleGraphId, type BundleGraphSpec, type BundleGraphView, type BundleGraphViewOptions, type BundleModel, type CancelRunPerf, type CancelRunSuite, type CancelRunTrace as CancelTrace, type CheckConfig, CheckDataCoordinator, type CheckDataRef, type CheckDataRefKey, type CheckDataRefOp, 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 CheckRefDataset, type CheckReport, type CheckResult, type CheckResultErrorInfo, type CheckScenario, type CheckScenarioError, type CheckScenarioInputDesc, type CheckScenarioReport, type CheckStatus, type CheckSummary, type CheckTestReport, type ComparisonCategorizedResults, type ComparisonConfig, ComparisonDataCoordinator, type ComparisonDataRequestKey, type ComparisonDataset, type ComparisonDatasetName, type ComparisonDatasetOptions, type ComparisonDatasetSource, type ComparisonDatasetSpec, type ComparisonDatasets, type ComparisonGraphGroup, type ComparisonGraphGroupId, type ComparisonGraphGroupRefSpec, type ComparisonGraphGroupSpec, type ComparisonGraphId, type ComparisonGraphsArraySpec, type ComparisonGraphsPresetSpec, type ComparisonGroup, type ComparisonGroupKey, type ComparisonGroupKind, type ComparisonGroupRoot, type ComparisonGroupScores, type ComparisonGroupSummariesByCategory, type ComparisonGroupSummary, type ComparisonOptions, type ComparisonPlot, type ComparisonReport, type ComparisonReportDetailItem, type ComparisonReportDetailRow, type ComparisonReportOptions, type ComparisonReportSummaryRow, type ComparisonReportSummarySection, type ComparisonResolverError, type ComparisonResolverUnknownInputError, type ComparisonResolverUnknownInputSettingGroupError, type ComparisonResolverValueOutOfRangeWarning, type ComparisonResolverWarning, type ComparisonScenario, type ComparisonScenarioAllInputsSettings, type ComparisonScenarioGroup, type ComparisonScenarioGroupId, type ComparisonScenarioGroupRefSpec, type ComparisonScenarioGroupSpec, type ComparisonScenarioGroupTitle, type ComparisonScenarioId, type ComparisonScenarioInput, type ComparisonScenarioInputAtPositionSpec, type ComparisonScenarioInputAtValueSpec, type ComparisonScenarioInputName, type ComparisonScenarioInputPosition, type ComparisonScenarioInputSettings, type ComparisonScenarioInputSpec, type ComparisonScenarioInputState, type ComparisonScenarioKey, type ComparisonScenarioPresetMatrixSpec, type ComparisonScenarioRefSpec, type ComparisonScenarioSettings, type ComparisonScenarioSpec, type ComparisonScenarioSubtitle, type ComparisonScenarioTitle, type ComparisonScenarioTitleSpec, type ComparisonScenarioWithAllInputsSpec, type ComparisonScenarioWithDistinctInputsSpec, type ComparisonScenarioWithInputsSpec, type ComparisonScenarioWithSettingGroupSpec, type ComparisonScenarios, type ComparisonSortMode, type ComparisonSpecs, type ComparisonSpecsSource, type ComparisonSummary, type ComparisonTestReport, type ComparisonTestSummary, type ComparisonUnresolvedScenarioGroupRef, type ComparisonUnresolvedScenarioRef, type ComparisonUnresolvedView, type ComparisonView, type ComparisonViewBox, type ComparisonViewBoxSpec, type ComparisonViewGraphOrder, type ComparisonViewGraphsSpec, type ComparisonViewGroup, type ComparisonViewGroupSpec, type ComparisonViewGroupTitle, type ComparisonViewGroupWithScenariosSpec, type ComparisonViewGroupWithViewsSpec, type ComparisonViewItemSubtitle, type ComparisonViewItemTitle, type ComparisonViewRow, type ComparisonViewRowSpec, type ComparisonViewRowSubtitle, type ComparisonViewRowTitle, type ComparisonViewSpec, type ComparisonViewSubtitle, type ComparisonViewTitle, type Config, type ConfigInitOptions, type ConfigOptions, type ConstantOverride, type DataSource, type Dataset, type DatasetGroupName, type DatasetKey, type DatasetMap, type DatasetsResult, type DiffPoint, type DiffReport, type DiffValidity, type EncodedImplVars, type EncodedSubscript, type EncodedVarInstance, type EncodedVarType, type EncodedVariable, type GetDatasetsOptions, type GraphComparisonDatasetReport, type GraphComparisonMetadataReport, type GraphComparisonReport, type GraphInclusion, type ImplVar, type ImplVarGroup, type InputAliasName, type InputGroupName, type InputId, type InputPosition, type InputSetting, type InputSettingGroupId, type InputSettingsSpec, type InputVar, type LegendItem, type LinkItem, type LoadedBundle, type LookupOverride, type ModelSpec, type NamedBundle, type OutputVar, type PerfReport, PerfStats, type PositionSetting, type RelatedItem, type RunPerfCallbacks, type RunPerfOptions, type RunSuiteCallbacks, type RunSuiteOptions, type ScenarioSpec, type ScenarioSpecUid, type SliderInputVar, type SourceName, type SuiteReport, type SuiteSummary, type SwitchInputVar, type RunTraceCallbacks as TraceCallbacks, type TraceCompareToBundleOptions, type TraceCompareToExtDataOptions, type TraceDatasetReport, type TraceOptions, type TraceReport, type ValueSetting, type VarId, categorizeComparisonTestSummaries, checkReportFromSummary, checkSummaryFromReport, comparisonSummaryFromReport, createCheckDataCoordinator, createCheckDataCoordinatorForTests, createComparisonDataCoordinator, createConfig, datasetMessage, decodeImplVars, diffDatasets, diffGraphs, encodeImplVars, getScoresForTestSummaries, predicateMessage, runPerf, runSuite, runTrace, scenarioMessage, suiteSummaryFromReport, testSummaryFromReport };
package/dist/index.js CHANGED
@@ -490,7 +490,7 @@ function predicateReport(predicatePlan, checkKey, result) {
490
490
  opValue = `${sym} ${predOp}`;
491
491
  } else {
492
492
  const dataRef = (_a = predicatePlan.dataRefs) == null ? void 0 : _a.get(op);
493
- if (!dataRef) {
493
+ if (!dataRef || dataRef.refs.length === 0) {
494
494
  return;
495
495
  }
496
496
  const opDataRef = {
@@ -498,8 +498,9 @@ function predicateReport(predicatePlan, checkKey, result) {
498
498
  dataRef
499
499
  };
500
500
  opRef = opDataRef;
501
- opValue = `${sym} '${dataRef.dataset.name}'`;
502
- const refScenarioSpec = (_b = dataRef.scenario) == null ? void 0 : _b.spec;
501
+ const refDatasetNames = dataRef.refs.map((ref) => `'${ref.dataset.name}'`);
502
+ opValue = `${sym} ${refDatasetNames.join(" + ")}`;
503
+ const refScenarioSpec = (_b = dataRef.refs[0].scenario) == null ? void 0 : _b.spec;
503
504
  if (!refScenarioSpec) {
504
505
  return;
505
506
  }
@@ -1056,6 +1057,12 @@ var check_schema_default = {
1056
1057
  type: "number"
1057
1058
  },
1058
1059
  predicate_ref_data: {
1060
+ oneOf: [
1061
+ { $ref: "#/$defs/predicate_ref_data_single_dataset" },
1062
+ { $ref: "#/$defs/predicate_ref_data_multiple_datasets" }
1063
+ ]
1064
+ },
1065
+ predicate_ref_data_single_dataset: {
1059
1066
  type: "object",
1060
1067
  additionalProperties: false,
1061
1068
  properties: {
@@ -1064,6 +1071,27 @@ var check_schema_default = {
1064
1071
  },
1065
1072
  required: ["dataset"]
1066
1073
  },
1074
+ predicate_ref_data_multiple_datasets: {
1075
+ type: "object",
1076
+ additionalProperties: false,
1077
+ properties: {
1078
+ op: { $ref: "#/$defs/predicate_ref_data_datasets_op" },
1079
+ datasets: {
1080
+ type: "array",
1081
+ items: { $ref: "#/$defs/predicate_ref_data_datasets_item" },
1082
+ minItems: 1
1083
+ },
1084
+ scenario: { $ref: "#/$defs/predicate_ref_data_scenario" }
1085
+ },
1086
+ required: ["op", "datasets"]
1087
+ },
1088
+ predicate_ref_data_datasets_op: {
1089
+ type: "string",
1090
+ enum: ["sum"]
1091
+ },
1092
+ predicate_ref_data_datasets_item: {
1093
+ oneOf: [{ type: "string" }, { $ref: "#/$defs/dataset_name" }]
1094
+ },
1067
1095
  predicate_ref_data_dataset: {
1068
1096
  oneOf: [{ $ref: "#/$defs/dataset_name" }, { $ref: "#/$defs/predicate_ref_data_dataset_special" }]
1069
1097
  },
@@ -1916,6 +1944,17 @@ var CheckPlanner = class {
1916
1944
  * this will add a reference to the scenario/dataset pair so that the data can
1917
1945
  * be fetched in a later stage.
1918
1946
  *
1947
+ * A predicate can also reference multiple datasets that are combined into a
1948
+ * single dataset, for example:
1949
+ * ```
1950
+ * approx:
1951
+ * op: sum
1952
+ * datasets:
1953
+ * - 'X'
1954
+ * - 'Y'
1955
+ * ```
1956
+ * in which case one reference is added for each of the datasets.
1957
+ *
1919
1958
  * @param predicateSpec The predicate spec.
1920
1959
  * @param checkScenario The scenario in which the dataset is being checked.
1921
1960
  * @param checkDataset The dataset that is being checked.
@@ -1927,25 +1966,22 @@ var CheckPlanner = class {
1927
1966
  if (predOp === void 0 || typeof predOp === "number") {
1928
1967
  return;
1929
1968
  }
1930
- let refDataset;
1931
- if (typeof predOp.dataset === "string") {
1969
+ const refDatasets = [];
1970
+ if (predOp.datasets !== void 0) {
1971
+ for (const datasetSpec of predOp.datasets) {
1972
+ const refDatasetSpec = typeof datasetSpec === "string" ? { name: datasetSpec } : { name: datasetSpec.name, source: datasetSpec.source };
1973
+ refDatasets.push(this.resolveRefDataset(refDatasetSpec));
1974
+ }
1975
+ } else if (typeof predOp.dataset === "string") {
1932
1976
  switch (predOp.dataset) {
1933
1977
  case "inherit":
1934
- refDataset = checkDataset;
1978
+ refDatasets.push(checkDataset);
1935
1979
  break;
1936
1980
  default:
1937
1981
  assertNever5(predOp.dataset);
1938
1982
  }
1939
1983
  } else {
1940
- const refDatasetSpec = { name: predOp.dataset.name };
1941
- const matchedRefDatasets = expandDatasets(this.modelSpec, refDatasetSpec);
1942
- if (matchedRefDatasets.length === 1) {
1943
- refDataset = matchedRefDatasets[0];
1944
- } else {
1945
- refDataset = {
1946
- name: predOp.dataset.name
1947
- };
1948
- }
1984
+ refDatasets.push(this.resolveRefDataset({ name: predOp.dataset.name }));
1949
1985
  }
1950
1986
  let refScenario;
1951
1987
  if (typeof predOp.scenario === "string") {
@@ -1968,22 +2004,28 @@ var CheckPlanner = class {
1968
2004
  };
1969
2005
  }
1970
2006
  }
1971
- let dataRefKey;
1972
- if (refScenario.spec && refDataset.datasetKey) {
1973
- dataRefKey = `${refScenario.spec.uid}::${refDataset.datasetKey}`;
1974
- }
1975
- const dataRef = {
1976
- key: dataRefKey,
1977
- dataset: refDataset,
1978
- scenario: refScenario
1979
- };
1980
- if (dataRefKey) {
1981
- this.dataRefs.set(dataRefKey, dataRef);
1982
- }
2007
+ const refs = refDatasets.map((refDataset) => {
2008
+ let dataRefKey;
2009
+ if (refScenario.spec && refDataset.datasetKey) {
2010
+ dataRefKey = `${refScenario.spec.uid}::${refDataset.datasetKey}`;
2011
+ }
2012
+ const ref = {
2013
+ key: dataRefKey,
2014
+ dataset: refDataset,
2015
+ scenario: refScenario
2016
+ };
2017
+ if (dataRefKey) {
2018
+ this.dataRefs.set(dataRefKey, ref);
2019
+ }
2020
+ return ref;
2021
+ });
1983
2022
  if (dataRefs === void 0) {
1984
2023
  dataRefs = /* @__PURE__ */ new Map();
1985
2024
  }
1986
- dataRefs.set(op, dataRef);
2025
+ dataRefs.set(op, {
2026
+ op: predOp.op,
2027
+ refs
2028
+ });
1987
2029
  };
1988
2030
  addDataRef("gt");
1989
2031
  addDataRef("gte");
@@ -1993,6 +2035,23 @@ var CheckPlanner = class {
1993
2035
  addDataRef("approx");
1994
2036
  return dataRefs;
1995
2037
  }
2038
+ /**
2039
+ * Resolve the dataset that matches the given spec. If the spec does not expand
2040
+ * to exactly one dataset, this will return a `CheckDataset` with an undefined
2041
+ * `datasetKey` so that the error can be reported later.
2042
+ *
2043
+ * @param refDatasetSpec The spec for the referenced dataset.
2044
+ */
2045
+ resolveRefDataset(refDatasetSpec) {
2046
+ const matchedRefDatasets = expandDatasets(this.modelSpec, refDatasetSpec);
2047
+ if (matchedRefDatasets.length === 1) {
2048
+ return matchedRefDatasets[0];
2049
+ } else {
2050
+ return {
2051
+ name: refDatasetSpec.name
2052
+ };
2053
+ }
2054
+ }
1996
2055
  };
1997
2056
 
1998
2057
  // src/check/check-summary.ts
@@ -5342,14 +5401,15 @@ function scenarioPairUid(scenarioSpecL, scenarioSpecR, constantsL, constantsR, l
5342
5401
  }
5343
5402
 
5344
5403
  // src/check/check-runner.ts
5404
+ import assertNever13 from "assert-never";
5345
5405
  function runChecks(checkConfig, checkSpec, dataPlanner, refDataPlanner, skipChecks) {
5346
5406
  const modelSpec = checkConfig.bundle.modelSpec;
5347
5407
  const checkPlanner = new CheckPlanner(modelSpec);
5348
5408
  checkPlanner.addAllChecks(checkSpec, skipChecks);
5349
5409
  const checkPlan = checkPlanner.buildPlan();
5350
5410
  const refDatasets = /* @__PURE__ */ new Map();
5351
- for (const [dataRefKey, dataRef] of checkPlan.dataRefs.entries()) {
5352
- refDataPlanner.addRequest(void 0, dataRef.scenario.spec, dataRef.dataset.datasetKey, (datasets) => {
5411
+ for (const [dataRefKey, ref] of checkPlan.dataRefs.entries()) {
5412
+ refDataPlanner.addRequest(void 0, ref.scenario.spec, ref.dataset.datasetKey, (datasets) => {
5353
5413
  const dataset = datasets.datasetR;
5354
5414
  if (dataset) {
5355
5415
  refDatasets.set(dataRefKey, dataset);
@@ -5383,52 +5443,91 @@ function runCheck(checkTask, dataset, refDatasets) {
5383
5443
  if (checkTask.dataRefs) {
5384
5444
  opRefDatasets = /* @__PURE__ */ new Map();
5385
5445
  for (const [op, dataRef] of checkTask.dataRefs.entries()) {
5386
- const refDataset = refDatasets == null ? void 0 : refDatasets.get(dataRef.key);
5387
- if (refDataset === void 0) {
5388
- if (dataRef.dataset.datasetKey === void 0) {
5389
- return {
5390
- status: "error",
5391
- errorInfo: {
5392
- kind: "unknown-dataset",
5393
- name: dataRef.dataset.name
5394
- }
5395
- };
5396
- } else if (dataRef.scenario.spec === void 0) {
5397
- if (dataRef.scenario.error) {
5398
- return {
5399
- status: "error",
5400
- errorInfo: {
5401
- kind: dataRef.scenario.error.kind,
5402
- name: dataRef.scenario.error.name
5403
- }
5404
- };
5405
- } else {
5406
- let inputName;
5407
- if (dataRef.scenario.inputDescs.length > 0) {
5408
- inputName = dataRef.scenario.inputDescs[0].name;
5409
- } else {
5410
- inputName = "unknown";
5411
- }
5412
- return {
5413
- status: "error",
5414
- errorInfo: {
5415
- kind: "unknown-input",
5416
- name: inputName
5417
- }
5418
- };
5419
- }
5420
- } else {
5421
- return {
5422
- status: "error",
5423
- message: "unresolved data reference"
5424
- };
5446
+ const resolvedDatasets = [];
5447
+ for (const ref of dataRef.refs) {
5448
+ const refDataset = refDatasets == null ? void 0 : refDatasets.get(ref.key);
5449
+ if (refDataset === void 0) {
5450
+ return errorResultForRefDataset(ref);
5425
5451
  }
5452
+ resolvedDatasets.push(refDataset);
5426
5453
  }
5427
- opRefDatasets.set(op, refDataset);
5454
+ opRefDatasets.set(op, combineRefDatasets(dataRef, resolvedDatasets));
5428
5455
  }
5429
5456
  }
5430
5457
  return checkTask.action.run(dataset, opRefDatasets);
5431
5458
  }
5459
+ function errorResultForRefDataset(ref) {
5460
+ if (ref.dataset.datasetKey === void 0) {
5461
+ return {
5462
+ status: "error",
5463
+ errorInfo: {
5464
+ kind: "unknown-dataset",
5465
+ name: ref.dataset.name
5466
+ }
5467
+ };
5468
+ } else if (ref.scenario.spec === void 0) {
5469
+ if (ref.scenario.error) {
5470
+ return {
5471
+ status: "error",
5472
+ errorInfo: {
5473
+ kind: ref.scenario.error.kind,
5474
+ name: ref.scenario.error.name
5475
+ }
5476
+ };
5477
+ } else {
5478
+ let inputName;
5479
+ if (ref.scenario.inputDescs.length > 0) {
5480
+ inputName = ref.scenario.inputDescs[0].name;
5481
+ } else {
5482
+ inputName = "unknown";
5483
+ }
5484
+ return {
5485
+ status: "error",
5486
+ errorInfo: {
5487
+ kind: "unknown-input",
5488
+ name: inputName
5489
+ }
5490
+ };
5491
+ }
5492
+ } else {
5493
+ return {
5494
+ status: "error",
5495
+ message: "unresolved data reference"
5496
+ };
5497
+ }
5498
+ }
5499
+ function combineRefDatasets(dataRef, datasets) {
5500
+ if (dataRef.op === void 0) {
5501
+ return datasets[0];
5502
+ }
5503
+ switch (dataRef.op) {
5504
+ case "sum":
5505
+ return sumDatasets(datasets);
5506
+ default:
5507
+ assertNever13(dataRef.op);
5508
+ }
5509
+ }
5510
+ function sumDatasets(datasets) {
5511
+ const firstDataset = datasets[0];
5512
+ const otherDatasets = datasets.slice(1);
5513
+ const summed = /* @__PURE__ */ new Map();
5514
+ for (const [time, value] of firstDataset) {
5515
+ let sum = value;
5516
+ let complete = true;
5517
+ for (const otherDataset of otherDatasets) {
5518
+ const otherValue = otherDataset.get(time);
5519
+ if (otherValue === void 0) {
5520
+ complete = false;
5521
+ break;
5522
+ }
5523
+ sum += otherValue;
5524
+ }
5525
+ if (complete) {
5526
+ summed.set(time, sum);
5527
+ }
5528
+ }
5529
+ return summed;
5530
+ }
5432
5531
 
5433
5532
  // src/comparison/run/comparison-runner.ts
5434
5533
  function runComparisons(comparisonConfig, dataPlanner, skipScenarios) {
@@ -5564,8 +5663,9 @@ var SuiteRunner = class {
5564
5663
  }
5565
5664
  const refDataPlan = refDataPlanner.buildPlan();
5566
5665
  const dataPlan = dataPlanner.buildPlan();
5567
- const dataRequests = [...refDataPlan.requests, ...dataPlan.requests];
5568
- const taskCount = dataRequests.length;
5666
+ const refDataRequests = refDataPlan.requests;
5667
+ const dataRequests = dataPlan.requests;
5668
+ const taskCount = refDataRequests.length + dataRequests.length;
5569
5669
  if (taskCount === 0) {
5570
5670
  const checkReport = buildCheckReport2();
5571
5671
  let comparisonReport;
@@ -5603,23 +5703,42 @@ var SuiteRunner = class {
5603
5703
  };
5604
5704
  let tasksCompleted = 0;
5605
5705
  let dataTaskId = 1;
5606
- for (const dataRequest of dataRequests) {
5607
- const task = {
5608
- key: `suite-runner-${dataTaskId++}`,
5609
- kind: "suite-runner",
5610
- process: (bundleModels) => __async(this, null, function* () {
5611
- var _a2, _b2;
5612
- this.pendingTaskKeys.delete(task.key);
5613
- yield this.processRequest(dataRequest, bundleModels);
5614
- tasksCompleted++;
5615
- (_b2 = (_a2 = this.callbacks).onProgress) == null ? void 0 : _b2.call(_a2, tasksCompleted / taskCount);
5616
- if (tasksCompleted === taskCount) {
5617
- buildReport();
5618
- }
5619
- })
5620
- };
5621
- this.taskQueue.addTask(task);
5622
- this.pendingTaskKeys.add(task.key);
5706
+ const scheduleRequests = (requests, onGroupComplete) => {
5707
+ let groupTasksCompleted = 0;
5708
+ for (const dataRequest of requests) {
5709
+ const task = {
5710
+ key: `suite-runner-${dataTaskId++}`,
5711
+ kind: "suite-runner",
5712
+ process: (bundleModels) => __async(this, null, function* () {
5713
+ var _a2, _b2;
5714
+ this.pendingTaskKeys.delete(task.key);
5715
+ yield this.processRequest(dataRequest, bundleModels);
5716
+ tasksCompleted++;
5717
+ (_b2 = (_a2 = this.callbacks).onProgress) == null ? void 0 : _b2.call(_a2, tasksCompleted / taskCount);
5718
+ groupTasksCompleted++;
5719
+ if (groupTasksCompleted === requests.length) {
5720
+ onGroupComplete();
5721
+ }
5722
+ })
5723
+ };
5724
+ this.taskQueue.addTask(task);
5725
+ this.pendingTaskKeys.add(task.key);
5726
+ }
5727
+ };
5728
+ const scheduleDataRequests = () => {
5729
+ if (this.stopped) {
5730
+ return;
5731
+ }
5732
+ if (dataRequests.length > 0) {
5733
+ scheduleRequests(dataRequests, buildReport);
5734
+ } else {
5735
+ buildReport();
5736
+ }
5737
+ };
5738
+ if (refDataRequests.length > 0) {
5739
+ scheduleRequests(refDataRequests, scheduleDataRequests);
5740
+ } else {
5741
+ scheduleDataRequests();
5623
5742
  }
5624
5743
  }
5625
5744
  processRequest(request, bundleModels) {