@ts-kizuna/hono 1.57.1 → 1.59.0
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/dist/index.cjs +7 -2
- package/dist/index.mjs +7 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -19,10 +19,14 @@ let _ts_kizuna_core_adapter = require("@ts-kizuna/core/adapter");
|
|
|
19
19
|
*/
|
|
20
20
|
const honoAdapter = (0, _ts_kizuna_core_adapter.createAdapter)({
|
|
21
21
|
buildHandlerContext: (_adapterRequest, { c }) => ({ c }),
|
|
22
|
-
respond: (result, { c, formatError }) => {
|
|
22
|
+
respond: (result, { c, formatError, responseValidation }) => {
|
|
23
23
|
if (result.kind === "handler-error") throw result.error;
|
|
24
24
|
if (result.kind === "raw-response") return result.response;
|
|
25
25
|
const rendered = (0, _ts_kizuna_core_adapter.renderJsonResult)(result, formatError, c.req.raw, c.req.method);
|
|
26
|
+
if (rendered.stream) return c.body(rendered.stream({
|
|
27
|
+
signal: c.req.raw.signal,
|
|
28
|
+
validate: responseValidation
|
|
29
|
+
}), rendered.status, rendered.headers);
|
|
26
30
|
if (rendered.body === void 0) return c.body(null, rendered.status, rendered.headers);
|
|
27
31
|
if (rendered.raw) return c.body(rendered.body, rendered.status, rendered.headers);
|
|
28
32
|
return c.json(rendered.body, rendered.status, rendered.headers);
|
|
@@ -65,7 +69,8 @@ function mountHono(api, app, options) {
|
|
|
65
69
|
request: adapterRequest,
|
|
66
70
|
responseContext: {
|
|
67
71
|
c,
|
|
68
|
-
formatError: options?.formatError
|
|
72
|
+
formatError: options?.formatError,
|
|
73
|
+
responseValidation: options?.responseValidation
|
|
69
74
|
},
|
|
70
75
|
guards,
|
|
71
76
|
schemes,
|
package/dist/index.mjs
CHANGED
|
@@ -18,10 +18,14 @@ import { GUARDS_META, JOBS_META, REQUEST_CONTEXT_META, ROUTER_META, SCHEMES_META
|
|
|
18
18
|
*/
|
|
19
19
|
const honoAdapter = createAdapter({
|
|
20
20
|
buildHandlerContext: (_adapterRequest, { c }) => ({ c }),
|
|
21
|
-
respond: (result, { c, formatError }) => {
|
|
21
|
+
respond: (result, { c, formatError, responseValidation }) => {
|
|
22
22
|
if (result.kind === "handler-error") throw result.error;
|
|
23
23
|
if (result.kind === "raw-response") return result.response;
|
|
24
24
|
const rendered = renderJsonResult(result, formatError, c.req.raw, c.req.method);
|
|
25
|
+
if (rendered.stream) return c.body(rendered.stream({
|
|
26
|
+
signal: c.req.raw.signal,
|
|
27
|
+
validate: responseValidation
|
|
28
|
+
}), rendered.status, rendered.headers);
|
|
25
29
|
if (rendered.body === void 0) return c.body(null, rendered.status, rendered.headers);
|
|
26
30
|
if (rendered.raw) return c.body(rendered.body, rendered.status, rendered.headers);
|
|
27
31
|
return c.json(rendered.body, rendered.status, rendered.headers);
|
|
@@ -64,7 +68,8 @@ function mountHono(api, app, options) {
|
|
|
64
68
|
request: adapterRequest,
|
|
65
69
|
responseContext: {
|
|
66
70
|
c,
|
|
67
|
-
formatError: options?.formatError
|
|
71
|
+
formatError: options?.formatError,
|
|
72
|
+
responseValidation: options?.responseValidation
|
|
68
73
|
},
|
|
69
74
|
guards,
|
|
70
75
|
schemes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-kizuna/hono",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.59.0",
|
|
4
4
|
"description": "Hono adapter for ts-kizuna",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ts-kizuna",
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"hono": "^4.0.0",
|
|
59
59
|
"zod": "^4.0.0",
|
|
60
|
-
"@ts-kizuna/core": "1.
|
|
60
|
+
"@ts-kizuna/core": "1.59.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"hono": "^4.7.0",
|
|
64
64
|
"tsdown": "^0.21.0",
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
66
|
"zod": "^4.0.0",
|
|
67
|
-
"@ts-kizuna/core": "1.
|
|
67
|
+
"@ts-kizuna/core": "1.59.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "tsdown src/index.ts --format esm,cjs --dts --clean --external @ts-kizuna/core --external hono --external zod",
|