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.
- package/dist/server/router.d.ts +12 -4
- package/dist/types.d.ts +3 -1
- package/package.json +1 -1
package/dist/server/router.d.ts
CHANGED
|
@@ -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:
|
|
90
|
-
|
|
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:
|
|
96
|
-
|
|
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;
|