@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.cjs CHANGED
@@ -4534,16 +4534,21 @@ function handleRenames(origCurrentBundle, renamedDatasetKeys) {
4534
4534
  return {
4535
4535
  modelSpec: origBundleModelR.modelSpec,
4536
4536
  getDatasetsForScenario: (scenarioSpec, datasetKeys) => __async(null, null, function* () {
4537
- const rightKeys = datasetKeys.map(rightKeyForLeftKey);
4538
- const result = yield origBundleModelR.getDatasetsForScenario(scenarioSpec, rightKeys);
4539
- const mapWithRightKeys = result.datasetMap;
4540
- const mapWithLeftKeys = /* @__PURE__ */ new Map();
4541
- for (const [rightKey, dataset] of mapWithRightKeys.entries()) {
4537
+ const rightKeySet = /* @__PURE__ */ new Set();
4538
+ for (const key of datasetKeys) {
4539
+ rightKeySet.add(rightKeyForLeftKey(key));
4540
+ }
4541
+ const result = yield origBundleModelR.getDatasetsForScenario(scenarioSpec, [...rightKeySet]);
4542
+ const resultMap = /* @__PURE__ */ new Map();
4543
+ for (const [rightKey, dataset] of result.datasetMap.entries()) {
4544
+ resultMap.set(rightKey, dataset);
4542
4545
  const leftKey = leftKeyForRightKey(rightKey);
4543
- mapWithLeftKeys.set(leftKey, dataset);
4546
+ if (leftKey !== rightKey) {
4547
+ resultMap.set(leftKey, dataset);
4548
+ }
4544
4549
  }
4545
4550
  return {
4546
- datasetMap: mapWithLeftKeys,
4551
+ datasetMap: resultMap,
4547
4552
  modelRunTime: result.modelRunTime
4548
4553
  };
4549
4554
  }),
@@ -5370,10 +5375,31 @@ var SuiteRunner = class {
5370
5375
  }
5371
5376
  this.stopped = true;
5372
5377
  }
5378
+ this.removeIdleListener();
5379
+ }
5380
+ /**
5381
+ * Remove the idle listener from the task queue, if one is registered.
5382
+ */
5383
+ removeIdleListener() {
5384
+ if (this.idleListener) {
5385
+ this.taskQueue.removeIdleListener(this.idleListener);
5386
+ this.idleListener = void 0;
5387
+ }
5373
5388
  }
5374
5389
  start(options) {
5375
5390
  var _a, _b, _c, _d, _e, _f, _g, _h;
5376
5391
  (_b = (_a = this.callbacks).onProgress) == null ? void 0 : _b.call(_a, 0);
5392
+ this.idleListener = (error) => {
5393
+ var _a2, _b2;
5394
+ if (error) {
5395
+ this.removeIdleListener();
5396
+ if (!this.stopped) {
5397
+ this.stopped = true;
5398
+ (_b2 = (_a2 = this.callbacks).onError) == null ? void 0 : _b2.call(_a2, error);
5399
+ }
5400
+ }
5401
+ };
5402
+ this.taskQueue.onIdle(this.idleListener);
5377
5403
  const modelSpecR = this.config.check.bundle.modelSpec;
5378
5404
  const dataPlanner = new DataPlanner(modelSpecR.outputVars.size);
5379
5405
  const refDataPlanner = new DataPlanner(modelSpecR.outputVars.size);
@@ -5412,25 +5438,22 @@ var SuiteRunner = class {
5412
5438
  });
5413
5439
  return;
5414
5440
  }
5415
- const buildReport = (error) => {
5416
- var _a2, _b2, _c2, _d2;
5417
- if (error) {
5418
- (_b2 = (_a2 = this.callbacks).onError) == null ? void 0 : _b2.call(_a2, error);
5419
- } else {
5420
- const checkReport = buildCheckReport2();
5421
- let comparisonReport;
5422
- if (this.config.comparison) {
5423
- comparisonReport = {
5424
- testReports: buildComparisonTestReports(),
5425
- perfReportL: this.perfStatsL.toReport(),
5426
- perfReportR: this.perfStatsR.toReport()
5427
- };
5428
- }
5429
- (_d2 = (_c2 = this.callbacks).onComplete) == null ? void 0 : _d2.call(_c2, {
5430
- checkReport,
5431
- comparisonReport
5432
- });
5441
+ const buildReport = () => {
5442
+ var _a2, _b2;
5443
+ this.removeIdleListener();
5444
+ const checkReport = buildCheckReport2();
5445
+ let comparisonReport;
5446
+ if (this.config.comparison) {
5447
+ comparisonReport = {
5448
+ testReports: buildComparisonTestReports(),
5449
+ perfReportL: this.perfStatsL.toReport(),
5450
+ perfReportR: this.perfStatsR.toReport()
5451
+ };
5433
5452
  }
5453
+ (_b2 = (_a2 = this.callbacks).onComplete) == null ? void 0 : _b2.call(_a2, {
5454
+ checkReport,
5455
+ comparisonReport
5456
+ });
5434
5457
  };
5435
5458
  let tasksCompleted = 0;
5436
5459
  let dataTaskId = 1;