@kronos-integration/interceptor 12.1.4 → 12.1.6

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/README.md CHANGED
@@ -199,6 +199,7 @@ Logs the time the requests takes
199
199
  #### Parameters
200
200
 
201
201
  * `endpoint`  
202
+ * `next`  
202
203
  * `args` **...any** 
203
204
 
204
205
  ### name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/interceptor",
3
- "version": "12.1.4",
3
+ "version": "12.1.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -1,4 +1,4 @@
1
- import { Interceptor } from './interceptor.mjs';
1
+ import { Interceptor } from "./interceptor.mjs";
2
2
 
3
3
  /**
4
4
  * Interceptor to collect processing time, number of
@@ -9,7 +9,7 @@ export class StatsCollectorInterceptor extends Interceptor {
9
9
  * @return {string} 'collect-request-stats'
10
10
  */
11
11
  static get name() {
12
- return 'collect-request-stats';
12
+ return "collect-request-stats";
13
13
  }
14
14
 
15
15
  reset() {
@@ -23,13 +23,13 @@ export class StatsCollectorInterceptor extends Interceptor {
23
23
  /**
24
24
  * Logs the time the requests takes
25
25
  */
26
- async receive(endpoint,...args) {
26
+ async receive(endpoint, next, ...args) {
27
27
  this.numberOfRequests += 1;
28
28
 
29
29
  const start = Date.now();
30
30
 
31
31
  try {
32
- const response = await this.connected.receive(...args);
32
+ const response = await next(...args);
33
33
  const now = Date.now();
34
34
  const pt = now - start;
35
35
  this.totalRequestProcessingTime += pt;
@@ -42,7 +42,6 @@ export class StatsCollectorInterceptor extends Interceptor {
42
42
  this.minRequestProcessingTime = pt;
43
43
  }
44
44
 
45
- endpoint.logger.debug(level=>`took ${pt} ms for ${[...args]}`);
46
45
  return response;
47
46
  } catch (err) {
48
47
  this.numberOfFailedRequests += 1;
@@ -11,6 +11,6 @@ export class StatsCollectorInterceptor extends Interceptor {
11
11
  /**
12
12
  * Logs the time the requests takes
13
13
  */
14
- receive(endpoint: any, ...args: any[]): Promise<any>;
14
+ receive(endpoint: any, next: any, ...args: any[]): Promise<any>;
15
15
  }
16
- import { Interceptor } from './interceptor.mjs';
16
+ import { Interceptor } from "./interceptor.mjs";