diff --git a/.changeset/rich-seals-try.md b/.changeset/rich-seals-try.md new file mode 100644 index 00000000..ac11f2ec --- /dev/null +++ b/.changeset/rich-seals-try.md @@ -0,0 +1,5 @@ +--- +'@hono/trpc-server': minor +--- + +feat: bump up Hono version "v3" diff --git a/packages/trpc-server/package.json b/packages/trpc-server/package.json index 4c4eda53..fdc7166b 100644 --- a/packages/trpc-server/package.json +++ b/packages/trpc-server/package.json @@ -29,14 +29,14 @@ "homepage": "https://honojs.dev", "peerDependencies": { "@trpc/server": "^10.10.0", - "hono": "^2.7.5" + "hono": "3.*" }, "devDependencies": { "@trpc/server": "^10.10.0", - "hono": "^2.7.5", + "hono": "^3.0.0", "zod": "^3.20.2" }, "engines": { "node": ">=16.0.0" } -} \ No newline at end of file +} diff --git a/packages/trpc-server/src/index.ts b/packages/trpc-server/src/index.ts index c52efd60..cc6802b9 100644 --- a/packages/trpc-server/src/index.ts +++ b/packages/trpc-server/src/index.ts @@ -1,20 +1,17 @@ import type { AnyRouter } from '@trpc/server' -import type { FetchHandlerRequestOptions} from '@trpc/server/adapters/fetch' +import type { FetchHandlerRequestOptions } from '@trpc/server/adapters/fetch' import { fetchRequestHandler } from '@trpc/server/adapters/fetch' import type { MiddlewareHandler } from 'hono' -type tRPCOptions = - Omit< - FetchHandlerRequestOptions, - 'req' | 'endpoint' - > & Partial, 'endpoint'>> +type tRPCOptions = Omit, 'req' | 'endpoint'> & + Partial, 'endpoint'>> export const trpcServer = ({ endpoint = '/trpc', ...rest }: tRPCOptions): MiddlewareHandler => { return async (c) => { const res = fetchRequestHandler({ ...rest, endpoint, - req: c.req, + req: c.req.raw, }) return res } diff --git a/yarn.lock b/yarn.lock index d87dea49..794c2c74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5212,7 +5212,7 @@ hono@3.0.0-rc.4: resolved "https://registry.yarnpkg.com/hono/-/hono-3.0.0-rc.4.tgz#7bfe8c89d4b004ff90d587c8ba45279a175fbce7" integrity sha512-76R3mb8kPeuD9TOmQ1WZi59w4QbpaUOlyX3wC7zQpt7IM7iFVBTxj2fpv++6ROPtd5iUBMCrmH/65ZrNXYYgmg== -hono@^2.6.1, hono@^2.7.5: +hono@^2.6.1: version "2.7.5" resolved "https://registry.yarnpkg.com/hono/-/hono-2.7.5.tgz#2b0c39d39a057575962a7025373be4304dedca9c" integrity sha512-UYrhUT1Xtalh7Xw/YGXee25wlWMiVIRfr0FbAJMEMyRpX9TFZ/6JKmVdCK7ioRnhAw7PfWBasjSBhdNXQ8/okQ==