@kronos-integration/interceptor 12.1.0 → 12.1.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 +23 -6
- package/package.json +2 -2
- package/src/limiting-interceptor.mjs +13 -6
package/README.md
CHANGED
|
@@ -41,20 +41,23 @@ const response = interceptor.receive(endpoint, arg1, arg2);
|
|
|
41
41
|
* [receive](#receive)
|
|
42
42
|
* [Parameters](#parameters-3)
|
|
43
43
|
* [attributes](#attributes-1)
|
|
44
|
+
* [IntervalInterceptor](#intervalinterceptor)
|
|
45
|
+
* [Properties](#properties)
|
|
46
|
+
* [name](#name)
|
|
44
47
|
* [LimitingInterceptor](#limitinginterceptor)
|
|
45
48
|
* [Parameters](#parameters-4)
|
|
46
|
-
* [name](#name)
|
|
47
|
-
* [LoggingInterceptor](#logginginterceptor)
|
|
48
49
|
* [name](#name-1)
|
|
50
|
+
* [LoggingInterceptor](#logginginterceptor)
|
|
51
|
+
* [name](#name-2)
|
|
49
52
|
* [StatsCollectorInterceptor](#statscollectorinterceptor)
|
|
50
53
|
* [receive](#receive-1)
|
|
51
54
|
* [Parameters](#parameters-5)
|
|
52
|
-
* [name](#name-2)
|
|
53
|
-
* [TemplateInterceptor](#templateinterceptor)
|
|
54
55
|
* [name](#name-3)
|
|
55
|
-
* [
|
|
56
|
-
* [Properties](#properties)
|
|
56
|
+
* [TemplateInterceptor](#templateinterceptor)
|
|
57
57
|
* [name](#name-4)
|
|
58
|
+
* [TimeoutInterceptor](#timeoutinterceptor)
|
|
59
|
+
* [Properties](#properties-1)
|
|
60
|
+
* [name](#name-5)
|
|
58
61
|
* [rejectUnlessResolvedWithin](#rejectunlessresolvedwithin)
|
|
59
62
|
* [Parameters](#parameters-6)
|
|
60
63
|
* [expand](#expand)
|
|
@@ -132,6 +135,20 @@ Meta description of the configuration
|
|
|
132
135
|
|
|
133
136
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
134
137
|
|
|
138
|
+
## IntervalInterceptor
|
|
139
|
+
|
|
140
|
+
**Extends Interceptor**
|
|
141
|
+
|
|
142
|
+
Only passes requests after inteval time has passed
|
|
143
|
+
|
|
144
|
+
### Properties
|
|
145
|
+
|
|
146
|
+
* `interval` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 
|
|
147
|
+
|
|
148
|
+
### name
|
|
149
|
+
|
|
150
|
+
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 'interval'
|
|
151
|
+
|
|
135
152
|
## LimitingInterceptor
|
|
136
153
|
|
|
137
154
|
**Extends Interceptor**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/interceptor",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"pacc": "^4.
|
|
42
|
+
"pacc": "^4.4.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@kronos-integration/test-interceptor": "^7.0.30",
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
prepareAttributesDefinitions,
|
|
3
|
+
object_attribute,
|
|
4
|
+
duration_attribute,
|
|
5
|
+
count_attribute
|
|
6
|
+
} from "pacc";
|
|
2
7
|
import { Interceptor } from "./interceptor.mjs";
|
|
3
8
|
|
|
4
9
|
/**
|
|
@@ -27,16 +32,18 @@ export class LimitingInterceptor extends Interceptor {
|
|
|
27
32
|
static attributes = prepareAttributesDefinitions(
|
|
28
33
|
{
|
|
29
34
|
limits: {
|
|
35
|
+
...object_attribute,
|
|
30
36
|
default: [
|
|
31
37
|
{
|
|
32
38
|
count: 10
|
|
33
39
|
}
|
|
34
40
|
],
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
attributes: {
|
|
42
|
+
count: { ...count_attribute, default: 10 },
|
|
43
|
+
delay: {
|
|
44
|
+
...duration_attribute,
|
|
45
|
+
type: "duration"
|
|
46
|
+
}
|
|
40
47
|
}
|
|
41
48
|
}
|
|
42
49
|
},
|