@sdeverywhere/check-core 0.1.9 → 0.1.11
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 +246 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -13
- package/dist/index.d.ts +177 -13
- package/dist/index.js +246 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -377,13 +377,29 @@ var CheckDataCoordinator = class {
|
|
|
377
377
|
constructor(taskQueue) {
|
|
378
378
|
this.taskQueue = taskQueue;
|
|
379
379
|
}
|
|
380
|
-
|
|
380
|
+
/**
|
|
381
|
+
* Request a dataset from the model.
|
|
382
|
+
*
|
|
383
|
+
* @param requestKey The unique key for the request.
|
|
384
|
+
* @param scenarioSpec The scenario spec that defines the inputs for the model run.
|
|
385
|
+
* @param datasetKey The key of the dataset to be fetched.
|
|
386
|
+
* @param options Optional configuration including constant and lookup overrides.
|
|
387
|
+
* @param onResponse The callback that will be called with the dataset.
|
|
388
|
+
*/
|
|
389
|
+
requestDataset(requestKey, scenarioSpec, datasetKey, options, onResponse) {
|
|
381
390
|
const task = {
|
|
382
391
|
key: requestKey,
|
|
383
392
|
kind: "check-data-coordinator",
|
|
384
393
|
process: (bundleModels) => __async(null, null, function* () {
|
|
385
394
|
const bundleModelR = bundleModels.R;
|
|
386
|
-
|
|
395
|
+
let getDatasetsOptions;
|
|
396
|
+
if ((options == null ? void 0 : options.constants) || (options == null ? void 0 : options.lookups)) {
|
|
397
|
+
getDatasetsOptions = {
|
|
398
|
+
constants: options.constants,
|
|
399
|
+
lookups: options.lookups
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
const result = yield bundleModelR.getDatasetsForScenario(scenarioSpec, [datasetKey], getDatasetsOptions);
|
|
387
403
|
const dataset = result.datasetMap.get(datasetKey);
|
|
388
404
|
onResponse(dataset);
|
|
389
405
|
})
|
|
@@ -1651,9 +1667,25 @@ function inputValueAtPosition(inputVar, position) {
|
|
|
1651
1667
|
case "at-default":
|
|
1652
1668
|
return inputVar.defaultValue;
|
|
1653
1669
|
case "at-minimum":
|
|
1654
|
-
|
|
1670
|
+
switch (inputVar.kind) {
|
|
1671
|
+
case "slider":
|
|
1672
|
+
return inputVar.minValue;
|
|
1673
|
+
case "switch":
|
|
1674
|
+
return inputVar.offValue;
|
|
1675
|
+
default:
|
|
1676
|
+
(0, import_assert_never4.default)(inputVar);
|
|
1677
|
+
}
|
|
1678
|
+
// eslint-disable-next-line no-fallthrough
|
|
1655
1679
|
case "at-maximum":
|
|
1656
|
-
|
|
1680
|
+
switch (inputVar.kind) {
|
|
1681
|
+
case "slider":
|
|
1682
|
+
return inputVar.maxValue;
|
|
1683
|
+
case "switch":
|
|
1684
|
+
return inputVar.onValue;
|
|
1685
|
+
default:
|
|
1686
|
+
(0, import_assert_never4.default)(inputVar);
|
|
1687
|
+
}
|
|
1688
|
+
// eslint-disable-next-line no-fallthrough
|
|
1657
1689
|
default:
|
|
1658
1690
|
(0, import_assert_never4.default)(position);
|
|
1659
1691
|
}
|
|
@@ -2082,14 +2114,19 @@ var ComparisonDataCoordinator = class {
|
|
|
2082
2114
|
* will be fetched from the "left" bundle's model, otherwise they will be fetched from
|
|
2083
2115
|
* the "right" bundle's model.
|
|
2084
2116
|
* @param scenarioSpecR The scenario used for the second ("right") model of the comparison.
|
|
2085
|
-
* @param
|
|
2117
|
+
* @param datasetKeys The keys of the datasets to be fetched.
|
|
2118
|
+
* @param options Optional configuration including constant and lookup overrides.
|
|
2086
2119
|
* @param onResponse The callback that will be called with the dataset maps.
|
|
2087
2120
|
*/
|
|
2088
|
-
requestDatasetMaps(requestKey, sourceL, scenarioSpecL, sourceR, scenarioSpecR, datasetKeys, onResponse) {
|
|
2089
|
-
function fetchDatasets(bundleModel, scenarioSpec) {
|
|
2121
|
+
requestDatasetMaps(requestKey, sourceL, scenarioSpecL, sourceR, scenarioSpecR, datasetKeys, options, onResponse) {
|
|
2122
|
+
function fetchDatasets(bundleModel, scenarioSpec, constants, lookups) {
|
|
2090
2123
|
return __async(this, null, function* () {
|
|
2091
2124
|
if (scenarioSpec) {
|
|
2092
|
-
|
|
2125
|
+
let getDatasetsOptions;
|
|
2126
|
+
if (constants || lookups) {
|
|
2127
|
+
getDatasetsOptions = { constants, lookups };
|
|
2128
|
+
}
|
|
2129
|
+
return bundleModel.getDatasetsForScenario(scenarioSpec, datasetKeys, getDatasetsOptions);
|
|
2093
2130
|
} else {
|
|
2094
2131
|
return void 0;
|
|
2095
2132
|
}
|
|
@@ -2104,12 +2141,12 @@ var ComparisonDataCoordinator = class {
|
|
|
2104
2141
|
let resultL;
|
|
2105
2142
|
let resultR;
|
|
2106
2143
|
if (modelL === modelR) {
|
|
2107
|
-
resultL = yield fetchDatasets(modelL, scenarioSpecL);
|
|
2108
|
-
resultR = yield fetchDatasets(modelR, scenarioSpecR);
|
|
2144
|
+
resultL = yield fetchDatasets(modelL, scenarioSpecL, options == null ? void 0 : options.constantsL, options == null ? void 0 : options.lookupsL);
|
|
2145
|
+
resultR = yield fetchDatasets(modelR, scenarioSpecR, options == null ? void 0 : options.constantsR, options == null ? void 0 : options.lookupsR);
|
|
2109
2146
|
} else {
|
|
2110
2147
|
const results = yield Promise.all([
|
|
2111
|
-
fetchDatasets(modelL, scenarioSpecL),
|
|
2112
|
-
fetchDatasets(modelR, scenarioSpecR)
|
|
2148
|
+
fetchDatasets(modelL, scenarioSpecL, options == null ? void 0 : options.constantsL, options == null ? void 0 : options.lookupsL),
|
|
2149
|
+
fetchDatasets(modelR, scenarioSpecR, options == null ? void 0 : options.constantsR, options == null ? void 0 : options.lookupsR)
|
|
2113
2150
|
]);
|
|
2114
2151
|
resultL = results[0];
|
|
2115
2152
|
resultR = results[1];
|
|
@@ -3969,7 +4006,18 @@ function resolveInputVarAtPosition(inputVar, position) {
|
|
|
3969
4006
|
};
|
|
3970
4007
|
}
|
|
3971
4008
|
function resolveInputVarAtValue(inputVar, value) {
|
|
3972
|
-
|
|
4009
|
+
let inRange;
|
|
4010
|
+
switch (inputVar.kind) {
|
|
4011
|
+
case "slider":
|
|
4012
|
+
inRange = value >= inputVar.minValue && value <= inputVar.maxValue;
|
|
4013
|
+
break;
|
|
4014
|
+
case "switch":
|
|
4015
|
+
inRange = value === inputVar.offValue || value === inputVar.onValue;
|
|
4016
|
+
break;
|
|
4017
|
+
default:
|
|
4018
|
+
(0, import_assert_never10.assertNever)(inputVar);
|
|
4019
|
+
}
|
|
4020
|
+
if (inRange) {
|
|
3973
4021
|
return {
|
|
3974
4022
|
inputVar,
|
|
3975
4023
|
value
|
|
@@ -3999,9 +4047,25 @@ function inputValueAtPosition2(inputVar, position) {
|
|
|
3999
4047
|
case "at-default":
|
|
4000
4048
|
return inputVar.defaultValue;
|
|
4001
4049
|
case "at-minimum":
|
|
4002
|
-
|
|
4050
|
+
switch (inputVar.kind) {
|
|
4051
|
+
case "slider":
|
|
4052
|
+
return inputVar.minValue;
|
|
4053
|
+
case "switch":
|
|
4054
|
+
return inputVar.offValue;
|
|
4055
|
+
default:
|
|
4056
|
+
(0, import_assert_never10.assertNever)(inputVar);
|
|
4057
|
+
}
|
|
4058
|
+
// eslint-disable-next-line no-fallthrough
|
|
4003
4059
|
case "at-maximum":
|
|
4004
|
-
|
|
4060
|
+
switch (inputVar.kind) {
|
|
4061
|
+
case "slider":
|
|
4062
|
+
return inputVar.maxValue;
|
|
4063
|
+
case "switch":
|
|
4064
|
+
return inputVar.onValue;
|
|
4065
|
+
default:
|
|
4066
|
+
(0, import_assert_never10.assertNever)(inputVar);
|
|
4067
|
+
}
|
|
4068
|
+
// eslint-disable-next-line no-fallthrough
|
|
4005
4069
|
default:
|
|
4006
4070
|
(0, import_assert_never10.assertNever)(position);
|
|
4007
4071
|
}
|
|
@@ -4533,12 +4597,12 @@ function handleRenames(origCurrentBundle, renamedDatasetKeys) {
|
|
|
4533
4597
|
var _a, _b, _c;
|
|
4534
4598
|
return {
|
|
4535
4599
|
modelSpec: origBundleModelR.modelSpec,
|
|
4536
|
-
getDatasetsForScenario: (scenarioSpec, datasetKeys) => __async(null, null, function* () {
|
|
4600
|
+
getDatasetsForScenario: (scenarioSpec, datasetKeys, options) => __async(null, null, function* () {
|
|
4537
4601
|
const rightKeySet = /* @__PURE__ */ new Set();
|
|
4538
4602
|
for (const key of datasetKeys) {
|
|
4539
4603
|
rightKeySet.add(rightKeyForLeftKey(key));
|
|
4540
4604
|
}
|
|
4541
|
-
const result = yield origBundleModelR.getDatasetsForScenario(scenarioSpec, [...rightKeySet]);
|
|
4605
|
+
const result = yield origBundleModelR.getDatasetsForScenario(scenarioSpec, [...rightKeySet], options);
|
|
4542
4606
|
const resultMap = /* @__PURE__ */ new Map();
|
|
4543
4607
|
for (const [rightKey, dataset] of result.datasetMap.entries()) {
|
|
4544
4608
|
resultMap.set(rightKey, dataset);
|
|
@@ -4567,34 +4631,76 @@ function handleRenames(origCurrentBundle, renamedDatasetKeys) {
|
|
|
4567
4631
|
var import_assert_never11 = require("assert-never");
|
|
4568
4632
|
|
|
4569
4633
|
// src/perf/perf-stats.ts
|
|
4634
|
+
function percentile(sorted, p) {
|
|
4635
|
+
if (sorted.length === 1) {
|
|
4636
|
+
return sorted[0];
|
|
4637
|
+
}
|
|
4638
|
+
const rank = p * (sorted.length - 1);
|
|
4639
|
+
const lo = Math.floor(rank);
|
|
4640
|
+
const hi = Math.ceil(rank);
|
|
4641
|
+
if (lo === hi) {
|
|
4642
|
+
return sorted[lo];
|
|
4643
|
+
}
|
|
4644
|
+
const frac = rank - lo;
|
|
4645
|
+
return sorted[lo] + (sorted[hi] - sorted[lo]) * frac;
|
|
4646
|
+
}
|
|
4570
4647
|
var PerfStats = class {
|
|
4571
4648
|
constructor() {
|
|
4572
4649
|
this.times = [];
|
|
4573
4650
|
}
|
|
4651
|
+
/**
|
|
4652
|
+
* Record a single run time sample.
|
|
4653
|
+
*
|
|
4654
|
+
* @param timeInMillis The run time in milliseconds.
|
|
4655
|
+
*/
|
|
4574
4656
|
addRun(timeInMillis) {
|
|
4575
4657
|
this.times.push(timeInMillis);
|
|
4576
4658
|
}
|
|
4659
|
+
/**
|
|
4660
|
+
* Get the raw run time samples that have been recorded.
|
|
4661
|
+
*
|
|
4662
|
+
* @returns A copy of the recorded run times, in insertion order.
|
|
4663
|
+
*/
|
|
4664
|
+
getTimes() {
|
|
4665
|
+
return this.times.slice();
|
|
4666
|
+
}
|
|
4667
|
+
/**
|
|
4668
|
+
* Produce a `PerfReport` summarizing the recorded samples.
|
|
4669
|
+
*
|
|
4670
|
+
* @returns The summary report.
|
|
4671
|
+
*/
|
|
4577
4672
|
toReport() {
|
|
4578
4673
|
if (this.times.length === 0) {
|
|
4579
4674
|
return {
|
|
4580
4675
|
minTime: 0,
|
|
4581
4676
|
maxTime: 0,
|
|
4582
4677
|
avgTime: 0,
|
|
4678
|
+
medianTime: 0,
|
|
4679
|
+
p95Time: 0,
|
|
4680
|
+
stdDev: 0,
|
|
4583
4681
|
allTimes: []
|
|
4584
4682
|
};
|
|
4585
4683
|
}
|
|
4586
|
-
const
|
|
4587
|
-
const
|
|
4588
|
-
const
|
|
4589
|
-
const
|
|
4590
|
-
const
|
|
4684
|
+
const sortedTimes = this.times.slice().sort((a, b) => a - b);
|
|
4685
|
+
const n = sortedTimes.length;
|
|
4686
|
+
const minTime = sortedTimes[0];
|
|
4687
|
+
const maxTime = sortedTimes[n - 1];
|
|
4688
|
+
const minIndex = Math.floor(n / 4);
|
|
4689
|
+
const maxIndex = minIndex + Math.max(1, Math.ceil(n / 2));
|
|
4591
4690
|
const middleTimes = sortedTimes.slice(minIndex, maxIndex);
|
|
4592
|
-
const
|
|
4593
|
-
const
|
|
4691
|
+
const avgTime = middleTimes.reduce((a, b) => a + b, 0) / middleTimes.length;
|
|
4692
|
+
const medianTime = percentile(sortedTimes, 0.5);
|
|
4693
|
+
const p95Time = percentile(sortedTimes, 0.95);
|
|
4694
|
+
const mean = sortedTimes.reduce((a, b) => a + b, 0) / n;
|
|
4695
|
+
const variance = sortedTimes.reduce((acc, t) => acc + (t - mean) * (t - mean), 0) / n;
|
|
4696
|
+
const stdDev = Math.sqrt(variance);
|
|
4594
4697
|
return {
|
|
4595
4698
|
minTime,
|
|
4596
4699
|
maxTime,
|
|
4597
4700
|
avgTime,
|
|
4701
|
+
medianTime,
|
|
4702
|
+
p95Time,
|
|
4703
|
+
stdDev,
|
|
4598
4704
|
allTimes: sortedTimes
|
|
4599
4705
|
};
|
|
4600
4706
|
}
|
|
@@ -5036,8 +5142,12 @@ var DataPlanner = class {
|
|
|
5036
5142
|
* is needed from the right model.
|
|
5037
5143
|
* @param datasetKey The key for the dataset to be fetched from each model for the given scenario.
|
|
5038
5144
|
* @param dataAction The action to be performed with the fetched datasets.
|
|
5145
|
+
* @param constantsL Optional constant overrides for the "left" model.
|
|
5146
|
+
* @param constantsR Optional constant overrides for the "right" model.
|
|
5147
|
+
* @param lookupsL Optional lookup overrides for the "left" model.
|
|
5148
|
+
* @param lookupsR Optional lookup overrides for the "right" model.
|
|
5039
5149
|
*/
|
|
5040
|
-
addRequest(scenarioSpecL, scenarioSpecR, datasetKey, dataAction) {
|
|
5150
|
+
addRequest(scenarioSpecL, scenarioSpecR, datasetKey, dataAction, constantsL, constantsR, lookupsL, lookupsR) {
|
|
5041
5151
|
if (scenarioSpecL === void 0 && scenarioSpecR === void 0) {
|
|
5042
5152
|
console.warn("WARNING: Both scenario specs are undefined for DataPlanner request, skipping");
|
|
5043
5153
|
return;
|
|
@@ -5046,17 +5156,17 @@ var DataPlanner = class {
|
|
|
5046
5156
|
let uid;
|
|
5047
5157
|
if (scenarioSpecL && scenarioSpecR) {
|
|
5048
5158
|
taskSetsMap = this.taskSetsLR;
|
|
5049
|
-
uid = scenarioPairUid(scenarioSpecL, scenarioSpecR);
|
|
5159
|
+
uid = scenarioPairUid(scenarioSpecL, scenarioSpecR, constantsL, constantsR, lookupsL, lookupsR);
|
|
5050
5160
|
} else if (scenarioSpecR) {
|
|
5051
5161
|
taskSetsMap = this.taskSetsR;
|
|
5052
|
-
uid = scenarioSpecR
|
|
5162
|
+
uid = scenarioPairUid(void 0, scenarioSpecR, void 0, constantsR, void 0, lookupsR);
|
|
5053
5163
|
} else {
|
|
5054
5164
|
taskSetsMap = this.taskSetsL;
|
|
5055
|
-
uid = scenarioSpecL
|
|
5165
|
+
uid = scenarioPairUid(scenarioSpecL, void 0, constantsL, void 0, lookupsL, void 0);
|
|
5056
5166
|
}
|
|
5057
5167
|
let taskSet = taskSetsMap.get(uid);
|
|
5058
5168
|
if (!taskSet) {
|
|
5059
|
-
taskSet = new DataTaskSet(scenarioSpecL, scenarioSpecR);
|
|
5169
|
+
taskSet = new DataTaskSet(scenarioSpecL, scenarioSpecR, constantsL, constantsR, lookupsL, lookupsR);
|
|
5060
5170
|
taskSetsMap.set(uid, taskSet);
|
|
5061
5171
|
}
|
|
5062
5172
|
taskSet.addTask({
|
|
@@ -5075,26 +5185,33 @@ var DataPlanner = class {
|
|
|
5075
5185
|
const lKeyMappings = /* @__PURE__ */ new Map();
|
|
5076
5186
|
const rKeyMappings = /* @__PURE__ */ new Map();
|
|
5077
5187
|
for (const lrUid of this.taskSetsLR.keys()) {
|
|
5078
|
-
const
|
|
5079
|
-
|
|
5080
|
-
|
|
5188
|
+
const parsed = parsePairUid(lrUid);
|
|
5189
|
+
const lKey = sideKey(parsed.lScenarioUid, parsed.lConstUid, parsed.lLookupUid);
|
|
5190
|
+
const rKey = sideKey(parsed.rScenarioUid, parsed.rConstUid, parsed.rLookupUid);
|
|
5191
|
+
if (parsed.lScenarioUid && !lKeyMappings.has(lKey)) {
|
|
5192
|
+
lKeyMappings.set(lKey, lrUid);
|
|
5081
5193
|
}
|
|
5082
|
-
if (!rKeyMappings.has(
|
|
5083
|
-
rKeyMappings.set(
|
|
5194
|
+
if (parsed.rScenarioUid && !rKeyMappings.has(rKey)) {
|
|
5195
|
+
rKeyMappings.set(rKey, lrUid);
|
|
5084
5196
|
}
|
|
5085
5197
|
}
|
|
5086
|
-
function merge(taskSetsLR, taskSetsForSide, keyMappingsForSide) {
|
|
5087
|
-
for (const [
|
|
5088
|
-
const
|
|
5198
|
+
function merge(taskSetsLR, taskSetsForSide, keyMappingsForSide, side) {
|
|
5199
|
+
for (const [pairUidForSide, taskSetForSide] of taskSetsForSide.entries()) {
|
|
5200
|
+
const parsed = parsePairUid(pairUidForSide);
|
|
5201
|
+
const scenarioUid = side === "L" ? parsed.lScenarioUid : parsed.rScenarioUid;
|
|
5202
|
+
const constUid = side === "L" ? parsed.lConstUid : parsed.rConstUid;
|
|
5203
|
+
const lookupUid = side === "L" ? parsed.lLookupUid : parsed.rLookupUid;
|
|
5204
|
+
const sKey = sideKey(scenarioUid, constUid, lookupUid);
|
|
5205
|
+
const lrKey = keyMappingsForSide.get(sKey);
|
|
5089
5206
|
if (lrKey) {
|
|
5090
5207
|
const taskSetLR = taskSetsLR.get(lrKey);
|
|
5091
5208
|
taskSetLR.merge(taskSetForSide);
|
|
5092
|
-
taskSetsForSide.delete(
|
|
5209
|
+
taskSetsForSide.delete(pairUidForSide);
|
|
5093
5210
|
}
|
|
5094
5211
|
}
|
|
5095
5212
|
}
|
|
5096
|
-
merge(this.taskSetsLR, this.taskSetsL, lKeyMappings);
|
|
5097
|
-
merge(this.taskSetsLR, this.taskSetsR, rKeyMappings);
|
|
5213
|
+
merge(this.taskSetsLR, this.taskSetsL, lKeyMappings, "L");
|
|
5214
|
+
merge(this.taskSetsLR, this.taskSetsR, rKeyMappings, "R");
|
|
5098
5215
|
const requests = [];
|
|
5099
5216
|
const batchSize = this.batchSize;
|
|
5100
5217
|
function addRequests(taskSets) {
|
|
@@ -5111,9 +5228,13 @@ var DataPlanner = class {
|
|
|
5111
5228
|
}
|
|
5112
5229
|
};
|
|
5113
5230
|
var DataTaskSet = class {
|
|
5114
|
-
constructor(scenarioSpecL, scenarioSpecR) {
|
|
5231
|
+
constructor(scenarioSpecL, scenarioSpecR, constantsL, constantsR, lookupsL, lookupsR) {
|
|
5115
5232
|
this.scenarioSpecL = scenarioSpecL;
|
|
5116
5233
|
this.scenarioSpecR = scenarioSpecR;
|
|
5234
|
+
this.constantsL = constantsL;
|
|
5235
|
+
this.constantsR = constantsR;
|
|
5236
|
+
this.lookupsL = lookupsL;
|
|
5237
|
+
this.lookupsR = lookupsR;
|
|
5117
5238
|
this.modelTasks = /* @__PURE__ */ new Map();
|
|
5118
5239
|
this.modelImplTasks = /* @__PURE__ */ new Map();
|
|
5119
5240
|
}
|
|
@@ -5168,6 +5289,10 @@ var DataTaskSet = class {
|
|
|
5168
5289
|
dataRequests.push({
|
|
5169
5290
|
scenarioSpecL: this.scenarioSpecL,
|
|
5170
5291
|
scenarioSpecR: this.scenarioSpecR,
|
|
5292
|
+
constantsL: this.constantsL,
|
|
5293
|
+
constantsR: this.constantsR,
|
|
5294
|
+
lookupsL: this.lookupsL,
|
|
5295
|
+
lookupsR: this.lookupsR,
|
|
5171
5296
|
dataTasks
|
|
5172
5297
|
});
|
|
5173
5298
|
}
|
|
@@ -5182,6 +5307,10 @@ var DataTaskSet = class {
|
|
|
5182
5307
|
dataRequests.push({
|
|
5183
5308
|
scenarioSpecL: this.scenarioSpecL,
|
|
5184
5309
|
scenarioSpecR: this.scenarioSpecR,
|
|
5310
|
+
constantsL: this.constantsL,
|
|
5311
|
+
constantsR: this.constantsR,
|
|
5312
|
+
lookupsL: this.lookupsL,
|
|
5313
|
+
lookupsR: this.lookupsR,
|
|
5185
5314
|
dataTasks
|
|
5186
5315
|
});
|
|
5187
5316
|
}
|
|
@@ -5189,10 +5318,76 @@ var DataTaskSet = class {
|
|
|
5189
5318
|
return dataRequests;
|
|
5190
5319
|
}
|
|
5191
5320
|
};
|
|
5192
|
-
function
|
|
5321
|
+
function constantsUid(constants) {
|
|
5322
|
+
if (!constants || constants.length === 0) {
|
|
5323
|
+
return "";
|
|
5324
|
+
}
|
|
5325
|
+
const sorted = [...constants].sort((a, b) => a.varId.localeCompare(b.varId));
|
|
5326
|
+
return sorted.map((c) => `${c.varId}=${c.value}`).join(",");
|
|
5327
|
+
}
|
|
5328
|
+
function lookupsUid(lookups) {
|
|
5329
|
+
if (!lookups || lookups.length === 0) {
|
|
5330
|
+
return "";
|
|
5331
|
+
}
|
|
5332
|
+
const sorted = [...lookups].sort((a, b) => a.varId.localeCompare(b.varId));
|
|
5333
|
+
return sorted.map((l) => {
|
|
5334
|
+
if (l.points === void 0) {
|
|
5335
|
+
return `${l.varId}=`;
|
|
5336
|
+
}
|
|
5337
|
+
return `${l.varId}=[${l.points.join(",")}]`;
|
|
5338
|
+
}).join(";");
|
|
5339
|
+
}
|
|
5340
|
+
function sideKey(scenarioUid, constUid, lookupUid) {
|
|
5341
|
+
let key = scenarioUid;
|
|
5342
|
+
if (constUid) {
|
|
5343
|
+
key += `##${constUid}`;
|
|
5344
|
+
}
|
|
5345
|
+
if (lookupUid) {
|
|
5346
|
+
key += `%%${lookupUid}`;
|
|
5347
|
+
}
|
|
5348
|
+
return key;
|
|
5349
|
+
}
|
|
5350
|
+
function parsePairUid(pairUid) {
|
|
5351
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5352
|
+
let rest = pairUid;
|
|
5353
|
+
let lookupsPart = "";
|
|
5354
|
+
const lookupsIdx = rest.indexOf("%%");
|
|
5355
|
+
if (lookupsIdx >= 0) {
|
|
5356
|
+
lookupsPart = rest.substring(lookupsIdx + 2);
|
|
5357
|
+
rest = rest.substring(0, lookupsIdx);
|
|
5358
|
+
}
|
|
5359
|
+
let constantsPart = "";
|
|
5360
|
+
const constantsIdx = rest.indexOf("##");
|
|
5361
|
+
if (constantsIdx >= 0) {
|
|
5362
|
+
constantsPart = rest.substring(constantsIdx + 2);
|
|
5363
|
+
rest = rest.substring(0, constantsIdx);
|
|
5364
|
+
}
|
|
5365
|
+
const scenarioParts = rest.split("::");
|
|
5366
|
+
const lScenarioUid = (_a = scenarioParts[0]) != null ? _a : "";
|
|
5367
|
+
const rScenarioUid = (_b = scenarioParts[1]) != null ? _b : "";
|
|
5368
|
+
const constantsParts = constantsPart.split("||");
|
|
5369
|
+
const lConstUid = constantsPart ? (_c = constantsParts[0]) != null ? _c : "" : "";
|
|
5370
|
+
const rConstUid = constantsPart ? (_d = constantsParts[1]) != null ? _d : "" : "";
|
|
5371
|
+
const lookupsParts = lookupsPart.split("||");
|
|
5372
|
+
const lLookupUid = lookupsPart ? (_e = lookupsParts[0]) != null ? _e : "" : "";
|
|
5373
|
+
const rLookupUid = lookupsPart ? (_f = lookupsParts[1]) != null ? _f : "" : "";
|
|
5374
|
+
return { lScenarioUid, rScenarioUid, lConstUid, rConstUid, lLookupUid, rLookupUid };
|
|
5375
|
+
}
|
|
5376
|
+
function scenarioPairUid(scenarioSpecL, scenarioSpecR, constantsL, constantsR, lookupsL, lookupsR) {
|
|
5193
5377
|
const uidL = (scenarioSpecL == null ? void 0 : scenarioSpecL.uid) || "";
|
|
5194
5378
|
const uidR = (scenarioSpecR == null ? void 0 : scenarioSpecR.uid) || "";
|
|
5195
|
-
|
|
5379
|
+
let uid = `${uidL}::${uidR}`;
|
|
5380
|
+
const constUidL = constantsUid(constantsL);
|
|
5381
|
+
const constUidR = constantsUid(constantsR);
|
|
5382
|
+
if (constUidL || constUidR) {
|
|
5383
|
+
uid += `##${constUidL}||${constUidR}`;
|
|
5384
|
+
}
|
|
5385
|
+
const lookupUidL = lookupsUid(lookupsL);
|
|
5386
|
+
const lookupUidR = lookupsUid(lookupsR);
|
|
5387
|
+
if (lookupUidL || lookupUidR) {
|
|
5388
|
+
uid += `%%${lookupUidL}||${lookupUidR}`;
|
|
5389
|
+
}
|
|
5390
|
+
return uid;
|
|
5196
5391
|
}
|
|
5197
5392
|
|
|
5198
5393
|
// src/check/check-runner.ts
|
|
@@ -5483,10 +5678,14 @@ var SuiteRunner = class {
|
|
|
5483
5678
|
datasetKeySet.add(dataTask.datasetKey);
|
|
5484
5679
|
}
|
|
5485
5680
|
const datasetKeys = [...datasetKeySet];
|
|
5486
|
-
function getDatasets(bundleModel, scenarioSpec) {
|
|
5681
|
+
function getDatasets(bundleModel, scenarioSpec, constants, lookups) {
|
|
5487
5682
|
return __async(this, null, function* () {
|
|
5488
5683
|
if (bundleModel && scenarioSpec) {
|
|
5489
|
-
|
|
5684
|
+
let options;
|
|
5685
|
+
if (constants || lookups) {
|
|
5686
|
+
options = { constants, lookups };
|
|
5687
|
+
}
|
|
5688
|
+
return bundleModel.getDatasetsForScenario(scenarioSpec, datasetKeys, options);
|
|
5490
5689
|
} else {
|
|
5491
5690
|
return void 0;
|
|
5492
5691
|
}
|
|
@@ -5495,8 +5694,8 @@ var SuiteRunner = class {
|
|
|
5495
5694
|
const bundleModelL = bundleModels.L;
|
|
5496
5695
|
const bundleModelR = bundleModels.R;
|
|
5497
5696
|
const [datasetsResultL, datasetsResultR] = yield Promise.all([
|
|
5498
|
-
getDatasets(bundleModelL, request.scenarioSpecL),
|
|
5499
|
-
getDatasets(bundleModelR, request.scenarioSpecR)
|
|
5697
|
+
getDatasets(bundleModelL, request.scenarioSpecL, request.constantsL, request.lookupsL),
|
|
5698
|
+
getDatasets(bundleModelR, request.scenarioSpecR, request.constantsR, request.lookupsR)
|
|
5500
5699
|
]);
|
|
5501
5700
|
if (datasetsResultL == null ? void 0 : datasetsResultL.modelRunTime) {
|
|
5502
5701
|
this.perfStatsL.addRun(datasetsResultL == null ? void 0 : datasetsResultL.modelRunTime);
|