Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next #3896

Merged
merged 9 commits into from
Feb 7, 2025
Merged

Next #3896

merged 9 commits into from
Feb 7, 2025

Conversation

yusukebe
Copy link
Member

@yusukebe yusukebe commented Feb 7, 2025

v4.7.0

usualoma and others added 9 commits February 6, 2025 22:00
* feat(helper/proxy): introduce proxy helper

* chore(helper/proxy): expose proxy helper

* test(helper/proxy): fix test name

* fix(helper/proxy): return Content-Range header as it is

Co-authored-by: Haochen M. Kotoi-Xie <haochenx@acm.org>

* refactor(helper/proxy): return the original content-length if the response is uncompressed

* feat(middleware): enable to pass `...c.req` to init options

* refactor(middleware/proxy): rename `proxyFetch` to `proxy`

* docs(helper/proxy): update example

* docs(helper/proxy): fix typo

* refactor(helper/proxy): also accept HonoRequest instance as request init

* fix(helper/proxy): remove hop-by-hop headers

* refactor(helper/proxy): build request init from request

* fix(helper/proxy): fix type error

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

* test(helper/proxy): add test for modify header

* fix(helper/proxy): It is generally the Set-Cookie that should be removed from the response header

---------

Co-authored-by: Haochen M. Kotoi-Xie <haochenx@acm.org>
Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
* feat(logger): include query param

* optimize slice path
* feat(factory): Allow HonoOptions<E> with factory

* refactor(factory): rename defaultOptions to defaultAppOptions
* feat(language-detector): add language detector middleware and helper function

* chore(language-detector): add export in package.json

* chore(language-detector): add export to jsr

* feat: new parse-accept helper, add edge case tests

* chore: add jsr for parse-accept

* fix: export default options, remove empty type

* refac: rename languageDetectorMiddleware to languageDetector

* chore format code

* refac: apply patches

* refactor: change export type in language
* feat(hono/context): add buffer returns

* test: add bun & deno tests for buffers

* fix(hono/context): buffer -> uint8array for web standards

---------

Co-authored-by: askorupskyy <50280805+rcbxd@users.noreply.github.com>
* Update cookie.ts

* Integrated `priority` option into setCookie serialization tests

* Add kid' to TokenHeader, fix Jwt.sign ignoring privateKey.alg with keyAlg fallback, add decodeHeaders utility

- Added "kid" (Key ID) for TokenHeader
- Fixed Jwt.sign() ignoring privateKey.alg
- Renamed `alg` parameter to `KEYAlg` to differentiate between privateKey.alg
- Added utility function `decodeHeaders` to decode only JWT headers

* Add ./src/middleware/jwk/jwk.ts to jsr.json

* Add hono/jwk to exports

* feat(hono/jwk)

Hono JWK Middleware main features:
- Ability to provide a list of public JWKs to the keys parameter as a simple javascript array []
- Ability to provide a URL in the jwks_uri parameter to fetch keys from + an optional RequestInit (useful for caching if your cloud provider has a modified fetch that supports it, or if you simply want to modify the request)
- Ability to provide an async function that returns an array to the keys parameter instead of a direct array, so that it is possible to implement own custom caching layer without a separate middleware
- Allows setting a keys directory for multi-key auth systems
- Allows auth endpoints to be always updated with the Auth provider's public JWKs directory (often `.well-known/jwks.json`) which makes key rotations without disruptions possible

Todo:
- More tests.

* (feat/Jwt.verifyFromJwks) / batteries included util

* Update index.ts

* add JwtHeaderRequiresKid exception

* using Jwt.verifyFromJwks now

* improved jsdoc and formatting

* jsdoc update

* formatting

* testing jwk's `keys` receiving an async function

* removed redundancy

* add 'Should authorize Keys function' test

Added /auth-keys-fn/* & /.well-known/jwks.json testing endpoints to the router.

* added jwks_uri test + improved test descriptions

* test naming consistency

* explicit return fix + moving global declaration merging to own interface

* cleaner jsdoc @example

* removed commented-out tests unnecessarily inflating changes

* ExtendedJsonWebKey -> HonoJsonWebKey

* Refactor test to use msw per @yusukebe's suggestion

* removed stray log + added minor validation w/ @Code-Hex

Also removed redundant "import type {} from '../..'" from 3 different files:
- jwk/index.ts
- jwt/index.ts
- request-id/index.ts

* Update index.ts

* add more test coverage

* more test coverage

* lint & format

* typo

* 100/100 test coverage

Note: Moved more code from `hono/jwk` to the `verifyFromJwks` function for backends that require JWK verification logic beyond just a middleware

* final touch

* added eslint-disable + type export
* feat(etag): allow for custom hashing methods to be used to etag

* chore: add jsdoc

* fix jsdoc

* cleanup

* fix: remove unneed code

* fix arg name

* fix
…s. (#3888)

* feat(router): support greedy matches with subsequent static components.

* feat(router): support more complex greedy matches patterns
Copy link

github-actions bot commented Feb 7, 2025

Bundle size check

main (6b6fbad) #3896 (09fbacf) +/-
Bundle Size (B) 18,764B 19,032B 268B
Bundle Size (KB) 18.32K 18.59K 0.27K

Compiler Diagnostics

main (6b6fbad) #3896 (09fbacf) +/-
Files 261 261 0
Lines 116,468 116,473 5
Identifiers 114,413 114,454 41
Symbols 303,594 303,866 272
Types 214,628 214,836 208
Instantiations 3,091,455 3,091,601 146
Memory used 453,525K 446,307K -7,218K
I/O read 0.03s 0.02s -0.01s
I/O write 0s 0s 0s
Parse time 0.69s 0.75s 0.06s
Bind time 0.27s 0.36s 0.09s
Check time 5.34s 5.78s 0.44s
Emit time 0s 0s 0s
Total time 6.31s 6.89s 0.58s

Reported by octocov

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 92.57143% with 39 lines in your changes missing coverage. Please review.

Project coverage is 91.43%. Comparing base (6b6fbad) to head (8fe1951).

Files with missing lines Patch % Lines
src/middleware/language/language.ts 85.20% 25 Missing ⚠️
src/utils/jwt/jwt.ts 87.30% 8 Missing ⚠️
src/utils/jwt/types.ts 50.00% 3 Missing ⚠️
src/router/trie-router/node.ts 92.00% 2 Missing ⚠️
src/utils/accept.ts 98.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3896      +/-   ##
==========================================
+ Coverage   91.41%   91.43%   +0.02%     
==========================================
  Files         162      168       +6     
  Lines       10281    10750     +469     
  Branches     2894     3049     +155     
==========================================
+ Hits         9398     9829     +431     
- Misses        882      920      +38     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yusukebe yusukebe merged commit 3af17fd into main Feb 7, 2025
30 checks passed
@yusukebe yusukebe deleted the next branch February 7, 2025 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants