@kronos-integration/interceptor 10.2.34 → 10.2.35

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016-2022 by darlenya & arlac77
1
+ Copyright (c) 2016-2023 by darlenya & arlac77
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![npm](https://img.shields.io/npm/v/@kronos-integration/interceptor.svg)](https://www.npmjs.com/package/@kronos-integration/interceptor)
2
2
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
3
- [![Open Bundle](https://bundlejs.com/badge-light.svg)](https://bundlejs.com/?q=@kronos-integration/interceptor)
3
+ [![bundlejs](https://deno.bundlejs.com/?q=@kronos-integration/interceptor\&badge=detailed)](https://bundlejs.com/?q=@kronos-integration/interceptor)
4
4
  [![downloads](http://img.shields.io/npm/dm/@kronos-integration/interceptor.svg?style=flat-square)](https://npmjs.org/package/@kronos-integration/interceptor)
5
5
  [![GitHub Issues](https://img.shields.io/github/issues/Kronos-Integration/interceptor.svg?style=flat-square)](https://github.com/Kronos-Integration/interceptor/issues)
6
6
  [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FKronos-Integration%2Finterceptor%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/Kronos-Integration/interceptor/goto)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/interceptor",
3
- "version": "10.2.34",
3
+ "version": "10.2.35",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,17 +36,17 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@kronos-integration/test-interceptor": "^7.0.27",
39
- "ava": "^5.1.0",
40
- "c8": "^7.12.0",
41
- "documentation": "^14.0.1",
42
- "semantic-release": "^19.0.5"
39
+ "ava": "^5.3.1",
40
+ "c8": "^8.0.0",
41
+ "documentation": "^14.0.2",
42
+ "semantic-release": "^21.0.5"
43
43
  },
44
44
  "engines": {
45
- "node": ">=18.12.1"
45
+ "node": ">=20.3.1"
46
46
  },
47
47
  "repository": {
48
48
  "type": "git",
49
- "url": "https://github.com/Kronos-Integration/interceptor.git"
49
+ "url": "https://github.com/Kronos-Integration/interceptor"
50
50
  },
51
51
  "bugs": {
52
52
  "url": "https://github.com/Kronos-Integration/interceptor/issues"
@@ -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
@@ -12,39 +12,45 @@ export class StatsCollectorInterceptor extends Interceptor {
12
12
  return 'collect-request-stats';
13
13
  }
14
14
 
15
+ #numberOfRequests;
16
+ #numberOfFailedRequests;;
17
+ #minRequestProcessingTime;;
18
+ #maxRequestProcessingTime;
19
+ #totalRequestProcessingTime;
20
+
15
21
  reset() {
16
- this._numberOfRequests = 0;
17
- this._numberOfFailedRequests = 0;
18
- this._minRequestProcessingTime = Number.MAX_VALUE;
19
- this._maxRequestProcessingTime = 0;
20
- this._totalRequestProcessingTime = 0;
22
+ this.#numberOfRequests = 0;
23
+ this.#numberOfFailedRequests = 0;
24
+ this.#minRequestProcessingTime = Number.MAX_VALUE;
25
+ this.#maxRequestProcessingTime = 0;
26
+ this.#totalRequestProcessingTime = 0;
21
27
  }
22
28
 
23
29
  get numberOfRequests() {
24
- return this._numberOfRequests;
30
+ return this.#numberOfRequests;
25
31
  }
26
32
 
27
33
  get numberOfFailedRequests() {
28
- return this._numberOfFailedRequests;
34
+ return this.#numberOfFailedRequests;
29
35
  }
30
36
 
31
37
  get maxRequestProcessingTime() {
32
- return this._maxRequestProcessingTime;
38
+ return this.#maxRequestProcessingTime;
33
39
  }
34
40
 
35
41
  get minRequestProcessingTime() {
36
- return this._minRequestProcessingTime;
42
+ return this.#minRequestProcessingTime;
37
43
  }
38
44
 
39
45
  get totalRequestProcessingTime() {
40
- return this._totalRequestProcessingTime;
46
+ return this.#totalRequestProcessingTime;
41
47
  }
42
48
 
43
49
  /**
44
50
  * Logs the time the requests takes
45
51
  */
46
52
  async receive(endpoint,...args) {
47
- this._numberOfRequests += 1;
53
+ this.#numberOfRequests += 1;
48
54
 
49
55
  const start = new Date();
50
56
 
@@ -52,20 +58,20 @@ export class StatsCollectorInterceptor extends Interceptor {
52
58
  const response = await this.connected.receive(...args);
53
59
  const now = new Date();
54
60
  const pt = now - start;
55
- this._totalRequestProcessingTime += pt;
61
+ this.#totalRequestProcessingTime += pt;
56
62
 
57
- if (pt > this._maxRequestProcessingTime) {
58
- this._maxRequestProcessingTime = pt;
63
+ if (pt > this.#maxRequestProcessingTime) {
64
+ this.#maxRequestProcessingTime = pt;
59
65
  }
60
66
 
61
- if (pt < this._minRequestProcessingTime) {
62
- this._minRequestProcessingTime = pt;
67
+ if (pt < this.#minRequestProcessingTime) {
68
+ this.#minRequestProcessingTime = pt;
63
69
  }
64
70
 
65
71
  endpoint.logger.debug(`took ${pt} ms for ${[...args]}`);
66
72
  return response;
67
73
  } catch (err) {
68
- this._numberOfFailedRequests += 1;
74
+ this.#numberOfFailedRequests += 1;
69
75
  throw err;
70
76
  }
71
77
  }