viberadar 0.3.227 → 0.3.229

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,UAAU,EAA4H,MAAM,YAAY,CAAC;AAiBlK,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB;AA0vED,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAgsH1G"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,UAAU,EAA4H,MAAM,YAAY,CAAC;AAiBlK,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB;AA0vED,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAutH1G"}
@@ -2322,14 +2322,21 @@ function startServer({ data: initialData, port, projectRoot }) {
2322
2322
  }
2323
2323
  return { config, envVars, dataDir, resultDir };
2324
2324
  }
2325
+ function k6CollectionValues(value) {
2326
+ if (Array.isArray(value))
2327
+ return value;
2328
+ if (value && typeof value === 'object')
2329
+ return Object.values(value);
2330
+ return [];
2331
+ }
2325
2332
  function flattenK6Checks(group) {
2326
2333
  let passes = 0;
2327
2334
  let fails = 0;
2328
- for (const check of group?.checks || []) {
2335
+ for (const check of k6CollectionValues(group?.checks)) {
2329
2336
  passes += Number(check.passes || 0);
2330
2337
  fails += Number(check.fails || 0);
2331
2338
  }
2332
- for (const child of group?.groups || []) {
2339
+ for (const child of k6CollectionValues(group?.groups)) {
2333
2340
  const nested = flattenK6Checks(child);
2334
2341
  passes += nested.passes;
2335
2342
  fails += nested.fails;
@@ -2587,9 +2594,29 @@ function startServer({ data: initialData, port, projectRoot }) {
2587
2594
  if (!latest)
2588
2595
  return;
2589
2596
  try {
2590
- const record = JSON.parse(fs.readFileSync(path.join(loadRunsDir, `${latest.runId}.json`), 'utf-8'));
2591
- if (record && typeof record === 'object')
2597
+ const runPath = path.join(loadRunsDir, `${latest.runId}.json`);
2598
+ const parsed = JSON.parse(fs.readFileSync(runPath, 'utf-8'));
2599
+ if (parsed && typeof parsed === 'object') {
2600
+ const { record, changed } = enrichLoadRunRecord(parsed);
2592
2601
  loadState = record;
2602
+ if (changed) {
2603
+ try {
2604
+ fs.writeFileSync(runPath, JSON.stringify(record, null, 2), 'utf-8');
2605
+ }
2606
+ catch { }
2607
+ try {
2608
+ const index = readLoadRunIndex();
2609
+ const item = index.find((i) => i.runId === latest.runId);
2610
+ if (item) {
2611
+ item.summary = record.summary;
2612
+ item.status = record.status;
2613
+ item.endTime = record.endTime;
2614
+ writeLoadRunIndex(index);
2615
+ }
2616
+ }
2617
+ catch { }
2618
+ }
2619
+ }
2593
2620
  }
2594
2621
  catch { }
2595
2622
  }