feat(trpc-server): bump up Hono version "v3" (#50)
* feat(trpc-server): bump up Hono version "v3" * add changesetpull/51/head
parent
118c43bd74
commit
b9e383fa88
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hono/trpc-server': minor
|
||||
---
|
||||
|
||||
feat: bump up Hono version "v3"
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<AnyRouter>,
|
||||
'req' | 'endpoint'
|
||||
> & Partial<Pick<FetchHandlerRequestOptions<AnyRouter>, 'endpoint'>>
|
||||
type tRPCOptions = Omit<FetchHandlerRequestOptions<AnyRouter>, 'req' | 'endpoint'> &
|
||||
Partial<Pick<FetchHandlerRequestOptions<AnyRouter>, '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
|
||||
}
|
||||
|
|
|
@ -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==
|
||||
|
|
Loading…
Reference in New Issue