@kronos-integration/interceptor 13.5.0 → 13.5.1
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
|
+
* [reset](#reset-1)
|
|
50
|
+
* [Parameters](#parameters-4)
|
|
50
51
|
* [name](#name-1)
|
|
51
52
|
* [LoggingInterceptor](#logginginterceptor)
|
|
52
53
|
* [name](#name-2)
|
|
@@ -168,7 +169,9 @@ 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
|
+
### reset
|
|
173
|
+
|
|
174
|
+
#### Parameters
|
|
172
175
|
|
|
173
176
|
* `config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
174
177
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/interceptor",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.1",
|
|
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.0
|
|
38
|
+
"pacc": "^14.1.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@kronos-integration/test-interceptor": "^7.2.6",
|
|
@@ -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
|
};
|
|
@@ -59,11 +59,14 @@ export class LimitingInterceptor extends Interceptor {
|
|
|
59
59
|
this.limits = config?.limits || this.attributes.limits.default;
|
|
60
60
|
}*/
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
const json = super.
|
|
62
|
+
toJSONWithOptions(options) {
|
|
63
|
+
const json = super.toJSONWithOptions(options);
|
|
64
|
+
|
|
65
|
+
console.log("LIMITS",this.limits);
|
|
66
|
+
|
|
64
67
|
json.limits = this.limits;
|
|
65
68
|
return json;
|
|
66
|
-
}
|
|
69
|
+
}
|
|
67
70
|
|
|
68
71
|
reset() {
|
|
69
72
|
this.ongoingResponses = new Set();
|
|
@@ -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
|
}
|