@vtex/api 3.77.7 → 3.77.8

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/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.77.8] - 2022-12-15
11
+ ### Changed
12
+ - Remove socket metrics per origin
13
+
10
14
  ## [3.77.7] - 2022-04-14
11
15
 
12
16
  ### Fixed
@@ -1013,3 +1017,7 @@ instead
1013
1017
  ## [0.48.0] - 2018-09-21
1014
1018
  ### Changed
1015
1019
  - `HttpClient` now adds `'Accept-Encoding': 'gzip'` header by default.
1020
+
1021
+
1022
+ [Unreleased]: https://github.com/vtex/node-vtex-api/compare/v3.77.8...HEAD
1023
+ [3.77.8]: https://github.com/vtex/node-vtex-api/compare/v3.77.7...v3.77.8
@@ -5,9 +5,6 @@ export declare const routerCacheMiddleware: (ctx: MiddlewareContext, next: () =>
5
5
  export declare const requestMiddleware: (limit?: Limit | undefined) => (ctx: MiddlewareContext, next: () => Promise<void>) => Promise<void>;
6
6
  export declare function httpAgentStats(): {
7
7
  freeSockets: number;
8
- freeSocketsPerOrigin: Record<string, number>;
9
8
  pendingRequests: number;
10
- pendingRequestsPerOrigin: Record<string, number>;
11
9
  sockets: number;
12
- socketsPerOrigin: Record<string, number>;
13
10
  };
@@ -66,28 +66,22 @@ exports.requestMiddleware = (limit) => async (ctx, next) => {
66
66
  const makeRequest = () => http.request(ctx.config);
67
67
  ctx.response = await (limit ? limit(makeRequest) : makeRequest());
68
68
  };
69
- function countPerOrigin(obj) {
69
+ function count(obj) {
70
70
  try {
71
- return ramda_1.mapObjIndexed(val => val.length, obj);
71
+ return Object.values(obj).reduce((acc, val) => acc += val.length, 0);
72
72
  }
73
73
  catch (_) {
74
- return {};
74
+ return 0;
75
75
  }
76
76
  }
77
77
  function httpAgentStats() {
78
- const socketsPerOrigin = countPerOrigin(httpAgent.sockets);
79
- const sockets = ramda_1.sum(ramda_1.values(socketsPerOrigin));
80
- const freeSocketsPerOrigin = countPerOrigin(httpAgent.freeSockets);
81
- const freeSockets = ramda_1.sum(ramda_1.values(freeSocketsPerOrigin));
82
- const pendingRequestsPerOrigin = countPerOrigin(httpAgent.requests);
83
- const pendingRequests = ramda_1.sum(ramda_1.values(pendingRequestsPerOrigin));
78
+ const sockets = count(httpAgent.sockets);
79
+ const freeSockets = count(httpAgent.freeSockets);
80
+ const pendingRequests = count(httpAgent.requests);
84
81
  return {
85
82
  freeSockets,
86
- freeSocketsPerOrigin,
87
83
  pendingRequests,
88
- pendingRequestsPerOrigin,
89
84
  sockets,
90
- socketsPerOrigin,
91
85
  };
92
86
  }
93
87
  exports.httpAgentStats = httpAgentStats;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/api",
3
- "version": "3.77.7",
3
+ "version": "3.77.8",
4
4
  "description": "VTEX I/O API client",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",