keq 2.3.1 → 2.3.3
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/CHANGELOG.md +19 -0
- package/dist/esm/src/keq.js +1 -1
- package/dist/esm/src/middlewares/abort-flow-control-middleware.js +1 -1
- package/dist/esm/src/middlewares/timeout-middleware.js +4 -2
- package/dist/umd/src/keq.js +1 -1
- package/dist/umd/src/middlewares/abort-flow-control-middleware.js +1 -1
- package/dist/umd/src/middlewares/timeout-middleware.js +4 -2
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.3.3](https://github.com/keq-request/keq/compare/v2.3.2...v2.3.3) (2024-05-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* the error thrown when the request timeout is not DOMException ([7c84d8f](https://github.com/keq-request/keq/commit/7c84d8fe40e26713d478d443fbdb9a9d71d99ba9))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Performance Improvements
|
|
14
|
+
|
|
15
|
+
* upgrade dependencies ([090e244](https://github.com/keq-request/keq/commit/090e24449f055e185dde1d3972c8f5e9c637fb20))
|
|
16
|
+
|
|
17
|
+
## [2.3.2](https://github.com/keq-request/keq/compare/v2.3.1...v2.3.2) (2024-04-23)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* cannot send form-data when invoke .attach() first ([0195ee2](https://github.com/keq-request/keq/commit/0195ee2dcb4e43a58185f4c032d29fb6c00ac70d))
|
|
23
|
+
|
|
5
24
|
## [2.3.1](https://github.com/keq-request/keq/compare/v2.3.0...v2.3.1) (2024-03-22)
|
|
6
25
|
|
|
7
26
|
|
package/dist/esm/src/keq.js
CHANGED
|
@@ -159,7 +159,7 @@ export class Keq extends Core {
|
|
|
159
159
|
throw new InvalidArgumentsExceptions();
|
|
160
160
|
}
|
|
161
161
|
this.requestContext.body = assignKeqRequestBody(this.requestContext.body, { [key]: file });
|
|
162
|
-
this.setTypeIfEmpty('form-
|
|
162
|
+
this.setTypeIfEmpty('form-data');
|
|
163
163
|
return this;
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
@@ -15,7 +15,7 @@ export function abortFlowControlMiddleware() {
|
|
|
15
15
|
ctx.global.abortFlowControl = {};
|
|
16
16
|
if (ctx.global.abortFlowControl[key]) {
|
|
17
17
|
const abortController = ctx.global.abortFlowControl[key];
|
|
18
|
-
abortController.abort('abort
|
|
18
|
+
abortController.abort(new DOMException('The previous request was not completed, so keq flowControl abort this request.', 'AbortError'));
|
|
19
19
|
}
|
|
20
20
|
const abortController = new AbortController();
|
|
21
21
|
ctx.global.abortFlowControl[key] = abortController;
|
|
@@ -11,9 +11,11 @@ export function timeoutMiddleware() {
|
|
|
11
11
|
}
|
|
12
12
|
const timeoutSignal = new AbortController();
|
|
13
13
|
ctx.request.signal = timeoutSignal.signal;
|
|
14
|
+
const millisecond = ctx.options.timeout.millisecond;
|
|
14
15
|
setTimeout(() => {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const err = new DOMException(`keq request timeout(${millisecond}ms)`, 'AbortError');
|
|
17
|
+
timeoutSignal.abort(err);
|
|
18
|
+
}, millisecond);
|
|
17
19
|
await next();
|
|
18
20
|
};
|
|
19
21
|
}
|
package/dist/umd/src/keq.js
CHANGED
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
throw new invalid_arguments_exception_1.InvalidArgumentsExceptions();
|
|
172
172
|
}
|
|
173
173
|
this.requestContext.body = (0, assign_keq_request_body_1.assignKeqRequestBody)(this.requestContext.body, { [key]: file });
|
|
174
|
-
this.setTypeIfEmpty('form-
|
|
174
|
+
this.setTypeIfEmpty('form-data');
|
|
175
175
|
return this;
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
ctx.global.abortFlowControl = {};
|
|
28
28
|
if (ctx.global.abortFlowControl[key]) {
|
|
29
29
|
const abortController = ctx.global.abortFlowControl[key];
|
|
30
|
-
abortController.abort('abort
|
|
30
|
+
abortController.abort(new DOMException('The previous request was not completed, so keq flowControl abort this request.', 'AbortError'));
|
|
31
31
|
}
|
|
32
32
|
const abortController = new AbortController();
|
|
33
33
|
ctx.global.abortFlowControl[key] = abortController;
|
|
@@ -23,9 +23,11 @@
|
|
|
23
23
|
}
|
|
24
24
|
const timeoutSignal = new AbortController();
|
|
25
25
|
ctx.request.signal = timeoutSignal.signal;
|
|
26
|
+
const millisecond = ctx.options.timeout.millisecond;
|
|
26
27
|
setTimeout(() => {
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
const err = new DOMException(`keq request timeout(${millisecond}ms)`, 'AbortError');
|
|
29
|
+
timeoutSignal.abort(err);
|
|
30
|
+
}, millisecond);
|
|
29
31
|
await next();
|
|
30
32
|
};
|
|
31
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keq",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Request API write by Typescript for flexibility, readability, and a low learning curve.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"request",
|
|
@@ -42,23 +42,23 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"clone": "^2.1.2",
|
|
44
44
|
"fastq": "^1.17.1",
|
|
45
|
-
"minimatch": "^9.0.
|
|
46
|
-
"object.fromentries": "^2.0.
|
|
45
|
+
"minimatch": "^9.0.4",
|
|
46
|
+
"object.fromentries": "^2.0.8",
|
|
47
47
|
"ts-custom-error": "^3.3.1",
|
|
48
48
|
"whatwg-url": "^14.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@buka/eslint-config": "^1.6.
|
|
52
|
-
"@commitlint/cli": "^
|
|
53
|
-
"@commitlint/config-conventional": "^
|
|
51
|
+
"@buka/eslint-config": "^1.6.4",
|
|
52
|
+
"@commitlint/cli": "^19.3.0",
|
|
53
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
54
54
|
"@jest/globals": "^29.7.0",
|
|
55
|
-
"@rushstack/eslint-patch": "^1.
|
|
55
|
+
"@rushstack/eslint-patch": "^1.10.2",
|
|
56
56
|
"@types/clone": "^2.1.4",
|
|
57
57
|
"@types/minimatch": "^5.1.2",
|
|
58
|
-
"@types/node": "^20.
|
|
58
|
+
"@types/node": "^20.12.7",
|
|
59
59
|
"@types/whatwg-url": "^11.0.4",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
61
|
-
"@typescript-eslint/parser": "^7.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
61
|
+
"@typescript-eslint/parser": "^7.7.1",
|
|
62
62
|
"eslint": "^8.57.0",
|
|
63
63
|
"husky": "^9.0.11",
|
|
64
64
|
"is-ci": "^3.0.1",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"ts-jest": "^29.1.2",
|
|
69
69
|
"ts-node": "^10.9.2",
|
|
70
70
|
"ts-patch": "^3.1.2",
|
|
71
|
-
"typescript": "^5.
|
|
71
|
+
"typescript": "^5.4.5",
|
|
72
72
|
"typescript-transform-paths": "^3.4.7"
|
|
73
73
|
},
|
|
74
74
|
"packageManager": "pnpm@8.6.4",
|