@orval/hono 8.1.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/zValidator.ts +20 -15
  2. package/package.json +3 -3
@@ -70,21 +70,26 @@ export const zValidator =
70
70
  ): MiddlewareHandler<E, P, V> =>
71
71
  async (c, next) => {
72
72
  if (target !== 'response'){
73
- return zValidatorBase<
74
- T,
75
- keyof ValidationTargets,
76
- E,
77
- P,
78
- In,
79
- Out,
80
- I,
81
- V,
82
- InferredValue
83
- >(
84
- target,
85
- schema,
86
- hook as Hook<InferredValue, E, P, keyof ValidationTargets, {}, T>
87
- )(c, next)
73
+ const baseTarget = target as keyof ValidationTargets;
74
+ const baseHook = hook
75
+ ? (
76
+ result: Parameters<
77
+ Hook<zInfer<T>, Env, string, keyof ValidationTargets, {}, T>
78
+ >[0],
79
+ ctx: Context<Env, string>,
80
+ ) =>
81
+ hook(
82
+ { ...result, target } as Parameters<typeof hook>[0],
83
+ ctx as unknown as Context<E, P>,
84
+ )
85
+ : undefined;
86
+ const validator = baseHook
87
+ ? zValidatorBase(baseTarget, schema, baseHook)
88
+ : zValidatorBase(baseTarget, schema);
89
+ return validator(
90
+ c as unknown as Context<Env, string>,
91
+ next,
92
+ ) as ReturnType<MiddlewareHandler<E, P, V>>;
88
93
  }
89
94
 
90
95
  await next()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orval/hono",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,8 +22,8 @@
22
22
  "nuke": "rimraf .turbo dist node_modules"
23
23
  },
24
24
  "dependencies": {
25
- "@orval/core": "8.1.0",
26
- "@orval/zod": "8.1.0",
25
+ "@orval/core": "8.2.0",
26
+ "@orval/zod": "8.2.0",
27
27
  "fs-extra": "^11.3.2",
28
28
  "remeda": "^2.32.0"
29
29
  },