viberadar 0.3.224 → 0.3.225
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,
|
|
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"}
|
package/dist/server/index.js
CHANGED
|
@@ -2557,6 +2557,31 @@ function startServer({ data: initialData, port, projectRoot }) {
|
|
|
2557
2557
|
catch { }
|
|
2558
2558
|
}
|
|
2559
2559
|
}
|
|
2560
|
+
function enrichLoadRunRecord(record) {
|
|
2561
|
+
if (Array.isArray(record.summary?.endpoints) && record.summary.endpoints.length > 0) {
|
|
2562
|
+
return { record, changed: false };
|
|
2563
|
+
}
|
|
2564
|
+
const resultPath = record.config?.resultPath;
|
|
2565
|
+
if (!resultPath || typeof resultPath !== 'string') {
|
|
2566
|
+
return { record, changed: false };
|
|
2567
|
+
}
|
|
2568
|
+
const summaryPath = path.join(resultPath, 'summary.json');
|
|
2569
|
+
const metricsPath = path.join(resultPath, 'metrics.ndjson');
|
|
2570
|
+
const summary = readK6Summary(summaryPath, record.summary?.exitCode ?? null, metricsPath);
|
|
2571
|
+
if (!summary || !Array.isArray(summary.endpoints) || summary.endpoints.length === 0) {
|
|
2572
|
+
return { record, changed: false };
|
|
2573
|
+
}
|
|
2574
|
+
const next = {
|
|
2575
|
+
...record,
|
|
2576
|
+
summary: { ...(record.summary || {}), ...summary },
|
|
2577
|
+
};
|
|
2578
|
+
if (summary.totalRequests != null)
|
|
2579
|
+
next.totalRequests = summary.totalRequests;
|
|
2580
|
+
if (summary.errorPct != null && summary.totalRequests != null) {
|
|
2581
|
+
next.totalErrors = Math.round(summary.totalRequests * (summary.errorPct / 100));
|
|
2582
|
+
}
|
|
2583
|
+
return { record: next, changed: true };
|
|
2584
|
+
}
|
|
2560
2585
|
function loadLastRunIntoState() {
|
|
2561
2586
|
const latest = readLoadRunIndex()[0];
|
|
2562
2587
|
if (!latest)
|
|
@@ -5546,7 +5571,25 @@ a{color:var(--blue)}
|
|
|
5546
5571
|
return;
|
|
5547
5572
|
}
|
|
5548
5573
|
const runPath = path.join(loadRunsDir, `${runId}.json`);
|
|
5549
|
-
const
|
|
5574
|
+
const parsed = JSON.parse(fs.readFileSync(runPath, 'utf-8'));
|
|
5575
|
+
const { record, changed } = enrichLoadRunRecord(parsed);
|
|
5576
|
+
if (changed) {
|
|
5577
|
+
try {
|
|
5578
|
+
fs.writeFileSync(runPath, JSON.stringify(record, null, 2), 'utf-8');
|
|
5579
|
+
}
|
|
5580
|
+
catch { }
|
|
5581
|
+
try {
|
|
5582
|
+
const index = readLoadRunIndex();
|
|
5583
|
+
const item = index.find((i) => i.runId === runId);
|
|
5584
|
+
if (item) {
|
|
5585
|
+
item.summary = record.summary;
|
|
5586
|
+
item.status = record.status;
|
|
5587
|
+
item.endTime = record.endTime;
|
|
5588
|
+
writeLoadRunIndex(index);
|
|
5589
|
+
}
|
|
5590
|
+
}
|
|
5591
|
+
catch { }
|
|
5592
|
+
}
|
|
5550
5593
|
res.writeHead(200, jsonH);
|
|
5551
5594
|
res.end(JSON.stringify(record));
|
|
5552
5595
|
}
|