@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.js
CHANGED
|
@@ -322,13 +322,29 @@ var CheckDataCoordinator = class {
|
|
|
322
322
|
constructor(taskQueue) {
|
|
323
323
|
this.taskQueue = taskQueue;
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
/**
|
|
326
|
+
* Request a dataset from the model.
|
|
327
|
+
*
|
|
328
|
+
* @param requestKey The unique key for the request.
|
|
329
|
+
* @param scenarioSpec The scenario spec that defines the inputs for the model run.
|
|
330
|
+
* @param datasetKey The key of the dataset to be fetched.
|
|
331
|
+
* @param options Optional configuration including constant and lookup overrides.
|
|
332
|
+
* @param onResponse The callback that will be called with the dataset.
|
|
333
|
+
*/
|
|
334
|
+
requestDataset(requestKey, scenarioSpec, datasetKey, options, onResponse) {
|
|
326
335
|
const task = {
|
|
327
336
|
key: requestKey,
|
|
328
337
|
kind: "check-data-coordinator",
|
|
329
338
|
process: (bundleModels) => __async(null, null, function* () {
|
|
330
339
|
const bundleModelR = bundleModels.R;
|
|
331
|
-
|
|
340
|
+
let getDatasetsOptions;
|
|
341
|
+
if ((options == null ? void 0 : options.constants) || (options == null ? void 0 : options.lookups)) {
|
|
342
|
+
getDatasetsOptions = {
|
|
343
|
+
constants: options.constants,
|
|
344
|
+
lookups: options.lookups
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
const result = yield bundleModelR.getDatasetsForScenario(scenarioSpec, [datasetKey], getDatasetsOptions);
|
|
332
348
|
const dataset = result.datasetMap.get(datasetKey);
|
|
333
349
|
onResponse(dataset);
|
|
334
350
|
})
|
|
@@ -1596,9 +1612,25 @@ function inputValueAtPosition(inputVar, position) {
|
|
|
1596
1612
|
case "at-default":
|
|
1597
1613
|
return inputVar.defaultValue;
|
|
1598
1614
|
case "at-minimum":
|
|
1599
|
-
|
|
1615
|
+
switch (inputVar.kind) {
|
|
1616
|
+
case "slider":
|
|
1617
|
+
return inputVar.minValue;
|
|
1618
|
+
case "switch":
|
|
1619
|
+
return inputVar.offValue;
|
|
1620
|
+
default:
|
|
1621
|
+
assertNever4(inputVar);
|
|
1622
|
+
}
|
|
1623
|
+
// eslint-disable-next-line no-fallthrough
|
|
1600
1624
|
case "at-maximum":
|
|
1601
|
-
|
|
1625
|
+
switch (inputVar.kind) {
|
|
1626
|
+
case "slider":
|
|
1627
|
+
return inputVar.maxValue;
|
|
1628
|
+
case "switch":
|
|
1629
|
+
return inputVar.onValue;
|
|
1630
|
+
default:
|
|
1631
|
+
assertNever4(inputVar);
|
|
1632
|
+
}
|
|
1633
|
+
// eslint-disable-next-line no-fallthrough
|
|
1602
1634
|
default:
|
|
1603
1635
|
assertNever4(position);
|
|
1604
1636
|
}
|
|
@@ -2027,14 +2059,19 @@ var ComparisonDataCoordinator = class {
|
|
|
2027
2059
|
* will be fetched from the "left" bundle's model, otherwise they will be fetched from
|
|
2028
2060
|
* the "right" bundle's model.
|
|
2029
2061
|
* @param scenarioSpecR The scenario used for the second ("right") model of the comparison.
|
|
2030
|
-
* @param
|
|
2062
|
+
* @param datasetKeys The keys of the datasets to be fetched.
|
|
2063
|
+
* @param options Optional configuration including constant and lookup overrides.
|
|
2031
2064
|
* @param onResponse The callback that will be called with the dataset maps.
|
|
2032
2065
|
*/
|
|
2033
|
-
requestDatasetMaps(requestKey, sourceL, scenarioSpecL, sourceR, scenarioSpecR, datasetKeys, onResponse) {
|
|
2034
|
-
function fetchDatasets(bundleModel, scenarioSpec) {
|
|
2066
|
+
requestDatasetMaps(requestKey, sourceL, scenarioSpecL, sourceR, scenarioSpecR, datasetKeys, options, onResponse) {
|
|
2067
|
+
function fetchDatasets(bundleModel, scenarioSpec, constants, lookups) {
|
|
2035
2068
|
return __async(this, null, function* () {
|
|
2036
2069
|
if (scenarioSpec) {
|
|
2037
|
-
|
|
2070
|
+
let getDatasetsOptions;
|
|
2071
|
+
if (constants || lookups) {
|
|
2072
|
+
getDatasetsOptions = { constants, lookups };
|
|
2073
|
+
}
|
|
2074
|
+
return bundleModel.getDatasetsForScenario(scenarioSpec, datasetKeys, getDatasetsOptions);
|
|
2038
2075
|
} else {
|
|
2039
2076
|
return void 0;
|
|
2040
2077
|
}
|
|
@@ -2049,12 +2086,12 @@ var ComparisonDataCoordinator = class {
|
|
|
2049
2086
|
let resultL;
|
|
2050
2087
|
let resultR;
|
|
2051
2088
|
if (modelL === modelR) {
|
|
2052
|
-
resultL = yield fetchDatasets(modelL, scenarioSpecL);
|
|
2053
|
-
resultR = yield fetchDatasets(modelR, scenarioSpecR);
|
|
2089
|
+
resultL = yield fetchDatasets(modelL, scenarioSpecL, options == null ? void 0 : options.constantsL, options == null ? void 0 : options.lookupsL);
|
|
2090
|
+
resultR = yield fetchDatasets(modelR, scenarioSpecR, options == null ? void 0 : options.constantsR, options == null ? void 0 : options.lookupsR);
|
|
2054
2091
|
} else {
|
|
2055
2092
|
const results = yield Promise.all([
|
|
2056
|
-
fetchDatasets(modelL, scenarioSpecL),
|
|
2057
|
-
fetchDatasets(modelR, scenarioSpecR)
|
|
2093
|
+
fetchDatasets(modelL, scenarioSpecL, options == null ? void 0 : options.constantsL, options == null ? void 0 : options.lookupsL),
|
|
2094
|
+
fetchDatasets(modelR, scenarioSpecR, options == null ? void 0 : options.constantsR, options == null ? void 0 : options.lookupsR)
|
|
2058
2095
|
]);
|
|
2059
2096
|
resultL = results[0];
|
|
2060
2097
|
resultR = results[1];
|
|
@@ -3914,7 +3951,18 @@ function resolveInputVarAtPosition(inputVar, position) {
|
|
|
3914
3951
|
};
|
|
3915
3952
|
}
|
|
3916
3953
|
function resolveInputVarAtValue(inputVar, value) {
|
|
3917
|
-
|
|
3954
|
+
let inRange;
|
|
3955
|
+
switch (inputVar.kind) {
|
|
3956
|
+
case "slider":
|
|
3957
|
+
inRange = value >= inputVar.minValue && value <= inputVar.maxValue;
|
|
3958
|
+
break;
|
|
3959
|
+
case "switch":
|
|
3960
|
+
inRange = value === inputVar.offValue || value === inputVar.onValue;
|
|
3961
|
+
break;
|
|
3962
|
+
default:
|
|
3963
|
+
assertNever10(inputVar);
|
|
3964
|
+
}
|
|
3965
|
+
if (inRange) {
|
|
3918
3966
|
return {
|
|
3919
3967
|
inputVar,
|
|
3920
3968
|
value
|
|
@@ -3944,9 +3992,25 @@ function inputValueAtPosition2(inputVar, position) {
|
|
|
3944
3992
|
case "at-default":
|
|
3945
3993
|
return inputVar.defaultValue;
|
|
3946
3994
|
case "at-minimum":
|
|
3947
|
-
|
|
3995
|
+
switch (inputVar.kind) {
|
|
3996
|
+
case "slider":
|
|
3997
|
+
return inputVar.minValue;
|
|
3998
|
+
case "switch":
|
|
3999
|
+
return inputVar.offValue;
|
|
4000
|
+
default:
|
|
4001
|
+
assertNever10(inputVar);
|
|
4002
|
+
}
|
|
4003
|
+
// eslint-disable-next-line no-fallthrough
|
|
3948
4004
|
case "at-maximum":
|
|
3949
|
-
|
|
4005
|
+
switch (inputVar.kind) {
|
|
4006
|
+
case "slider":
|
|
4007
|
+
return inputVar.maxValue;
|
|
4008
|
+
case "switch":
|
|
4009
|
+
return inputVar.onValue;
|
|
4010
|
+
default:
|
|
4011
|
+
assertNever10(inputVar);
|
|
4012
|
+
}
|
|
4013
|
+
// eslint-disable-next-line no-fallthrough
|
|
3950
4014
|
default:
|
|
3951
4015
|
assertNever10(position);
|
|
3952
4016
|
}
|
|
@@ -4478,12 +4542,12 @@ function handleRenames(origCurrentBundle, renamedDatasetKeys) {
|
|
|
4478
4542
|
var _a, _b, _c;
|
|
4479
4543
|
return {
|
|
4480
4544
|
modelSpec: origBundleModelR.modelSpec,
|
|
4481
|
-
getDatasetsForScenario: (scenarioSpec, datasetKeys) => __async(null, null, function* () {
|
|
4545
|
+
getDatasetsForScenario: (scenarioSpec, datasetKeys, options) => __async(null, null, function* () {
|
|
4482
4546
|
const rightKeySet = /* @__PURE__ */ new Set();
|
|
4483
4547
|
for (const key of datasetKeys) {
|
|
4484
4548
|
rightKeySet.add(rightKeyForLeftKey(key));
|
|
4485
4549
|
}
|
|
4486
|
-
const result = yield origBundleModelR.getDatasetsForScenario(scenarioSpec, [...rightKeySet]);
|
|
4550
|
+
const result = yield origBundleModelR.getDatasetsForScenario(scenarioSpec, [...rightKeySet], options);
|
|
4487
4551
|
const resultMap = /* @__PURE__ */ new Map();
|
|
4488
4552
|
for (const [rightKey, dataset] of result.datasetMap.entries()) {
|
|
4489
4553
|
resultMap.set(rightKey, dataset);
|
|
@@ -4512,34 +4576,76 @@ function handleRenames(origCurrentBundle, renamedDatasetKeys) {
|
|
|
4512
4576
|
import { assertNever as assertNever11 } from "assert-never";
|
|
4513
4577
|
|
|
4514
4578
|
// src/perf/perf-stats.ts
|
|
4579
|
+
function percentile(sorted, p) {
|
|
4580
|
+
if (sorted.length === 1) {
|
|
4581
|
+
return sorted[0];
|
|
4582
|
+
}
|
|
4583
|
+
const rank = p * (sorted.length - 1);
|
|
4584
|
+
const lo = Math.floor(rank);
|
|
4585
|
+
const hi = Math.ceil(rank);
|
|
4586
|
+
if (lo === hi) {
|
|
4587
|
+
return sorted[lo];
|
|
4588
|
+
}
|
|
4589
|
+
const frac = rank - lo;
|
|
4590
|
+
return sorted[lo] + (sorted[hi] - sorted[lo]) * frac;
|
|
4591
|
+
}
|
|
4515
4592
|
var PerfStats = class {
|
|
4516
4593
|
constructor() {
|
|
4517
4594
|
this.times = [];
|
|
4518
4595
|
}
|
|
4596
|
+
/**
|
|
4597
|
+
* Record a single run time sample.
|
|
4598
|
+
*
|
|
4599
|
+
* @param timeInMillis The run time in milliseconds.
|
|
4600
|
+
*/
|
|
4519
4601
|
addRun(timeInMillis) {
|
|
4520
4602
|
this.times.push(timeInMillis);
|
|
4521
4603
|
}
|
|
4604
|
+
/**
|
|
4605
|
+
* Get the raw run time samples that have been recorded.
|
|
4606
|
+
*
|
|
4607
|
+
* @returns A copy of the recorded run times, in insertion order.
|
|
4608
|
+
*/
|
|
4609
|
+
getTimes() {
|
|
4610
|
+
return this.times.slice();
|
|
4611
|
+
}
|
|
4612
|
+
/**
|
|
4613
|
+
* Produce a `PerfReport` summarizing the recorded samples.
|
|
4614
|
+
*
|
|
4615
|
+
* @returns The summary report.
|
|
4616
|
+
*/
|
|
4522
4617
|
toReport() {
|
|
4523
4618
|
if (this.times.length === 0) {
|
|
4524
4619
|
return {
|
|
4525
4620
|
minTime: 0,
|
|
4526
4621
|
maxTime: 0,
|
|
4527
4622
|
avgTime: 0,
|
|
4623
|
+
medianTime: 0,
|
|
4624
|
+
p95Time: 0,
|
|
4625
|
+
stdDev: 0,
|
|
4528
4626
|
allTimes: []
|
|
4529
4627
|
};
|
|
4530
4628
|
}
|
|
4531
|
-
const
|
|
4532
|
-
const
|
|
4533
|
-
const
|
|
4534
|
-
const
|
|
4535
|
-
const
|
|
4629
|
+
const sortedTimes = this.times.slice().sort((a, b) => a - b);
|
|
4630
|
+
const n = sortedTimes.length;
|
|
4631
|
+
const minTime = sortedTimes[0];
|
|
4632
|
+
const maxTime = sortedTimes[n - 1];
|
|
4633
|
+
const minIndex = Math.floor(n / 4);
|
|
4634
|
+
const maxIndex = minIndex + Math.max(1, Math.ceil(n / 2));
|
|
4536
4635
|
const middleTimes = sortedTimes.slice(minIndex, maxIndex);
|
|
4537
|
-
const
|
|
4538
|
-
const
|
|
4636
|
+
const avgTime = middleTimes.reduce((a, b) => a + b, 0) / middleTimes.length;
|
|
4637
|
+
const medianTime = percentile(sortedTimes, 0.5);
|
|
4638
|
+
const p95Time = percentile(sortedTimes, 0.95);
|
|
4639
|
+
const mean = sortedTimes.reduce((a, b) => a + b, 0) / n;
|
|
4640
|
+
const variance = sortedTimes.reduce((acc, t) => acc + (t - mean) * (t - mean), 0) / n;
|
|
4641
|
+
const stdDev = Math.sqrt(variance);
|
|
4539
4642
|
return {
|
|
4540
4643
|
minTime,
|
|
4541
4644
|
maxTime,
|
|
4542
4645
|
avgTime,
|
|
4646
|
+
medianTime,
|
|
4647
|
+
p95Time,
|
|
4648
|
+
stdDev,
|
|
4543
4649
|
allTimes: sortedTimes
|
|
4544
4650
|
};
|
|
4545
4651
|
}
|
|
@@ -4981,8 +5087,12 @@ var DataPlanner = class {
|
|
|
4981
5087
|
* is needed from the right model.
|
|
4982
5088
|
* @param datasetKey The key for the dataset to be fetched from each model for the given scenario.
|
|
4983
5089
|
* @param dataAction The action to be performed with the fetched datasets.
|
|
5090
|
+
* @param constantsL Optional constant overrides for the "left" model.
|
|
5091
|
+
* @param constantsR Optional constant overrides for the "right" model.
|
|
5092
|
+
* @param lookupsL Optional lookup overrides for the "left" model.
|
|
5093
|
+
* @param lookupsR Optional lookup overrides for the "right" model.
|
|
4984
5094
|
*/
|
|
4985
|
-
addRequest(scenarioSpecL, scenarioSpecR, datasetKey, dataAction) {
|
|
5095
|
+
addRequest(scenarioSpecL, scenarioSpecR, datasetKey, dataAction, constantsL, constantsR, lookupsL, lookupsR) {
|
|
4986
5096
|
if (scenarioSpecL === void 0 && scenarioSpecR === void 0) {
|
|
4987
5097
|
console.warn("WARNING: Both scenario specs are undefined for DataPlanner request, skipping");
|
|
4988
5098
|
return;
|
|
@@ -4991,17 +5101,17 @@ var DataPlanner = class {
|
|
|
4991
5101
|
let uid;
|
|
4992
5102
|
if (scenarioSpecL && scenarioSpecR) {
|
|
4993
5103
|
taskSetsMap = this.taskSetsLR;
|
|
4994
|
-
uid = scenarioPairUid(scenarioSpecL, scenarioSpecR);
|
|
5104
|
+
uid = scenarioPairUid(scenarioSpecL, scenarioSpecR, constantsL, constantsR, lookupsL, lookupsR);
|
|
4995
5105
|
} else if (scenarioSpecR) {
|
|
4996
5106
|
taskSetsMap = this.taskSetsR;
|
|
4997
|
-
uid = scenarioSpecR
|
|
5107
|
+
uid = scenarioPairUid(void 0, scenarioSpecR, void 0, constantsR, void 0, lookupsR);
|
|
4998
5108
|
} else {
|
|
4999
5109
|
taskSetsMap = this.taskSetsL;
|
|
5000
|
-
uid = scenarioSpecL
|
|
5110
|
+
uid = scenarioPairUid(scenarioSpecL, void 0, constantsL, void 0, lookupsL, void 0);
|
|
5001
5111
|
}
|
|
5002
5112
|
let taskSet = taskSetsMap.get(uid);
|
|
5003
5113
|
if (!taskSet) {
|
|
5004
|
-
taskSet = new DataTaskSet(scenarioSpecL, scenarioSpecR);
|
|
5114
|
+
taskSet = new DataTaskSet(scenarioSpecL, scenarioSpecR, constantsL, constantsR, lookupsL, lookupsR);
|
|
5005
5115
|
taskSetsMap.set(uid, taskSet);
|
|
5006
5116
|
}
|
|
5007
5117
|
taskSet.addTask({
|
|
@@ -5020,26 +5130,33 @@ var DataPlanner = class {
|
|
|
5020
5130
|
const lKeyMappings = /* @__PURE__ */ new Map();
|
|
5021
5131
|
const rKeyMappings = /* @__PURE__ */ new Map();
|
|
5022
5132
|
for (const lrUid of this.taskSetsLR.keys()) {
|
|
5023
|
-
const
|
|
5024
|
-
|
|
5025
|
-
|
|
5133
|
+
const parsed = parsePairUid(lrUid);
|
|
5134
|
+
const lKey = sideKey(parsed.lScenarioUid, parsed.lConstUid, parsed.lLookupUid);
|
|
5135
|
+
const rKey = sideKey(parsed.rScenarioUid, parsed.rConstUid, parsed.rLookupUid);
|
|
5136
|
+
if (parsed.lScenarioUid && !lKeyMappings.has(lKey)) {
|
|
5137
|
+
lKeyMappings.set(lKey, lrUid);
|
|
5026
5138
|
}
|
|
5027
|
-
if (!rKeyMappings.has(
|
|
5028
|
-
rKeyMappings.set(
|
|
5139
|
+
if (parsed.rScenarioUid && !rKeyMappings.has(rKey)) {
|
|
5140
|
+
rKeyMappings.set(rKey, lrUid);
|
|
5029
5141
|
}
|
|
5030
5142
|
}
|
|
5031
|
-
function merge(taskSetsLR, taskSetsForSide, keyMappingsForSide) {
|
|
5032
|
-
for (const [
|
|
5033
|
-
const
|
|
5143
|
+
function merge(taskSetsLR, taskSetsForSide, keyMappingsForSide, side) {
|
|
5144
|
+
for (const [pairUidForSide, taskSetForSide] of taskSetsForSide.entries()) {
|
|
5145
|
+
const parsed = parsePairUid(pairUidForSide);
|
|
5146
|
+
const scenarioUid = side === "L" ? parsed.lScenarioUid : parsed.rScenarioUid;
|
|
5147
|
+
const constUid = side === "L" ? parsed.lConstUid : parsed.rConstUid;
|
|
5148
|
+
const lookupUid = side === "L" ? parsed.lLookupUid : parsed.rLookupUid;
|
|
5149
|
+
const sKey = sideKey(scenarioUid, constUid, lookupUid);
|
|
5150
|
+
const lrKey = keyMappingsForSide.get(sKey);
|
|
5034
5151
|
if (lrKey) {
|
|
5035
5152
|
const taskSetLR = taskSetsLR.get(lrKey);
|
|
5036
5153
|
taskSetLR.merge(taskSetForSide);
|
|
5037
|
-
taskSetsForSide.delete(
|
|
5154
|
+
taskSetsForSide.delete(pairUidForSide);
|
|
5038
5155
|
}
|
|
5039
5156
|
}
|
|
5040
5157
|
}
|
|
5041
|
-
merge(this.taskSetsLR, this.taskSetsL, lKeyMappings);
|
|
5042
|
-
merge(this.taskSetsLR, this.taskSetsR, rKeyMappings);
|
|
5158
|
+
merge(this.taskSetsLR, this.taskSetsL, lKeyMappings, "L");
|
|
5159
|
+
merge(this.taskSetsLR, this.taskSetsR, rKeyMappings, "R");
|
|
5043
5160
|
const requests = [];
|
|
5044
5161
|
const batchSize = this.batchSize;
|
|
5045
5162
|
function addRequests(taskSets) {
|
|
@@ -5056,9 +5173,13 @@ var DataPlanner = class {
|
|
|
5056
5173
|
}
|
|
5057
5174
|
};
|
|
5058
5175
|
var DataTaskSet = class {
|
|
5059
|
-
constructor(scenarioSpecL, scenarioSpecR) {
|
|
5176
|
+
constructor(scenarioSpecL, scenarioSpecR, constantsL, constantsR, lookupsL, lookupsR) {
|
|
5060
5177
|
this.scenarioSpecL = scenarioSpecL;
|
|
5061
5178
|
this.scenarioSpecR = scenarioSpecR;
|
|
5179
|
+
this.constantsL = constantsL;
|
|
5180
|
+
this.constantsR = constantsR;
|
|
5181
|
+
this.lookupsL = lookupsL;
|
|
5182
|
+
this.lookupsR = lookupsR;
|
|
5062
5183
|
this.modelTasks = /* @__PURE__ */ new Map();
|
|
5063
5184
|
this.modelImplTasks = /* @__PURE__ */ new Map();
|
|
5064
5185
|
}
|
|
@@ -5113,6 +5234,10 @@ var DataTaskSet = class {
|
|
|
5113
5234
|
dataRequests.push({
|
|
5114
5235
|
scenarioSpecL: this.scenarioSpecL,
|
|
5115
5236
|
scenarioSpecR: this.scenarioSpecR,
|
|
5237
|
+
constantsL: this.constantsL,
|
|
5238
|
+
constantsR: this.constantsR,
|
|
5239
|
+
lookupsL: this.lookupsL,
|
|
5240
|
+
lookupsR: this.lookupsR,
|
|
5116
5241
|
dataTasks
|
|
5117
5242
|
});
|
|
5118
5243
|
}
|
|
@@ -5127,6 +5252,10 @@ var DataTaskSet = class {
|
|
|
5127
5252
|
dataRequests.push({
|
|
5128
5253
|
scenarioSpecL: this.scenarioSpecL,
|
|
5129
5254
|
scenarioSpecR: this.scenarioSpecR,
|
|
5255
|
+
constantsL: this.constantsL,
|
|
5256
|
+
constantsR: this.constantsR,
|
|
5257
|
+
lookupsL: this.lookupsL,
|
|
5258
|
+
lookupsR: this.lookupsR,
|
|
5130
5259
|
dataTasks
|
|
5131
5260
|
});
|
|
5132
5261
|
}
|
|
@@ -5134,10 +5263,76 @@ var DataTaskSet = class {
|
|
|
5134
5263
|
return dataRequests;
|
|
5135
5264
|
}
|
|
5136
5265
|
};
|
|
5137
|
-
function
|
|
5266
|
+
function constantsUid(constants) {
|
|
5267
|
+
if (!constants || constants.length === 0) {
|
|
5268
|
+
return "";
|
|
5269
|
+
}
|
|
5270
|
+
const sorted = [...constants].sort((a, b) => a.varId.localeCompare(b.varId));
|
|
5271
|
+
return sorted.map((c) => `${c.varId}=${c.value}`).join(",");
|
|
5272
|
+
}
|
|
5273
|
+
function lookupsUid(lookups) {
|
|
5274
|
+
if (!lookups || lookups.length === 0) {
|
|
5275
|
+
return "";
|
|
5276
|
+
}
|
|
5277
|
+
const sorted = [...lookups].sort((a, b) => a.varId.localeCompare(b.varId));
|
|
5278
|
+
return sorted.map((l) => {
|
|
5279
|
+
if (l.points === void 0) {
|
|
5280
|
+
return `${l.varId}=`;
|
|
5281
|
+
}
|
|
5282
|
+
return `${l.varId}=[${l.points.join(",")}]`;
|
|
5283
|
+
}).join(";");
|
|
5284
|
+
}
|
|
5285
|
+
function sideKey(scenarioUid, constUid, lookupUid) {
|
|
5286
|
+
let key = scenarioUid;
|
|
5287
|
+
if (constUid) {
|
|
5288
|
+
key += `##${constUid}`;
|
|
5289
|
+
}
|
|
5290
|
+
if (lookupUid) {
|
|
5291
|
+
key += `%%${lookupUid}`;
|
|
5292
|
+
}
|
|
5293
|
+
return key;
|
|
5294
|
+
}
|
|
5295
|
+
function parsePairUid(pairUid) {
|
|
5296
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5297
|
+
let rest = pairUid;
|
|
5298
|
+
let lookupsPart = "";
|
|
5299
|
+
const lookupsIdx = rest.indexOf("%%");
|
|
5300
|
+
if (lookupsIdx >= 0) {
|
|
5301
|
+
lookupsPart = rest.substring(lookupsIdx + 2);
|
|
5302
|
+
rest = rest.substring(0, lookupsIdx);
|
|
5303
|
+
}
|
|
5304
|
+
let constantsPart = "";
|
|
5305
|
+
const constantsIdx = rest.indexOf("##");
|
|
5306
|
+
if (constantsIdx >= 0) {
|
|
5307
|
+
constantsPart = rest.substring(constantsIdx + 2);
|
|
5308
|
+
rest = rest.substring(0, constantsIdx);
|
|
5309
|
+
}
|
|
5310
|
+
const scenarioParts = rest.split("::");
|
|
5311
|
+
const lScenarioUid = (_a = scenarioParts[0]) != null ? _a : "";
|
|
5312
|
+
const rScenarioUid = (_b = scenarioParts[1]) != null ? _b : "";
|
|
5313
|
+
const constantsParts = constantsPart.split("||");
|
|
5314
|
+
const lConstUid = constantsPart ? (_c = constantsParts[0]) != null ? _c : "" : "";
|
|
5315
|
+
const rConstUid = constantsPart ? (_d = constantsParts[1]) != null ? _d : "" : "";
|
|
5316
|
+
const lookupsParts = lookupsPart.split("||");
|
|
5317
|
+
const lLookupUid = lookupsPart ? (_e = lookupsParts[0]) != null ? _e : "" : "";
|
|
5318
|
+
const rLookupUid = lookupsPart ? (_f = lookupsParts[1]) != null ? _f : "" : "";
|
|
5319
|
+
return { lScenarioUid, rScenarioUid, lConstUid, rConstUid, lLookupUid, rLookupUid };
|
|
5320
|
+
}
|
|
5321
|
+
function scenarioPairUid(scenarioSpecL, scenarioSpecR, constantsL, constantsR, lookupsL, lookupsR) {
|
|
5138
5322
|
const uidL = (scenarioSpecL == null ? void 0 : scenarioSpecL.uid) || "";
|
|
5139
5323
|
const uidR = (scenarioSpecR == null ? void 0 : scenarioSpecR.uid) || "";
|
|
5140
|
-
|
|
5324
|
+
let uid = `${uidL}::${uidR}`;
|
|
5325
|
+
const constUidL = constantsUid(constantsL);
|
|
5326
|
+
const constUidR = constantsUid(constantsR);
|
|
5327
|
+
if (constUidL || constUidR) {
|
|
5328
|
+
uid += `##${constUidL}||${constUidR}`;
|
|
5329
|
+
}
|
|
5330
|
+
const lookupUidL = lookupsUid(lookupsL);
|
|
5331
|
+
const lookupUidR = lookupsUid(lookupsR);
|
|
5332
|
+
if (lookupUidL || lookupUidR) {
|
|
5333
|
+
uid += `%%${lookupUidL}||${lookupUidR}`;
|
|
5334
|
+
}
|
|
5335
|
+
return uid;
|
|
5141
5336
|
}
|
|
5142
5337
|
|
|
5143
5338
|
// src/check/check-runner.ts
|
|
@@ -5428,10 +5623,14 @@ var SuiteRunner = class {
|
|
|
5428
5623
|
datasetKeySet.add(dataTask.datasetKey);
|
|
5429
5624
|
}
|
|
5430
5625
|
const datasetKeys = [...datasetKeySet];
|
|
5431
|
-
function getDatasets(bundleModel, scenarioSpec) {
|
|
5626
|
+
function getDatasets(bundleModel, scenarioSpec, constants, lookups) {
|
|
5432
5627
|
return __async(this, null, function* () {
|
|
5433
5628
|
if (bundleModel && scenarioSpec) {
|
|
5434
|
-
|
|
5629
|
+
let options;
|
|
5630
|
+
if (constants || lookups) {
|
|
5631
|
+
options = { constants, lookups };
|
|
5632
|
+
}
|
|
5633
|
+
return bundleModel.getDatasetsForScenario(scenarioSpec, datasetKeys, options);
|
|
5435
5634
|
} else {
|
|
5436
5635
|
return void 0;
|
|
5437
5636
|
}
|
|
@@ -5440,8 +5639,8 @@ var SuiteRunner = class {
|
|
|
5440
5639
|
const bundleModelL = bundleModels.L;
|
|
5441
5640
|
const bundleModelR = bundleModels.R;
|
|
5442
5641
|
const [datasetsResultL, datasetsResultR] = yield Promise.all([
|
|
5443
|
-
getDatasets(bundleModelL, request.scenarioSpecL),
|
|
5444
|
-
getDatasets(bundleModelR, request.scenarioSpecR)
|
|
5642
|
+
getDatasets(bundleModelL, request.scenarioSpecL, request.constantsL, request.lookupsL),
|
|
5643
|
+
getDatasets(bundleModelR, request.scenarioSpecR, request.constantsR, request.lookupsR)
|
|
5445
5644
|
]);
|
|
5446
5645
|
if (datasetsResultL == null ? void 0 : datasetsResultL.modelRunTime) {
|
|
5447
5646
|
this.perfStatsL.addRun(datasetsResultL == null ? void 0 : datasetsResultL.modelRunTime);
|