@sdeverywhere/check-core 0.1.7 → 0.1.9

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.js CHANGED
@@ -4479,16 +4479,21 @@ function handleRenames(origCurrentBundle, renamedDatasetKeys) {
4479
4479
  return {
4480
4480
  modelSpec: origBundleModelR.modelSpec,
4481
4481
  getDatasetsForScenario: (scenarioSpec, datasetKeys) => __async(null, null, function* () {
4482
- const rightKeys = datasetKeys.map(rightKeyForLeftKey);
4483
- const result = yield origBundleModelR.getDatasetsForScenario(scenarioSpec, rightKeys);
4484
- const mapWithRightKeys = result.datasetMap;
4485
- const mapWithLeftKeys = /* @__PURE__ */ new Map();
4486
- for (const [rightKey, dataset] of mapWithRightKeys.entries()) {
4482
+ const rightKeySet = /* @__PURE__ */ new Set();
4483
+ for (const key of datasetKeys) {
4484
+ rightKeySet.add(rightKeyForLeftKey(key));
4485
+ }
4486
+ const result = yield origBundleModelR.getDatasetsForScenario(scenarioSpec, [...rightKeySet]);
4487
+ const resultMap = /* @__PURE__ */ new Map();
4488
+ for (const [rightKey, dataset] of result.datasetMap.entries()) {
4489
+ resultMap.set(rightKey, dataset);
4487
4490
  const leftKey = leftKeyForRightKey(rightKey);
4488
- mapWithLeftKeys.set(leftKey, dataset);
4491
+ if (leftKey !== rightKey) {
4492
+ resultMap.set(leftKey, dataset);
4493
+ }
4489
4494
  }
4490
4495
  return {
4491
- datasetMap: mapWithLeftKeys,
4496
+ datasetMap: resultMap,
4492
4497
  modelRunTime: result.modelRunTime
4493
4498
  };
4494
4499
  }),
@@ -5315,10 +5320,31 @@ var SuiteRunner = class {
5315
5320
  }
5316
5321
  this.stopped = true;
5317
5322
  }
5323
+ this.removeIdleListener();
5324
+ }
5325
+ /**
5326
+ * Remove the idle listener from the task queue, if one is registered.
5327
+ */
5328
+ removeIdleListener() {
5329
+ if (this.idleListener) {
5330
+ this.taskQueue.removeIdleListener(this.idleListener);
5331
+ this.idleListener = void 0;
5332
+ }
5318
5333
  }
5319
5334
  start(options) {
5320
5335
  var _a, _b, _c, _d, _e, _f, _g, _h;
5321
5336
  (_b = (_a = this.callbacks).onProgress) == null ? void 0 : _b.call(_a, 0);
5337
+ this.idleListener = (error) => {
5338
+ var _a2, _b2;
5339
+ if (error) {
5340
+ this.removeIdleListener();
5341
+ if (!this.stopped) {
5342
+ this.stopped = true;
5343
+ (_b2 = (_a2 = this.callbacks).onError) == null ? void 0 : _b2.call(_a2, error);
5344
+ }
5345
+ }
5346
+ };
5347
+ this.taskQueue.onIdle(this.idleListener);
5322
5348
  const modelSpecR = this.config.check.bundle.modelSpec;
5323
5349
  const dataPlanner = new DataPlanner(modelSpecR.outputVars.size);
5324
5350
  const refDataPlanner = new DataPlanner(modelSpecR.outputVars.size);
@@ -5357,25 +5383,22 @@ var SuiteRunner = class {
5357
5383
  });
5358
5384
  return;
5359
5385
  }
5360
- const buildReport = (error) => {
5361
- var _a2, _b2, _c2, _d2;
5362
- if (error) {
5363
- (_b2 = (_a2 = this.callbacks).onError) == null ? void 0 : _b2.call(_a2, error);
5364
- } else {
5365
- const checkReport = buildCheckReport2();
5366
- let comparisonReport;
5367
- if (this.config.comparison) {
5368
- comparisonReport = {
5369
- testReports: buildComparisonTestReports(),
5370
- perfReportL: this.perfStatsL.toReport(),
5371
- perfReportR: this.perfStatsR.toReport()
5372
- };
5373
- }
5374
- (_d2 = (_c2 = this.callbacks).onComplete) == null ? void 0 : _d2.call(_c2, {
5375
- checkReport,
5376
- comparisonReport
5377
- });
5386
+ const buildReport = () => {
5387
+ var _a2, _b2;
5388
+ this.removeIdleListener();
5389
+ const checkReport = buildCheckReport2();
5390
+ let comparisonReport;
5391
+ if (this.config.comparison) {
5392
+ comparisonReport = {
5393
+ testReports: buildComparisonTestReports(),
5394
+ perfReportL: this.perfStatsL.toReport(),
5395
+ perfReportR: this.perfStatsR.toReport()
5396
+ };
5378
5397
  }
5398
+ (_b2 = (_a2 = this.callbacks).onComplete) == null ? void 0 : _b2.call(_a2, {
5399
+ checkReport,
5400
+ comparisonReport
5401
+ });
5379
5402
  };
5380
5403
  let tasksCompleted = 0;
5381
5404
  let dataTaskId = 1;