@naturalcycles/backend-lib 9.13.0 → 9.14.0

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.
@@ -20,7 +20,7 @@ export const serverStatsHTMLHandler = (req, res) => {
20
20
  // calc things
21
21
  _stringMapValues(serverStatsMap).forEach(s => {
22
22
  s.total = s['2xx'] + s['4xx'] + s['5xx'];
23
- s.pc = _mapValues(s.stack.percentiles(percentiles), (_k, v) => Math.round(v), true);
23
+ s.pc = _mapValues(s.stack.percentiles(percentiles), (_k, v) => Math.round(v), { mutate: true });
24
24
  });
25
25
  const allLatencies = _stringMapValues(serverStatsMap).flatMap(s => s.stack.items);
26
26
  const all2xx = _sum(_stringMapValues(serverStatsMap).flatMap(s => s['2xx']));
@@ -49,7 +49,9 @@ export const serverStatsHTMLHandler = (req, res) => {
49
49
  `<td align="right"><pre>${all5xx}</pre></td>`,
50
50
  ...percentiles.map(pc => `<td align="right"><pre>${Math.round(_percentile(allLatencies, pc))}</pre></td>`),
51
51
  `</tr>`,
52
- ..._sortBy(_stringMapEntries(serverStatsMap), ([_, stat]) => _get(stat, sortBy), false, asc ? 'asc' : 'desc').map(([endpoint, stat]) => {
52
+ ..._sortBy(_stringMapEntries(serverStatsMap), ([_, stat]) => _get(stat, sortBy), {
53
+ dir: asc ? 'asc' : 'desc',
54
+ }).map(([endpoint, stat]) => {
53
55
  return [
54
56
  '<tr>',
55
57
  `<td><pre>${endpoint}</pre></td>`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
3
  "type": "module",
4
- "version": "9.13.0",
4
+ "version": "9.14.0",
5
5
  "peerDependencies": {
6
6
  "@sentry/node": "^9"
7
7
  },
@@ -51,7 +51,7 @@ export const serverStatsHTMLHandler: BackendRequestHandler = (req, res) => {
51
51
  // calc things
52
52
  _stringMapValues(serverStatsMap).forEach(s => {
53
53
  s.total = s['2xx'] + s['4xx'] + s['5xx']
54
- s.pc = _mapValues(s.stack.percentiles(percentiles), (_k, v) => Math.round(v), true)
54
+ s.pc = _mapValues(s.stack.percentiles(percentiles), (_k, v) => Math.round(v), { mutate: true })
55
55
  })
56
56
  const allLatencies = _stringMapValues(serverStatsMap).flatMap(s => s.stack.items)
57
57
  const all2xx = _sum(_stringMapValues(serverStatsMap).flatMap(s => s['2xx']))
@@ -85,12 +85,9 @@ export const serverStatsHTMLHandler: BackendRequestHandler = (req, res) => {
85
85
  pc => `<td align="right"><pre>${Math.round(_percentile(allLatencies, pc))}</pre></td>`,
86
86
  ),
87
87
  `</tr>`,
88
- ..._sortBy(
89
- _stringMapEntries(serverStatsMap),
90
- ([_, stat]) => _get(stat, sortBy),
91
- false,
92
- asc ? 'asc' : 'desc',
93
- ).map(([endpoint, stat]) => {
88
+ ..._sortBy(_stringMapEntries(serverStatsMap), ([_, stat]) => _get(stat, sortBy) as string, {
89
+ dir: asc ? 'asc' : 'desc',
90
+ }).map(([endpoint, stat]) => {
94
91
  return [
95
92
  '<tr>',
96
93
  `<td><pre>${endpoint}</pre></td>`,