Yusuke Wada
c6b434addd
refactor: shorten
2022-12-13 20:36:30 +09:00
Yusuke Wada
59bb0b1a40
feat(handler): "schema" allow normal types ( #700 )
...
* feat(handler): "schema" allow normal types
* check types for handler+validator+handler pattern
* denoify
* improve type definitions
2022-12-10 16:37:14 +09:00
Jayden
760ae30251
Fix detecting node runtime ( #696 )
...
* Fix
* Denoify
* Avoid error in other runtime
* chore: remove unnecessary config testPathIgnorePatterns (#697 )
* Fix vercel
Co-authored-by: Horie Issei <issei.horie@is2ei.com>
2022-12-02 11:28:49 +09:00
Arnaud Dagnelies
9af95c886e
fix: Updated CORS ( #693 )
...
* Updated CORS
Do not call `next` for OPTIONS pre-flight requests to avoid side effects and more sensible defaults.
* restoring default cors headers
* restoring cors default allowed methods to avoid breaking change
* Deno dist stuff
2022-12-01 00:11:06 +09:00
Yusuke Wada
1eb49b8d96
refactor: support new @cloudflare/worker-types
( #673 )
...
* refactor: support new `@cloudflare/worker-types`
* do not attach crypto to global
* denoify ignore serve-static for cloudlfare
* ignore the utility for cloudflare
* import types
2022-11-23 07:27:42 +09:00
Yusuke Wada
c3031a418c
fix(jsx): export fragment ( #642 )
2022-11-01 21:41:27 +09:00
Yusuke Wada
6a96ace96a
feat(types): introduce CustomHandler
interface ( #637 )
2022-11-01 00:07:56 +09:00
Yusuke Wada
7b8a25126f
fix(validator): enable handling "Bad Request" in validator ( #635 )
2022-11-01 00:03:17 +09:00
Yusuke Wada
ca52dd898e
fix(build): fix ESM support in Node.js / use esbuild
( #631 )
...
* fix(build): fix ESM support in Node.js / use `esbuild`
* add tsx
* denoify ignore
2022-10-28 08:46:02 +09:00
Yusuke Wada
8627010094
refactor(types): refactor and add tests for checking Types ( #615 )
...
* refactor(types): refactor and add tests for checking Types
* remove unused
* uncomment
* use `Handler` in validator middleware
* remove unused
* create `src/validator` dir and move some files into it
* add the case that the context is in `validator`
* rename `D` to `S`
2022-10-23 08:10:00 +09:00
Yusuke Wada
c19028374d
fix(validator): make "isOptional" work correctly with "value" validation ( #613 )
2022-10-20 16:19:13 +09:00
Yusuke Wada
7981b100de
fix(validator): show "type" error messages if does not have "value" errors ( #612 )
2022-10-20 15:46:04 +09:00
Yusuke Wada
944dfc2e13
refactor(jwt): refactor code and add more tests ( #611 )
2022-10-19 20:24:43 +09:00
Yusuke Wada
33f1cbd604
chore: denoify
2022-10-19 20:01:43 +09:00
Yusuke Wada
0da78351e9
feat(validator): has the error message per rule ( #603 )
...
* feat(validator): has the error message per rule
* add test for checking result objects
* test(validator): add array results test (#609 )
* remove `console.log`
Co-authored-by: Derrick Farris <mr.dcfarris@gmail.com>
2022-10-19 19:17:04 +09:00
Yusuke Wada
2776957bba
feat(validator): introduce nested validation ( #592 )
...
* feat(validator): introduce `v.array()` and `v.object` for nested validation
* copy objects
* remove unnecessary tests
* fix(object): make merge immutable to fix issues with missing fields (#598 )
Co-authored-by: Derrick Farris <mr.dcfarris@gmail.com>
2022-10-13 06:48:59 +09:00
Yusuke Wada
c5672a6161
perf(serve-static): return immediately if c.finalized
( #596 )
2022-10-10 00:29:40 +09:00
Yusuke Wada
f5fc9103f1
chore: denoify
2022-10-09 23:33:00 +09:00
Derrick Farris
1adc9264fc
fix(validator): return HTTP 400 on malformed JSON request ( #579 )
...
* fix(validator): return http 400 on malformed JSON request
* chore(deno): denoify malformed json changes
2022-10-04 06:16:25 +09:00
Derrick Farris
9a0389e723
feat(validator): add support for JSON array path validation ( #563 )
...
* refactor(JSONPath): improve typing of JSONPath
* chore(vscode-settings): add deno.enable=false
* fix(validator): add null to type Type def
* feat(JSON-Path): add support for array JSONPath-Plus syntax
* fix(validator): update isRequired to pass valid bool types
* test: update tests for isRequired validator
* feat(validator): add support for JSON array path validation
* chore(deno): denoify array support changes
* fix(validator): type check all vals in array
* chore(deno): denoify changes
* test(validator): add tests for array type checking
* fix(validator): change JSONPrimative to JSONPrimitive
* refactor(json): More compatible with https://jsonpath.com/ .
* implementation of `asArray`
* fix(validator): update JSONPath implementation and add isArray check in validation
* fix(validator): fix typing errors on SchemaToProp
* Revert "fix(validator): fix typing errors on SchemaToProp"
This reverts commit b8ddef85d0
.
* fix(validator): fix SchemaToProp error for VTypeArrays
* chore(deno): denoify
Co-authored-by: Taku Amano <taku@taaas.jp>
Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2022-09-30 21:56:39 +09:00
Yusuke Wada
03fc36f793
refactor(serve-static): use context/next instead of MiddlewareHandler ( #559 )
...
* fix(validator): make `isOptional` rule works correctly.
* refactor(serve-static): remove return type
* use context/next instead of MiddlewareHandler
2022-09-27 21:40:37 +09:00
Yusuke Wada
c0d88ff01c
fix(validator): make isOptional
rule works correctly. ( #555 )
2022-09-27 18:19:50 +09:00
Yusuke Wada
84451d61e1
fix(types): enable types for c.env
when using validator ( #553 )
2022-09-26 21:18:48 +09:00
Taku Amano
957a5a9ac9
feat(validator): Enable verification results to be retrieved as structured data. ( #547 )
...
* feat(validator): Enable verification results to be retrieved as structured data.
* chore: denoify
2022-09-21 09:40:17 +09:00
Yusuke Wada
594f30aa35
fix(validator): make "Types" work well ( #545 )
...
* fix(validator): make "Types" work well
* fix import statement
2022-09-21 07:55:29 +09:00
Yusuke Wada
a2cc1a01c2
feat: another idea of Validator Middleware ( #535 )
...
* feat: Another idea of validator middleware
* denoify
* set property value in constructor
* rename `option` to `options`
* add test for handling type error
* use `test` instead of `match`
2022-09-20 10:11:34 +09:00
Taku Amano
8eb20215a5
feat(cors): Enable to check origin header by a function. ( #533 )
2022-09-16 20:59:27 +09:00
Taku Amano
bbb95585d4
Check in Origin header instead of Referer ( #532 )
...
* refactor(cors): Check in Origin header instead of Referer.
* refactor(utils/url): Remove unused function getDomainFromURL.
* chore: denoify
2022-09-16 07:23:31 +09:00
Yusuke Wada
df64870f54
feat(cors): allow multiple origins ( #531 )
...
* feat(validator): add `isBoolean` and `isNumber`
* feat(cors): allow multiple origins
Close #503
2022-09-16 00:19:02 +09:00
Yusuke Wada
9c9e1c2356
feat(validator): add isBoolean
and isNumber
( #530 )
2022-09-16 00:10:37 +09:00
Yusuke Wada
62e3292460
feat(validator): add isFalsy
and isNotFalsy
( #523 )
2022-09-14 08:30:46 +09:00
Yusuke Wada
e2d704fd4f
fix(types): add types to middleware correctly ( #521 )
2022-09-14 08:17:20 +09:00
Yusuke Wada
46c6a8de5e
feat(middleware): introduce "built-in" Validator Middleware ( #505 )
...
* feat(middleware): introduce built-in Validator Middleware
* fixed type of `req.json()`
* Feat/builtin validator middleware another idea (#508 )
* Enable overwriting of query/header data.
* Returns only verified data.
* rename `index.test.ts` to `middleware.test.ts`
* add `removeAdditional` option
* handling error that the JSON body is null
* tidy
* check is it string or not
* implement `isIn`
* enable validation the valies are duplicate
Co-authored-by: Taku Amano <taku@taaas.jp>
2022-09-13 07:54:06 +09:00
Yusuke Wada
3697e156ed
fix(middleware): support multiple middleware on bearer/basic auth middleware ( #513 )
...
Fix #509
2022-09-10 18:02:36 +09:00
Yusuke Wada
24a28942de
fix: fixed the issue logger called twice ( #494 )
...
* fix: fixed the issue logger called twice
* add handling the error and shorten code
2022-09-02 21:13:47 +09:00
Yusuke Wada
1c3c9f1200
fix(type): fix type errors for Bindings and Variables ( #488 )
2022-08-27 23:57:33 +09:00
Yusuke Wada
7345b8105d
fix(ETag): fixed an error when the file size is too large. ( #461 )
...
Made `utils/crypto` supports `ReadbleStream`.
Fix #458
2022-08-09 10:35:30 +09:00
Yusuke Wada
9f2a270c28
refactor(utils/html
): rename Buffer
to StringBuffer
( #449 )
2022-08-03 11:24:51 +09:00
Yusuke Wada
3c371d0d07
chore: denoify
2022-07-31 22:19:28 +09:00
Yusuke Wada
115395766e
fix(jsx/bun): do not escape children ( #422 )
...
For JSX middleware on Bun.
Fix bug that JSX `children` will force escaped.
2022-07-24 20:39:41 +09:00
Yusuke Wada
5f60a18227
feat(jsx): support jsxImportSource
( #420 )
...
* feat(jsx): support `jsxImportSource`
Support `jsxImportSource`.
You can use this option on Bun and Deno (Wrangler does not support it).
if you write tsconfig as below, JSX middleware will be enabled without `import { jsx } from 'hono/jsx'`.
```json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxFragmentFactory": "Fragment",
"jsxImportSource": "hono/jsx"
}
}
```
* fix export path
2022-07-24 17:36:37 +09:00
Yusuke Wada
c450c56460
feat(middleware): implement Cache Middleware ( #417 )
...
* feat(middleware): implement Cache Middleware
* denoify
* do not export Cache middleware for Deno.
2022-07-23 15:02:42 +09:00
Yusuke Wada
b4a660c605
chore(deno): denoify
2022-07-18 11:56:07 +09:00
Yusuke Wada
da4d9a5491
fix(logger): specify console.log
for default print fn ( #401 )
2022-07-18 08:17:42 +09:00
Yusuke Wada
1ee08cc5ce
chore(deno): denoify
2022-07-17 18:11:09 +09:00
Yusuke Wada
be548c97ed
fix(compress): add type for enconding name ( #396 )
2022-07-17 08:59:40 +09:00
Yusuke Wada
230d265429
chore(deno): denoify
2022-07-16 10:26:14 +09:00
Yusuke Wada
af9f6a73d9
[BREAKING] feat: remove "graphql-server" middleware, will be obsolete ( #366 )
...
It might be *third-party middleware*.
Close #357
2022-07-15 08:40:15 +09:00
Yusuke Wada
16adde746b
refactor: denoify
2022-07-15 08:40:15 +09:00
Yusuke Wada
9a41cde632
chore: denoify
2022-07-15 08:40:15 +09:00