viberadar 0.3.229 → 0.3.230

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,CAutH1G"}
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,CA+tH1G"}
@@ -2344,9 +2344,12 @@ function startServer({ data: initialData, port, projectRoot }) {
2344
2344
  return { passes, fails };
2345
2345
  }
2346
2346
  function parseK6ThresholdMs(thresholds, percentile) {
2347
- if (!thresholds || typeof thresholds !== 'object')
2347
+ if (!thresholds || (typeof thresholds !== 'object' && !Array.isArray(thresholds)))
2348
2348
  return undefined;
2349
- for (const expression of Object.keys(thresholds)) {
2349
+ const expressions = Array.isArray(thresholds)
2350
+ ? thresholds.map((item) => String(item))
2351
+ : Object.keys(thresholds);
2352
+ for (const expression of expressions) {
2350
2353
  const escaped = percentile.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2351
2354
  const match = expression.match(new RegExp(`p\\(${escaped}\\)\\s*<\\s*(\\d+(?:\\.\\d+)?)`));
2352
2355
  if (match) {
@@ -2357,6 +2360,11 @@ function startServer({ data: initialData, port, projectRoot }) {
2357
2360
  }
2358
2361
  return undefined;
2359
2362
  }
2363
+ function k6MetricValues(metric) {
2364
+ if (!metric || typeof metric !== 'object')
2365
+ return {};
2366
+ return metric.values && typeof metric.values === 'object' ? metric.values : metric;
2367
+ }
2360
2368
  function normalizeK6EndpointTag(tags) {
2361
2369
  if (!tags || typeof tags !== 'object')
2362
2370
  return null;
@@ -2470,9 +2478,9 @@ function startServer({ data: initialData, port, projectRoot }) {
2470
2478
  }
2471
2479
  function normalizeK6Summary(raw, exitCode, metricsPath) {
2472
2480
  const metrics = raw?.metrics || {};
2473
- const duration = metrics.http_req_duration?.values || {};
2474
- const reqs = metrics.http_reqs?.values || {};
2475
- const failed = metrics.http_req_failed?.values || {};
2481
+ const duration = k6MetricValues(metrics.http_req_duration);
2482
+ const reqs = k6MetricValues(metrics.http_reqs);
2483
+ const failed = k6MetricValues(metrics.http_req_failed);
2476
2484
  const checks = flattenK6Checks(raw?.root_group);
2477
2485
  let thresholdsPassed = 0;
2478
2486
  let thresholdsFailed = 0;