get-convex / convex-helpers

A collection of useful code to complement the official packages.
MIT License
66 stars 9 forks source link

Update dependency hono to v4.3.2 #102

Closed renovate[bot] closed 2 months ago

renovate[bot] commented 3 months ago

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
hono (source) 4.2.2 -> 4.3.2 age adoption passing confidence

Release Notes

honojs/hono (hono) ### [`v4.3.2`](https://togithub.com/honojs/hono/releases/tag/v4.3.2) [Compare Source](https://togithub.com/honojs/hono/compare/v4.3.1...v4.3.2) #### What's Changed - fix(types): correct inferring when Method has Endponts as Union by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2610](https://togithub.com/honojs/hono/pull/2610) **Full Changelog**: https://github.com/honojs/hono/compare/v4.3.1...v4.3.2 ### [`v4.3.1`](https://togithub.com/honojs/hono/releases/tag/v4.3.1) [Compare Source](https://togithub.com/honojs/hono/compare/v4.3.0...v4.3.1) #### What's Changed - fix(types): `ToSchema` compatibility by [@​NamesMT](https://togithub.com/NamesMT) in [https://github.com/honojs/hono/pull/2605](https://togithub.com/honojs/hono/pull/2605) **Full Changelog**: https://github.com/honojs/hono/compare/v4.3.0...v4.3.1 ### [`v4.3.0`](https://togithub.com/honojs/hono/releases/tag/v4.3.0) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.9...v4.3.0) Hono v4.3.0 is now available! Let's take a look at the new features. #### Improve the RPC-mode Thanks to [@​kosei28](https://togithub.com/kosei28), [@​nakasyou](https://togithub.com/nakasyou), and [@​NamesMT](https://togithub.com/NamesMT), the RPC mode has been improved! ##### `c.text()` is typed The response of `c.text()` was just a `Response` object, not typed. ```ts const routes = app.get('/about/me', (c) => { return c.text('Me!') // the response is not typed }) ``` With this release, it will be a `TypedResponse` and you can get the type within the client created by `hc`. ```ts const client = hc('http://localhost:8787') const res = await client.about.me.$get() const text = await res.text() // text is typed as "Me!" const json = await res.json() // json is never! ``` ##### Support all JSON primitives We added the tests for the responses of `c.json()` to have the correct types and support inferring all primitives. The all tests below are passed! ```ts const app = new Hono() const route = app .get('/api/string', (c) => c.json('a-string')) .get('/api/number', (c) => c.json(37)) .get('/api/boolean', (c) => c.json(true)) .get('/api/generic', (c) => c.json(Math.random() > 0.5 ? Boolean(Math.random()) : Math.random())) type AppType = typeof route const client = hc('http://localhost') const stringFetch = await client.api.string.$get() const stringRes = await stringFetch.json() const numberFetch = await client.api.number.$get() const numberRes = await numberFetch.json() const booleanFetch = await client.api.boolean.$get() const booleanRes = await booleanFetch.json() const genericFetch = await client.api.generic.$get() const genericRes = await genericFetch.json() type stringVerify = Expect> expect(stringRes).toBe('a-string') type numberVerify = Expect> expect(numberRes).toBe(37) type booleanVerify = Expect> expect(booleanRes).toBe(true) type genericVerify = Expect> expect(typeof genericRes === 'number' || typeof genericRes === 'boolean').toBe(true) // using .text() on json endpoint should return string type textTest = Expect, ReturnType>> ``` ##### Status code type If you explicitly specify the status code, such as `200` or `404`, in `c.json()`. It will be added as a type for passing to the client. ```ts // server.ts const app = new Hono().get( '/posts', zValidator( 'query', z.object({ id: z.string() }) ), async (c) => { const { id } = c.req.valid('query') const post: Post | undefined = await getPost(id) if (post === undefined) { return c.json({ error: 'not found' }, 404) // Specify 404 } return c.json({ post }, 200) // Specify 200 } ) export type AppType = typeof app ``` You can get the data by the status code. ```ts // client.ts const client = hc('http://localhost:8787/') const res = await client.posts.$get({ query: { id: '123' } }) if (res.status === 404) { const data: { error: string } = await res.json() console.log(data.error) } if (res.ok) { const data: { post: Post } = await res.json() console.log(data.post) } // { post: Post } | { error: string } type ResponseType = InferResponseType // { post: Post } type ResponseType200 = InferResponseType ``` #### Improve compatibility with React The compatibility of `hono/jsx/dom` has been improved. Now, these React libraries work with `hono/jsx/dom`! - [react-toastify](https://togithub.com/fkhadra/react-toastify) - [spinners-react](https://togithub.com/adexin/spinners-react) - [Radix UI Primitives](https://www.radix-ui.com/primitives) The below demo is working with `hono/jsx/dom`, not React. ![Google Chrome](https://togithub.com/honojs/hono/assets/10682/b2f93c52-d1b6-40ea-b075-22c49d18a723) If you want to use React libraries with `hono/jsx/dom`, set-up `tsconfig.json` and `vite.config.ts` like the followings: `tsconfig.json`: ```json { "compilerOptions": { "paths": { "react": ["./node_modules/hono/dist/jsx/dom"], "react-dom": ["./node_modules/hono/dist/jsx/dom"] } } } ``` `vite.config.ts`: ```ts import { defineConfig } from 'vite' export default defineConfig({ resolve: { alias: { react: 'hono/jsx/dom', 'react-dom': 'hono/jsx/dom' } } }) ``` Thanks [@​usualoma](https://togithub.com/usualoma)! #### `createApp()` in Factory Helper `createApp()` method is added to Factory Helper. If you use this method with `createFactory()`, you can avoid redundancy in the definition of the `Env` type. If your application is like this, you have to set the `Env` in two places: ```ts import { createMiddleware } from 'hono/factory' type Env = { Variables: { myVar: string } } // 1. Set the `Env` to `new Hono()` const app = new Hono() // 2. Set the `Env` to `createMiddleware()` const mw = createMiddleware(async (c, next) => { await next() }) app.use(mw) ``` By using `createFactory()` and `createApp()`, you can set the Env only in one place. ```ts import { createFactory } from 'hono/factory' // ... // Set the `Env` to `createFactory()` const factory = createFactory() const app = factory.createApp() // factory also has `createMiddleware()` const mw = factory.createMiddleware(async (c, next) => { await next() }) ``` #### Deprecate `serveStatic` for Cloudflare Workers `serveStatic` exported by `hono/cloudflare-workers` has been deprecated. If you create an application which serves static asset files, use Cloudflare Pages instead. #### Other features - Cookie Helper - delete cookie returns the deleted value [https://github.com/honojs/hono/pull/2512](https://togithub.com/honojs/hono/pull/2512) - Bearer Authenticate - add `headerName` option [https://github.com/honojs/hono/pull/2514](https://togithub.com/honojs/hono/pull/2514) - JSX/DOM - preserve the state of element even if it is repeatedly evaluated by children [https://github.com/honojs/hono/pull/2563](https://togithub.com/honojs/hono/pull/2563) - Mimes utility - expose built-in MIME types [https://github.com/honojs/hono/pull/2516](https://togithub.com/honojs/hono/pull/2516) - Serve Static - expose serve-static builder [https://github.com/honojs/hono/pull/2515](https://togithub.com/honojs/hono/pull/2515) - Secure Headers - enable to set nonce in CSP [https://github.com/honojs/hono/pull/2577](https://togithub.com/honojs/hono/pull/2577) - Server-Timing - allow `crossOrigin` in TimingOptions to be a function [https://github.com/honojs/hono/pull/2359](https://togithub.com/honojs/hono/pull/2359) - Client - add `init` option [https://github.com/honojs/hono/pull/2592](https://togithub.com/honojs/hono/pull/2592) #### All Updates - fix(request): infer params in a path includes one or more optional parameter by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2576](https://togithub.com/honojs/hono/pull/2576) - feat(rpc): Add status code to response type by [@​kosei28](https://togithub.com/kosei28) in [https://github.com/honojs/hono/pull/2499](https://togithub.com/honojs/hono/pull/2499) - feat(helper/cookie): delete cookie returns the deleted value by [@​sor4chi](https://togithub.com/sor4chi) in [https://github.com/honojs/hono/pull/2512](https://togithub.com/honojs/hono/pull/2512) - feat(bearer-auth): add `headerName` option by [@​eliasbrange](https://togithub.com/eliasbrange) in [https://github.com/honojs/hono/pull/2514](https://togithub.com/honojs/hono/pull/2514) - feat(jsx/dom): improve compatibility with React by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2553](https://togithub.com/honojs/hono/pull/2553) - fix(jsx): preserve the state of element even if it is repeatedly evaluated by children by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2563](https://togithub.com/honojs/hono/pull/2563) - feat: expose built-in MIME types by [@​cometkim](https://togithub.com/cometkim) in [https://github.com/honojs/hono/pull/2516](https://togithub.com/honojs/hono/pull/2516) - feat: expose serve-static builder by [@​cometkim](https://togithub.com/cometkim) in [https://github.com/honojs/hono/pull/2515](https://togithub.com/honojs/hono/pull/2515) - feat(secure-headers): enable to set nonce in CSP by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2577](https://togithub.com/honojs/hono/pull/2577) - chore(pr_template): Use Bun instead of yarn by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/2582](https://togithub.com/honojs/hono/pull/2582) - feat(cloudflare-workers): deprecate `serveStatic` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2583](https://togithub.com/honojs/hono/pull/2583) - feat(types): improve response types flow by [@​NamesMT](https://togithub.com/NamesMT) in [https://github.com/honojs/hono/pull/2581](https://togithub.com/honojs/hono/pull/2581) - docs(readme): remove Benchmarks section by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2591](https://togithub.com/honojs/hono/pull/2591) - feat: improve `ToSchema` & `WebSocket Helper` types by [@​NamesMT](https://togithub.com/NamesMT) in [https://github.com/honojs/hono/pull/2588](https://togithub.com/honojs/hono/pull/2588) - feat(factory): add `createApp()` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2573](https://togithub.com/honojs/hono/pull/2573) - feat(hc): add `init` option by [@​NamesMT](https://togithub.com/NamesMT) in [https://github.com/honojs/hono/pull/2592](https://togithub.com/honojs/hono/pull/2592) - feat(timing): allow crossOrigin in TimingOptions to be a function by [@​jonahsnider](https://togithub.com/jonahsnider) in [https://github.com/honojs/hono/pull/2359](https://togithub.com/honojs/hono/pull/2359) - Next by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2600](https://togithub.com/honojs/hono/pull/2600) #### New Contributors - [@​kosei28](https://togithub.com/kosei28) made their first contribution in [https://github.com/honojs/hono/pull/2499](https://togithub.com/honojs/hono/pull/2499) - [@​NamesMT](https://togithub.com/NamesMT) made their first contribution in [https://github.com/honojs/hono/pull/2581](https://togithub.com/honojs/hono/pull/2581) - [@​jonahsnider](https://togithub.com/jonahsnider) made their first contribution in [https://github.com/honojs/hono/pull/2359](https://togithub.com/honojs/hono/pull/2359) **Full Changelog**: https://github.com/honojs/hono/compare/v4.2.9...v4.3.0 ### [`v4.2.9`](https://togithub.com/honojs/hono/releases/tag/v4.2.9) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.8...v4.2.9) ##### What's Changed - fix(context): correct set-cookie header values if c.res is set by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2570](https://togithub.com/honojs/hono/pull/2570) **Full Changelog**: https://github.com/honojs/hono/compare/v4.2.8...v4.2.9 ### [`v4.2.8`](https://togithub.com/honojs/hono/releases/tag/v4.2.8) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.7...v4.2.8) ##### What's Changed - fix(types): useState() has no type errors without arguments by [@​ryuapp](https://togithub.com/ryuapp) in [https://github.com/honojs/hono/pull/2548](https://togithub.com/honojs/hono/pull/2548) - chore(package.json): prettier use cache by [@​ryuapp](https://togithub.com/ryuapp) in [https://github.com/honojs/hono/pull/2549](https://togithub.com/honojs/hono/pull/2549) - fix(cloudflare-workers): do not buffer content by [@​cometkim](https://togithub.com/cometkim) in [https://github.com/honojs/hono/pull/2545](https://togithub.com/honojs/hono/pull/2545) - fix(context): keep response cookies in newResponse instead of overwriting by [@​ItsWendell](https://togithub.com/ItsWendell) in [https://github.com/honojs/hono/pull/2555](https://togithub.com/honojs/hono/pull/2555) ##### New Contributors - [@​cometkim](https://togithub.com/cometkim) made their first contribution in [https://github.com/honojs/hono/pull/2545](https://togithub.com/honojs/hono/pull/2545) - [@​ItsWendell](https://togithub.com/ItsWendell) made their first contribution in [https://github.com/honojs/hono/pull/2555](https://togithub.com/honojs/hono/pull/2555) **Full Changelog**: https://github.com/honojs/hono/compare/v4.2.7...v4.2.8 ### [`v4.2.7`](https://togithub.com/honojs/hono/releases/tag/v4.2.7) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.6...v4.2.7) This release fixes "[Restricted Directory Traversal in serveStatic with deno](https://togithub.com/honojs/hono/security/advisories/GHSA-3mpf-rcc7-5347)". **Full Changelog**: https://github.com/honojs/hono/compare/v4.2.6...v4.2.7 ### [`v4.2.6`](https://togithub.com/honojs/hono/releases/tag/v4.2.6) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.5...v4.2.6) #### What's Changed - refactor(adapter/aws): Optimize multiple call of same conditions with polymorphism by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2521](https://togithub.com/honojs/hono/pull/2521) - fix(sse): close sse stream on end by [@​domeccleston](https://togithub.com/domeccleston) in [https://github.com/honojs/hono/pull/2529](https://togithub.com/honojs/hono/pull/2529) - fix(client): Don't show `$ws` when not used WebSockets by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/2532](https://togithub.com/honojs/hono/pull/2532) - refactor(ssg): update utils.ts by [@​eltociear](https://togithub.com/eltociear) in [https://github.com/honojs/hono/pull/2519](https://togithub.com/honojs/hono/pull/2519) #### New Contributors - [@​domeccleston](https://togithub.com/domeccleston) made their first contribution in [https://github.com/honojs/hono/pull/2529](https://togithub.com/honojs/hono/pull/2529) - [@​eltociear](https://togithub.com/eltociear) made their first contribution in [https://github.com/honojs/hono/pull/2519](https://togithub.com/honojs/hono/pull/2519) **Full Changelog**: https://github.com/honojs/hono/compare/v4.2.5...v4.2.6 ### [`v4.2.5`](https://togithub.com/honojs/hono/releases/tag/v4.2.5) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.4...v4.2.5) #### What's Changed - fix(client): Allow calling toString and valueOf on the proxy object by [@​ibash](https://togithub.com/ibash) in [https://github.com/honojs/hono/pull/2510](https://togithub.com/honojs/hono/pull/2510) - fix(adapter): handle multi value headers in AWS Lambda by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2494](https://togithub.com/honojs/hono/pull/2494) - fix(client): shuold not remove tailing slash from top-level URL by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2523](https://togithub.com/honojs/hono/pull/2523) - fix(jsx/dom): remove lookbehind assertion in event regexp by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2524](https://togithub.com/honojs/hono/pull/2524) #### New Contributors - [@​ibash](https://togithub.com/ibash) made their first contribution in [https://github.com/honojs/hono/pull/2510](https://togithub.com/honojs/hono/pull/2510) **Full Changelog**: https://github.com/honojs/hono/compare/v4.2.4...v4.2.5 ### [`v4.2.4`](https://togithub.com/honojs/hono/releases/tag/v4.2.4) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.3...v4.2.4) ##### What's Changed - fix(jwt): Make JWT Header `typ` Field Optional to Enhance Compatibility by [@​naporin0624](https://togithub.com/naporin0624) in [https://github.com/honojs/hono/pull/2488](https://togithub.com/honojs/hono/pull/2488) - fix(testing): set `baseUrl` for `testClient` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2496](https://togithub.com/honojs/hono/pull/2496) - fix(validator): Default use to `OutputTypeExcludeResponseType` when `InputType` is unknown by [@​nagasawaryoya](https://togithub.com/nagasawaryoya) in [https://github.com/honojs/hono/pull/2500](https://togithub.com/honojs/hono/pull/2500) - refactor(trie-router): parentPatterns is updated but never queried by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2503](https://togithub.com/honojs/hono/pull/2503) - refactor: Remove redundant initializer by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2502](https://togithub.com/honojs/hono/pull/2502) - refactor(cloudflare-workers): Suppress eslint noise by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2504](https://togithub.com/honojs/hono/pull/2504) - fix(jsx): Add catch to async function's promise by [@​mwilkins91](https://togithub.com/mwilkins91) in [https://github.com/honojs/hono/pull/2471](https://togithub.com/honojs/hono/pull/2471) ##### New Contributors - [@​nagasawaryoya](https://togithub.com/nagasawaryoya) made their first contribution in [https://github.com/honojs/hono/pull/2500](https://togithub.com/honojs/hono/pull/2500) - [@​exoego](https://togithub.com/exoego) made their first contribution in [https://github.com/honojs/hono/pull/2503](https://togithub.com/honojs/hono/pull/2503) - [@​mwilkins91](https://togithub.com/mwilkins91) made their first contribution in [https://github.com/honojs/hono/pull/2471](https://togithub.com/honojs/hono/pull/2471) **Full Changelog**: https://github.com/honojs/hono/compare/v4.2.3...v4.2.4 ### [`v4.2.3`](https://togithub.com/honojs/hono/releases/tag/v4.2.3) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.2...v4.2.3) #### What's Changed - fix(ssg): use response header to mark as disabled routes for SSG by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2477](https://togithub.com/honojs/hono/pull/2477) - fix(trailing-slash): export types in `package.json` correctly by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2483](https://togithub.com/honojs/hono/pull/2483) - fix(client): fix websocket client protocol by [@​naporin0624](https://togithub.com/naporin0624) in [https://github.com/honojs/hono/pull/2479](https://togithub.com/honojs/hono/pull/2479) **Full Changelog**: https://github.com/honojs/hono/compare/v4.2.2...v4.2.3

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.



This PR has been generated by Mend Renovate. View repository job log here.