@jderstd/hono 0.7.1 → 0.8.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 +3 -1
- package/dist/body-limit.d.ts +54 -54
- package/dist/ip-limit.d.ts +74 -74
- package/dist/not-found.d.ts +28 -28
- package/dist/not-found.js.map +1 -1
- package/dist/not-found.mjs.map +1 -1
- package/dist/on-error.d.ts +56 -56
- package/dist/on-error.js.map +1 -1
- package/dist/on-error.mjs.map +1 -1
- package/dist/response/common/index.d.ts +67 -67
- package/dist/response/common/index.js +2 -2
- package/dist/response/common/index.js.map +1 -1
- package/dist/response/error/http.d.ts +3 -0
- package/dist/response/error/http.js +7 -0
- package/dist/response/error/http.js.map +1 -1
- package/dist/response/error/http.mjs +7 -0
- package/dist/response/error/http.mjs.map +1 -1
- package/dist/response/error/index.d.ts +36 -32
- package/dist/response/error/index.js +4 -0
- package/dist/response/error/index.js.map +1 -1
- package/dist/response/error/index.mjs +4 -0
- package/dist/response/error/index.mjs.map +1 -1
- package/dist/response/json/index.d.ts +95 -95
- package/dist/response/json/index.js +2 -2
- package/dist/response/json/index.js.map +1 -1
- package/dist/response.d.ts +2 -2
- package/dist/time-limit.d.ts +50 -50
- package/package.json +3 -3
package/dist/time-limit.d.ts
CHANGED
|
@@ -4,59 +4,59 @@ declare const TIME_LIMIT_MAX_DEFAULT: 5000;
|
|
|
4
4
|
/** Options for `timeLimit` middleware. */
|
|
5
5
|
type TimeLimitOptions = {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
* Maximum time in milliseconds.
|
|
8
|
+
*
|
|
9
|
+
* By default, it is `TIME_LIMIT_MAX_DEFAULT`.
|
|
10
|
+
*/
|
|
11
11
|
max?: number;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
14
|
+
* Time limit middleware.
|
|
15
|
+
*
|
|
16
|
+
* Following error will be returned if the request takes longer than the limit:
|
|
17
|
+
*
|
|
18
|
+
* ```jsonc
|
|
19
|
+
* // Status: 504
|
|
20
|
+
* {
|
|
21
|
+
* "success": false,
|
|
22
|
+
* "errors": [
|
|
23
|
+
* {
|
|
24
|
+
* "code": "timeout",
|
|
25
|
+
* "message": "Request timeout"
|
|
26
|
+
* }
|
|
27
|
+
* ]
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* For more information, please refer to
|
|
32
|
+
* [Timeout](https://hono.dev/docs/middleware/builtin/timeout).
|
|
33
|
+
*
|
|
34
|
+
* ### Examples
|
|
35
|
+
*
|
|
36
|
+
* A example of using `timeLimit` middleware:
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { Hono } from "hono";
|
|
40
|
+
* import { timeLimit } from "@jderstd/hono/time-limit";
|
|
41
|
+
*
|
|
42
|
+
* const app: Hono = new Hono();
|
|
43
|
+
*
|
|
44
|
+
* app.use(timeLimit());
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* A example of using `timeLimit` middleware with options:
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { Hono } from "hono";
|
|
51
|
+
* import { timeLimit } from "@jderstd/hono/time-limit";
|
|
52
|
+
*
|
|
53
|
+
* const app: Hono = new Hono();
|
|
54
|
+
*
|
|
55
|
+
* app.use(timeLimit({
|
|
56
|
+
* max: 10 * 1000, // 10s
|
|
57
|
+
* }));
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
60
|
declare const timeLimit: (options?: TimeLimitOptions) => MiddlewareHandler;
|
|
61
61
|
export { TIME_LIMIT_MAX_DEFAULT, type TimeLimitOptions, timeLimit };
|
|
62
62
|
//# sourceMappingURL=time-limit.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jderstd/hono",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "A response builder for Hono",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jder",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"dist"
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@jderstd/core": "~0.
|
|
77
|
-
"ts-vista": "~0.2.
|
|
76
|
+
"@jderstd/core": "~0.5.0",
|
|
77
|
+
"ts-vista": "~0.2.3"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"hono": "4.5.0"
|