0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-22 11:17:33 +01:00
Commit Graph

85 Commits

Author SHA1 Message Date
Ame_x
f1c7d312a8
fix(validator-types): type Alignment with Web Standards (#3120)
* fix(validator-types): type Alignment with Web Standards

* fix
2024-07-11 16:34:36 +09:00
naporitan
ddc1de8394
fix(client): Add Query Parameter Support to WebSocket Client in hono/client (#3066)
* chore(client): fix url with query parameter websocket client

* chore(client): remove log
2024-07-01 17:05:45 +09:00
m-shaka
1d16b84b62
fix(client): set Path as the default of Original (#3058) 2024-06-30 07:50:45 +09:00
yasuaki640
57c95d4df5
test(client): test uncovered return statement (#2985) 2024-06-17 23:39:40 +09:00
Trung Dang
00f32b7c17
fix(types): SimplifyDeepArray should now actually be "deep" (#2920)
* fix(types): `SimplifyDeepArray` should now actually be "deep"

Also now uses `Simplify` instead of inline declare the type

* tests(types): extra tests for `Should have correct types - interfaces`

* style: apply lint&style fixes

* docs: rewording SimplifyDeepArray jsdoc

* fix: type is possibly infinite

* fix: mismatching implementation of interface

* refactor: split JSONRespond return declaration to it's own type

DRY-er code and fixes a weird type is possibly infinite yelling
2024-06-06 22:09:33 +09:00
Yusuke Wada
448a0027ba
feat(context): c.redirect() supports TypedResponse (#2908) 2024-06-06 16:48:34 +09:00
Trung Dang
5beac4e217
fix(types): #2912: interfaces array's respond typed as never (#2915)
* feat: add `DeepSimplify` type

* fix(types): #2912: interfaces array's respond typed as `never`

* refactor: wording `DeepSimplify` => `SimplifyDeepArray`

* docs(jsdoc): add jsdoc for `Simplify`, `SimplifyDeepArray`
2024-06-06 16:44:19 +09:00
odri
366f760a30
fix(client): allow multiple files on the same key in form (#2791)
* fix(client): allow multiple files on the same key in form

* add tests and update `msw`

* fixed import order

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2024-05-28 18:39:01 +09:00
Yusuke Wada
6d9f1f09a9
docs: add module doc (#2796) 2024-05-26 14:16:25 +09:00
Yusuke Wada
1b2a4c0800
feat(jsr): support JSR (#2662)
* feat(jsr): reduce slow types (#2369)

* feat(jsr): reduce slow types

* fix: use allow function

* chore: format code

* chore: denoify

* add `deno.json`

* add `jsr-dry-run` command for CI

* don't put `JSX` on `global`

* fix test settings for deno

* don't use `dynamicClass`

* don't declare `ExecutionContext` in `global`

* goodbye denoify

* exports `./middleware`

* exports `./helper`

* exports each helper and middleware

* remove the `awslambda` implementation which is not enough

* feat(jsr): remove helper.ts and middleware.ts (#2667)

* feat(jsr): remove helper.ts and middleware.ts

* fix: fix test

* dont' use `SuperClass`

Co-authored-by: Taku Amano <taku@taaas.jp>

* feat(jsr): delete `mod.ts` (#2669)

* rename `deno.json` to `jsr.json`

* lint

* remove slow type in lambda adapter

* fixed runtime test for deno

* export all utils

* add a GitHub action to publish the package to JSR

* fixed declaring `ContextVariableMap`

* fixed the type error

* include `jsr.json` in `jsr.json`

* update `jsr.json`

---------

Co-authored-by: Shotaro Nakamura <79000684+nakasyou@users.noreply.github.com>
Co-authored-by: Taku Amano <taku@taaas.jp>
2024-05-24 17:47:28 +09:00
Trung Dang
fb07fb4012
feat(hc): add init option (#2592) 2024-05-03 09:02:54 +09:00
Trung Dang
9732a7ba90
feat(types): improve ToSchema & WebSocket Helper types (#2588)
* feat: add `outputFormat` types to Input

Co-authored-by: Shotaro Nakamura <syoutarou1103@outlook.jp>

* feat: `ToSchema` ability to use whole `Input`

Co-authored-by: Shotaro Nakamura <syoutarou1103@outlook.jp>

* feat: improve `UpgradeWebSocket` types flow

Co-authored-by: Shotaro Nakamura <syoutarou1103@outlook.jp>

---------

Co-authored-by: Shotaro Nakamura <syoutarou1103@outlook.jp>
2024-05-03 08:32:31 +09:00
Trung Dang
2b2dacc2e1
feat(types): improve response types flow (#2581)
* fix: `ClientResponse` now properly extends fetch's `Response`

Better experience / fix types error when working with functions that expects a fetch's `Response`

* feat(context): switch from `InterfaceToType` to `Simplify` for better performance

Also automatically infer ReturnType for cleaner code

* feat(context): infer `TypedResponse` for `TextRespond`

* feat: improve response types flow with `ResponseFormat`

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>

* tests: adjust & add new tests for `TextRespond` & `ResponseFormat`

* tests: improve test of using interface

* chore: denoify

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2024-05-03 01:28:15 +09:00
kosei28
8129a3a06e
feat(rpc): Add status code to response type (#2499)
* feat: add status code to response type

* fix MergeSchemaPath

* remove TypedResponseInit

* fix issues

* update tests

* add types tests

* add client tests

* denoify

* fix client test

* fix validator test

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2024-04-30 20:03:32 +09:00
Shotaro Nakamura
5c9d8b4172
fix(client): Don't show $ws when not used WebSockets (#2532)
* fix(client): Don't show `$ws` when not used ws

* test(client): add types test

* chore: format code

* chore: remove no used arg
2024-04-22 08:42:09 +09:00
Yusuke Wada
ed51b0b5d8
fix(client): shuold not remove tailing slash from top-level URL (#2523)
* fix(client): shuold not remove tailing slash from top-level URL

* denoify
2024-04-18 09:55:11 +09:00
Islam Sharabash
932307efd8
fix(client): Allow calling toString and valueOf on the proxy object (#2510)
Fixes #2509

When a hono client is instantiated in expo and then console.log(client)
is called, an error is thrown:

`TypeError: Cannot determine default value of object`

This is because the hermes javascript engine expects `new String(val)`
to always return a string. But the proxy object would return a
ClientRequestImpl object instead.

This commit makes a string / function returned in the cases where
.toString() and .valueOf() is called on the function.name or function
respectively.

Also see https://github.com/facebook/hermes/issues/205
2024-04-18 07:49:49 +09:00
TATSUNO “Taz” Yasuhiro
fb31c8aaac
refactor: Remove redundant initializer (#2502) 2024-04-13 16:59:57 +09:00
naporitan
1d4c67ae41
fix(client): fix websocket client protocol (#2479)
* chore(client): create replaceUrlProtocol

* chore(client): fix websocket client url protocol bug

* chore(deno_dist): generate deno code

* chore(client): add test

* chore(client): change test case description

* chore(client): add https, wss test
2024-04-09 17:01:58 +09:00
Yusuke Wada
837f16b75a
fix(client): infer null correctly (#2469)
* fix(client): infer `null` correctly

* denoify
2024-04-05 02:39:01 -05:00
niko-gardenanet
35f15b73e4
feat(client): accept a function that provides dynamic headers to hc (#2461) 2024-04-05 01:57:09 -05:00
Yusuke Wada
ebdcd246b3
fix(types): MergePath merge blank paths correctly (#2365)
* fix(types): `MergePath` merge blank paths correctly

* denoify
2024-03-19 05:47:44 +09:00
poteboy
25beca878f
fix(client): Remove trailing slash from /index for precise path matching (#2344) 2024-03-13 08:22:45 +00:00
Shotaro Nakamura
47f5c545f2
feat: Introduce WebSocket Helper / Adapter (#2265)
* feat: Add WebSocket API

* chore: format code

* chore: denoify

* feat: remove `bun-types`

* fix(ws): Cloudflare workers

* feat(ws): Add Deno Adapter

* fix(ws): Add Deno exports to package.json

* feat: test code

* chore: denoify

* chore: format code

* fix: eslint

* chore: createBunWebSocket to createWebSocket

* chore: able to import from index.ts

* feat: add workers test

* feat: add deno test

* typo: `normalizedReceiveData`

* refactor: change way to discrimination client type

* fix: bypass test

* fix: format code and bypass test

* fix: forget to delete `console.log` for debug

* feat(ws): remove `hono/ws/{adapter}` import
2024-03-05 22:04:04 +09:00
Fukui
13b58556c5
fix(client): Fix regex pattern with length limit at replaceUrlParam (#2193)
* fix: regex pattern with length limit at replaceUrlParam

* fix: multiple length limit case

* fix: use shorter pattern
2024-02-13 21:34:54 +09:00
Yusuke Wada
ebbd444661
feat!(validator): supports transformation (#2130)
* feat!(validator): supports transformation

* refactored

* denoify
2024-02-02 13:21:08 +09:00
Yusuke Wada
b24f9e38da Merge branch 'main' into v4 2024-01-29 23:44:20 +09:00
Yusuke Wada
ead3677601
chore: use Bun as a package manager (#2105)
* chore: use Bun as a package manager

* lock `np`
2024-01-29 23:27:54 +09:00
Yusuke Wada
f616ed9abe
chore(lint): set curly rule as all (#2112)
* chore(lint): set `curly` rule as `all`

* denoify
2024-01-29 22:21:09 +09:00
Yusuke Wada
6a8b4e61ba Merge branch 'main' into v4 2024-01-15 16:17:45 +09:00
Yusuke Wada
e8753d7035
feat(client): export ClientResponse and ClientRequest (#1952)
* feat(client): export `ClientResponse` and `ClientRequest`

* denoify
2024-01-12 15:29:27 +09:00
Yusuke Wada
fb96a76ee5
feat!: remove deprecated features (#1934)
* feat!: remove deprecated features

* denoify

* remove not used `import`

* denoify
2024-01-10 09:33:44 +09:00
Eli Edds
a93ddaf623
fix(client): Fix issue awaiting RPC client (#1924)
* allow awaiting clients

* update deno_dist

* add test for awaiting client
2024-01-10 06:45:00 +09:00
Yusuke Wada
32e2e3c372
feat(client): add param option to $url() (#1885)
* feat(client): add `param` option to `$url()`

* denoify
2024-01-03 19:53:38 +09:00
Yusuke Wada
e2601c3f0c
fix(client): add missing properties to ClientResponse (#1861)
* fix(client): add missing properties to `ClientResponse`

* denoify
2023-12-27 06:26:56 +09:00
Yusuke Wada
3817ccccc9
fix(factory): infer a merged path correctly (#1821)
* fix(factory): infer a merged path correctly

* denoify
2023-12-14 21:28:15 +09:00
Yusuke Wada
af8d16b6db
fix(context): c.json() allows object and returns JSONParsed<T> (#1806)
* fix(context): `c.json()` allows object and returns JSONParsed<T>

* denoify
2023-12-13 09:01:34 +09:00
Yusuke Wada
477e763ad3
fix(client): make ClientResponse.json() returns Union correctly (#1786)
* fix(client): make `ClientResponse.json()` returns Union correctly

* denoify
2023-12-06 23:11:34 +09:00
Yusuke Wada
42912df795
fix(context): Strict type checking c.json() (#1776)
* fix(context): Strict type checking `c.json()`

* denoify
2023-12-04 22:14:49 +09:00
Yusuke Wada
b21f33c987
Merge pull request #1774 from honojs/next
Next
2023-12-04 17:36:48 +09:00
Yusuke Wada
99f5e132bc
fix(client): Allow optional props in JSON response (#1769)
* fix(client): allow optional props in JSON response

* denoify
2023-12-03 18:55:59 +09:00
Taku Amano
d16aedfffd
feat: Ensure that calls to c.json() have a type equivalent to c.jsonT() (#1728)
* feat: Ensure that calls to `c.json()` have a type equivalent to `c.jsonT()`

* refactor: Objects with "response" properties are never returned by the handler

* refactor: "status" is not needed in TypedResponse

* refactor: Revive `c.jsonT()` and add @deprecated label

* refactor: Tweaks commenting on "eslint-disable" broken by `format:fix`

* test: Use `c.json()` instead of `c.jsonT()` to make sure there are no problems

* refactor: allow ambiguous type for `c.json()`

* chore: denoify

* fix: Remove unused TypedResponse from import statement
2023-12-03 09:03:14 +09:00
Andrew
a654842d56
fix(client/types): make args param optional if the input has no required keys (#1618)
* feat(types.ts): add RequiredKeysOf and HasRequiredKeys utility types

* fix(client/types.ts): make args param optional if input has no required keys

* chore(types.ts): move RequiredKeysOf and HasRequiredKeys types to utils/types.ts

* chore(types.ts): rewrite ClientRequest type

* chore(types.ts): fix formatting

* chore(types.ts): denoify
2023-10-26 18:07:25 +09:00
Yusuke Wada
3c6b18fb2f
fix(hc): allows optional schemas (#1608)
* fix(hc): allows optional schemas

* denoify
2023-10-22 23:23:53 +09:00
hagishi
cdb36b80af
feat(client) add cookie type validate (#1476)
* feat: add hc header type check

* fix: revert comment

* denoify

* feat(client): add cookie type valid

* denoify

* feat: remove function from cookie helper

* refactor: modify client type
2023-09-19 07:25:34 +09:00
hagishi
a5ba936784
feat: Refactor ClientRequest Type for header validation (#1462)
* feat: add hc header type check

* fix: revert comment

* denoify
2023-09-17 01:09:47 +09:00
hagishi
00af2a5e60
feat: allow the type of app.request (#1444)
* feat: allow the type of app.request

* typo
2023-09-13 08:04:04 +09:00
Yusuke Wada
f2bdfd8423 Merge branch 'main' into next 2023-09-09 16:55:59 +09:00
Yusuke Wada
7418198e36
fix(client): remove async from $url() (#1430)
* v3.6.0-rc.1

* fix(client): remove async from `$url()`

* denoify
2023-09-09 16:15:13 +09:00
Yusuke Wada
bb1b9146ed
fix(types): fix MergeSchemaPath correct (#1426)
* fix(types): fix `MergeSchemaPath` correct

* denoify
2023-09-08 22:22:38 +09:00