rouzer 1.0.0-beta.16 → 1.0.0-beta.17

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.
@@ -86,14 +86,22 @@ export declare function createRouter<TRoutes extends Routes, TMiddleware extends
86
86
  path: T extends {
87
87
  path: any;
88
88
  } ? z.infer<T["path"]> : Params<TRoutes[K]["path"]["source"]>;
89
- query: z.infer<T["query"]>;
90
- headers: z.infer<T["headers"]>;
89
+ query: T extends {
90
+ query: any;
91
+ } ? z.infer<T["query"]> : undefined;
92
+ headers: T extends {
93
+ headers: any;
94
+ } ? z.infer<T["headers"]> : undefined;
91
95
  }) => Promisable<Response | InferRouteResponse<T>> : T extends MutationRouteSchema ? (context: MiddlewareContext<TMiddleware> & {
92
96
  path: T extends {
93
97
  path: any;
94
98
  } ? z.infer<T["path"]> : Params<TRoutes[K]["path"]["source"]>;
95
- body: z.infer<T["body"]>;
96
- headers: z.infer<T["headers"]>;
99
+ body: T extends {
100
+ body: any;
101
+ } ? z.infer<T["body"]> : undefined;
102
+ headers: T extends {
103
+ headers: any;
104
+ } ? z.infer<T["headers"]> : undefined;
97
105
  }) => Promisable<Response | InferRouteResponse<T>> : never : never : never; }; }) => import("alien-middleware").ApplyMiddleware<TMiddleware, (context: HattipContext<TMiddleware extends MiddlewareChain<infer T extends {
98
106
  initial: {
99
107
  env: object;
package/dist/types.d.ts CHANGED
@@ -50,12 +50,14 @@ type QueryArgs<T> = T extends QueryRouteSchema & {
50
50
  } : {
51
51
  query: z.infer<TQuery>;
52
52
  } : unknown;
53
- type MutationArgs<T> = T extends MutationRouteSchema & {
53
+ type MutationArgs<T> = T extends MutationRouteSchema ? T extends {
54
54
  body: infer TBody;
55
55
  } ? {} extends z.infer<TBody> ? {
56
56
  body?: z.infer<TBody>;
57
57
  } : {
58
58
  body: z.infer<TBody>;
59
+ } : {
60
+ body?: unknown;
59
61
  } : unknown;
60
62
  export type RouteArgs<T extends RouteSchema = any> = ([T] extends [Any] ? {
61
63
  query?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rouzer",
3
- "version": "1.0.0-beta.16",
3
+ "version": "1.0.0-beta.17",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {