@kronos-integration/interceptor 13.5.0 → 13.5.2
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
|
@@ -46,7 +46,8 @@ const response = interceptor.receive(endpoint, arg1, arg2);
|
|
|
46
46
|
* [Properties](#properties)
|
|
47
47
|
* [name](#name)
|
|
48
48
|
* [LimitingInterceptor](#limitinginterceptor)
|
|
49
|
-
* [
|
|
49
|
+
* [toJSONWithOptions](#tojsonwithoptions-1)
|
|
50
|
+
* [Parameters](#parameters-4)
|
|
50
51
|
* [name](#name-1)
|
|
51
52
|
* [LoggingInterceptor](#logginginterceptor)
|
|
52
53
|
* [name](#name-2)
|
|
@@ -168,8 +169,11 @@ Sample config:
|
|
|
168
169
|
20 : reject
|
|
169
170
|
default is to reject when more than 10 requests are on the way
|
|
170
171
|
|
|
171
|
-
###
|
|
172
|
+
### toJSONWithOptions
|
|
172
173
|
|
|
174
|
+
#### Parameters
|
|
175
|
+
|
|
176
|
+
* `options`  
|
|
173
177
|
* `config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
174
178
|
|
|
175
179
|
### name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/interceptor",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"lint:docs": "documentation lint ./src**/*.mjs"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"pacc": "^14.
|
|
38
|
+
"pacc": "^14.2.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@kronos-integration/test-interceptor": "^7.2.6",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"semantic-release": "^25.0.9"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">=26.
|
|
48
|
+
"node": ">=26.10.0"
|
|
49
49
|
},
|
|
50
50
|
"repository": {
|
|
51
51
|
"type": "git",
|
package/src/interceptor.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addType,
|
|
3
|
-
|
|
3
|
+
assign,
|
|
4
4
|
extract,
|
|
5
5
|
type_attribute,
|
|
6
6
|
SCOPE_RUNTIME
|
|
@@ -46,14 +46,6 @@ export class Interceptor {
|
|
|
46
46
|
return this.constructor.name;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Meta description of the configuration.
|
|
51
|
-
* @return {Object}
|
|
52
|
-
*/
|
|
53
|
-
get attributes() {
|
|
54
|
-
return this.constructor.attributes;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
49
|
/**
|
|
58
50
|
* Takes attribute values from config parameters
|
|
59
51
|
* and copies them over to the object.
|
|
@@ -64,7 +56,7 @@ export class Interceptor {
|
|
|
64
56
|
* @param {Object} [config]
|
|
65
57
|
*/
|
|
66
58
|
configure(config) {
|
|
67
|
-
|
|
59
|
+
assign(this, config);
|
|
68
60
|
}
|
|
69
61
|
|
|
70
62
|
toString() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addType,
|
|
1
|
+
import { addType, duration_ms_attribute_writable } from "pacc";
|
|
2
2
|
import { Interceptor } from "./interceptor.mjs";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,8 +8,7 @@ import { Interceptor } from "./interceptor.mjs";
|
|
|
8
8
|
export class IntervalInterceptor extends Interceptor {
|
|
9
9
|
static attributes = {
|
|
10
10
|
interval: {
|
|
11
|
-
...
|
|
12
|
-
writable: true,
|
|
11
|
+
...duration_ms_attribute_writable,
|
|
13
12
|
name: "interval",
|
|
14
13
|
description: "min interval between two requests",
|
|
15
14
|
default: "60s"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addType,
|
|
3
|
-
|
|
3
|
+
duration_ms_attribute_writable,
|
|
4
4
|
count_attribute_writable,
|
|
5
5
|
default_collection_attribute_writable
|
|
6
6
|
} from "pacc";
|
|
@@ -32,7 +32,7 @@ export class LimitingInterceptor extends Interceptor {
|
|
|
32
32
|
static attributes = {
|
|
33
33
|
limits: {
|
|
34
34
|
...default_collection_attribute_writable,
|
|
35
|
-
|
|
35
|
+
constructor: Array,
|
|
36
36
|
name: "limits",
|
|
37
37
|
default: [
|
|
38
38
|
{
|
|
@@ -41,7 +41,7 @@ export class LimitingInterceptor extends Interceptor {
|
|
|
41
41
|
],
|
|
42
42
|
attributes: {
|
|
43
43
|
count: count_attribute_writable,
|
|
44
|
-
delay: { ...
|
|
44
|
+
delay: { ...duration_ms_attribute_writable, name: "delay" }
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
};
|
|
@@ -50,21 +50,6 @@ export class LimitingInterceptor extends Interceptor {
|
|
|
50
50
|
addType(this);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @param {Object?} config
|
|
56
|
-
*/
|
|
57
|
-
/*constructor(config) {
|
|
58
|
-
super(config);
|
|
59
|
-
this.limits = config?.limits || this.attributes.limits.default;
|
|
60
|
-
}*/
|
|
61
|
-
|
|
62
|
-
/*toJSON() {
|
|
63
|
-
const json = super.toJSON();
|
|
64
|
-
json.limits = this.limits;
|
|
65
|
-
return json;
|
|
66
|
-
}*/
|
|
67
|
-
|
|
68
53
|
reset() {
|
|
69
54
|
this.ongoingResponses = new Set();
|
|
70
55
|
this.ongoingRequests = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addType,
|
|
1
|
+
import { addType, duration_ms_attribute_writable } from "pacc";
|
|
2
2
|
import { Interceptor } from "@kronos-integration/interceptor";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -7,14 +7,12 @@ import { Interceptor } from "@kronos-integration/interceptor";
|
|
|
7
7
|
export class MonitoringInterceptor extends Interceptor {
|
|
8
8
|
static attributes = {
|
|
9
9
|
gracePeriod: {
|
|
10
|
-
...
|
|
11
|
-
writable: true,
|
|
10
|
+
...duration_ms_attribute_writable,
|
|
12
11
|
name: "gracePeriod",
|
|
13
12
|
default: "120s"
|
|
14
13
|
},
|
|
15
14
|
settingPeriod: {
|
|
16
|
-
...
|
|
17
|
-
writable: true,
|
|
15
|
+
...duration_ms_attribute_writable,
|
|
18
16
|
name: "settingPeriod",
|
|
19
17
|
default: "300s"
|
|
20
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addType,
|
|
1
|
+
import { addType, duration_ms_attribute_writable } from "pacc";
|
|
2
2
|
import { Interceptor } from "./interceptor.mjs";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,8 +8,7 @@ import { Interceptor } from "./interceptor.mjs";
|
|
|
8
8
|
export class TimeoutInterceptor extends Interceptor {
|
|
9
9
|
static attributes = {
|
|
10
10
|
timeout: {
|
|
11
|
-
...
|
|
12
|
-
writable: true,
|
|
11
|
+
...duration_ms_attribute_writable,
|
|
13
12
|
description: "request timeout",
|
|
14
13
|
default: "100000"
|
|
15
14
|
}
|