@kronos-integration/interceptor 10.3.0 → 10.3.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/LICENSE +12 -23
- package/README.md +7 -5
- package/package.json +15 -14
- package/src/interceptor.mjs +2 -2
- package/types/interceptor.d.mts +3 -3
- package/types/timeout-interceptor.d.mts +1 -1
package/LICENSE
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
Copyright (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
15
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
16
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
18
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
19
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
20
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
21
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
22
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
23
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1
|
+
Copyright (C) 2016-2025 by darlenya & arlac77
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted.
|
|
5
|
+
|
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
7
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
8
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
10
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
11
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
12
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
1
|
+
[](https://spdx.org/licenses/0BSD.html)
|
|
3
2
|
[](https://typescriptlang.org)
|
|
4
|
-
[](https://bundlejs.com/?q=@kronos-integration/interceptor)
|
|
5
|
-
[](https://npmjs.org/package/@kronos-integration/interceptor)
|
|
6
3
|
[](https://github.com/Kronos-Integration/interceptor/issues)
|
|
7
4
|
[](https://actions-badge.atrox.dev/Kronos-Integration/interceptor/goto)
|
|
8
5
|
[](https://github.com/prettier/prettier)
|
|
@@ -31,6 +28,7 @@ const response = interceptor.receive(endpoint, arg1, arg2);
|
|
|
31
28
|
|
|
32
29
|
### Table of Contents
|
|
33
30
|
|
|
31
|
+
* [Endpoint](#endpoint)
|
|
34
32
|
* [Interceptor](#interceptor)
|
|
35
33
|
* [Parameters](#parameters)
|
|
36
34
|
* [type](#type)
|
|
@@ -62,6 +60,10 @@ const response = interceptor.receive(endpoint, arg1, arg2);
|
|
|
62
60
|
* [expand](#expand)
|
|
63
61
|
* [Parameters](#parameters-7)
|
|
64
62
|
|
|
63
|
+
## Endpoint
|
|
64
|
+
|
|
65
|
+
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
66
|
+
|
|
65
67
|
## Interceptor
|
|
66
68
|
|
|
67
69
|
Base interceptor. The base class for all the interceptors
|
|
@@ -118,7 +120,7 @@ and calls the trailing interceptor.
|
|
|
118
120
|
|
|
119
121
|
#### Parameters
|
|
120
122
|
|
|
121
|
-
* `endpoint` **Endpoint** 
|
|
123
|
+
* `endpoint` **[Endpoint](#endpoint)** 
|
|
122
124
|
* `next` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 
|
|
123
125
|
* `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<any>** the request from the leading interceptor
|
|
124
126
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/interceptor",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
|
+
"types": "./types/index.d.mts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
11
|
+
"default": "./src/index.mjs",
|
|
12
|
+
"types": "./types/index.d.mts"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
|
-
"types": "./types/index.d.mts",
|
|
15
15
|
"description": "intercepects / modifies requests as they pass between endpoints",
|
|
16
16
|
"keywords": [
|
|
17
17
|
"interceptor"
|
|
@@ -28,28 +28,29 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "BSD-2-Clause",
|
|
30
30
|
"scripts": {
|
|
31
|
-
"prepare": "
|
|
32
|
-
"
|
|
31
|
+
"prepare": "node --run prepare:typescript",
|
|
32
|
+
"prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
|
|
33
|
+
"test": "node --run test:ava",
|
|
33
34
|
"test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
34
35
|
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
|
|
35
36
|
"docs": "documentation readme --section=API ./src/**/*.mjs",
|
|
36
|
-
"lint": "
|
|
37
|
+
"lint": "node --run lint:docs && node --run lint:typescript",
|
|
37
38
|
"lint:docs": "documentation lint ./src/**/*.mjs",
|
|
38
|
-
"lint:
|
|
39
|
+
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"model-attributes": "^4.2.2"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@kronos-integration/test-interceptor": "^7.0.
|
|
45
|
-
"ava": "^6.1.
|
|
46
|
-
"c8": "^
|
|
45
|
+
"@kronos-integration/test-interceptor": "^7.0.28",
|
|
46
|
+
"ava": "^6.1.3",
|
|
47
|
+
"c8": "^10.1.2",
|
|
47
48
|
"documentation": "^14.0.3",
|
|
48
|
-
"semantic-release": "^
|
|
49
|
-
"typescript": "^5.
|
|
49
|
+
"semantic-release": "^24.1.2",
|
|
50
|
+
"typescript": "^5.7.0-beta"
|
|
50
51
|
},
|
|
51
52
|
"engines": {
|
|
52
|
-
"node": ">=
|
|
53
|
+
"node": ">=22.11.0"
|
|
53
54
|
},
|
|
54
55
|
"repository": {
|
|
55
56
|
"type": "git",
|
package/src/interceptor.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { setAttributes, getAttributes } from "model-attributes";
|
|
|
7
7
|
/**
|
|
8
8
|
* Base interceptor. The base class for all the interceptors
|
|
9
9
|
* Calls configure() and reset().
|
|
10
|
-
* @param {Object} config The interceptor configuration object.
|
|
10
|
+
* @param {Object?} config The interceptor configuration object.
|
|
11
11
|
*/
|
|
12
12
|
export class Interceptor {
|
|
13
13
|
/**
|
|
@@ -47,7 +47,7 @@ export class Interceptor {
|
|
|
47
47
|
* Which means we loop over all configuration attributes
|
|
48
48
|
* and then for each attribute decide if we use the default, call
|
|
49
49
|
* a setter function or simply assign the attribute value.
|
|
50
|
-
* @param {Object} config
|
|
50
|
+
* @param {Object?} config
|
|
51
51
|
*/
|
|
52
52
|
configure(config) {
|
|
53
53
|
setAttributes(this, this.configurationAttributes, config);
|
package/types/interceptor.d.mts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Base interceptor. The base class for all the interceptors
|
|
6
6
|
* Calls configure() and reset().
|
|
7
|
-
* @param {Object} config The interceptor configuration object.
|
|
7
|
+
* @param {Object?} config The interceptor configuration object.
|
|
8
8
|
*/
|
|
9
9
|
export class Interceptor {
|
|
10
10
|
/**
|
|
@@ -31,9 +31,9 @@ export class Interceptor {
|
|
|
31
31
|
* Which means we loop over all configuration attributes
|
|
32
32
|
* and then for each attribute decide if we use the default, call
|
|
33
33
|
* a setter function or simply assign the attribute value.
|
|
34
|
-
* @param {Object} config
|
|
34
|
+
* @param {Object?} config
|
|
35
35
|
*/
|
|
36
|
-
configure(config: any): void;
|
|
36
|
+
configure(config: any | null): void;
|
|
37
37
|
toString(): string;
|
|
38
38
|
toJSON(): any;
|
|
39
39
|
/**
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* @property {number} timeout
|
|
4
4
|
*/
|
|
5
5
|
export class TimeoutInterceptor extends Interceptor {
|
|
6
|
-
receive(endpoint: any, next: any, ...args: any[]): any
|
|
6
|
+
receive(endpoint: any, next: any, ...args: any[]): Promise<any>;
|
|
7
7
|
}
|
|
8
8
|
import { Interceptor } from "./interceptor.mjs";
|