77 useSuspenseQuery ,
88 type DefaultError ,
99 type InfiniteData ,
10+ type QueryKey ,
1011 type UseInfiniteQueryOptions ,
1112 type UseInfiniteQueryResult ,
1213 type UseMutationOptions ,
@@ -87,19 +88,29 @@ function useHooksContext() {
8788
8889export type ModelQueryOptions < T > = Omit < UseQueryOptions < T , DefaultError > , 'queryKey' > & ExtraQueryOptions ;
8990
91+ export type ModelQueryResult < T > = UseQueryResult < T , DefaultError > & { queryKey : QueryKey } ;
92+
9093export type ModelSuspenseQueryOptions < T > = Omit < UseSuspenseQueryOptions < T , DefaultError > , 'queryKey' > &
9194 ExtraQueryOptions ;
9295
96+ export type ModelSuspenseQueryResult < T > = UseSuspenseQueryResult < T , DefaultError > & { queryKey : QueryKey } ;
97+
9398export type ModelInfiniteQueryOptions < T > = Omit <
9499 UseInfiniteQueryOptions < T , DefaultError , InfiniteData < T > > ,
95100 'queryKey' | 'initialPageParam'
96101> ;
97102
103+ export type ModelInfiniteQueryResult < T > = UseInfiniteQueryResult < T , DefaultError > & { queryKey : QueryKey } ;
104+
98105export type ModelSuspenseInfiniteQueryOptions < T > = Omit <
99106 UseSuspenseInfiniteQueryOptions < T , DefaultError , InfiniteData < T > > ,
100107 'queryKey' | 'initialPageParam'
101108> ;
102109
110+ export type ModelSuspenseInfiniteQueryResult < T > = UseSuspenseInfiniteQueryResult < T , DefaultError > & {
111+ queryKey : QueryKey ;
112+ } ;
113+
103114export type ModelMutationOptions < T , TArgs > = Omit < UseMutationOptions < T , DefaultError , TArgs > , 'mutationFn' > &
104115 ExtraMutationOptions ;
105116
@@ -113,48 +124,48 @@ export type ModelQueryHooks<Schema extends SchemaDef, Model extends GetModels<Sc
113124 useFindUnique < T extends FindUniqueArgs < Schema , Model > > (
114125 args : SelectSubset < T , FindUniqueArgs < Schema , Model > > ,
115126 options ?: ModelQueryOptions < ModelResult < Schema , Model , T > | null > ,
116- ) : UseQueryResult < ModelResult < Schema , Model , T > | null > ;
127+ ) : ModelQueryResult < ModelResult < Schema , Model , T > | null > ;
117128
118129 useSuspenseFindUnique < T extends FindUniqueArgs < Schema , Model > > (
119130 args : SelectSubset < T , FindUniqueArgs < Schema , Model > > ,
120131 options ?: ModelSuspenseQueryOptions < ModelResult < Schema , Model , T > | null > ,
121- ) : UseSuspenseQueryResult < ModelResult < Schema , Model , T > | null > ;
132+ ) : ModelSuspenseQueryResult < ModelResult < Schema , Model , T > | null > ;
122133
123134 useFindFirst < T extends FindArgs < Schema , Model , false > > (
124135 args ?: SelectSubset < T , FindArgs < Schema , Model , false > > ,
125136 options ?: ModelQueryOptions < ModelResult < Schema , Model , T > | null > ,
126- ) : UseQueryResult < ModelResult < Schema , Model , T > | null > ;
137+ ) : ModelQueryResult < ModelResult < Schema , Model , T > | null > ;
127138
128139 useSuspenseFindFirst < T extends FindArgs < Schema , Model , false > > (
129140 args ?: SelectSubset < T , FindArgs < Schema , Model , false > > ,
130141 options ?: ModelSuspenseQueryOptions < ModelResult < Schema , Model , T > | null > ,
131- ) : UseSuspenseQueryResult < ModelResult < Schema , Model , T > | null > ;
142+ ) : ModelSuspenseQueryResult < ModelResult < Schema , Model , T > | null > ;
132143
133144 useFindMany < T extends FindArgs < Schema , Model , true > > (
134145 args ?: SelectSubset < T , FindArgs < Schema , Model , true > > ,
135146 options ?: ModelQueryOptions < ModelResult < Schema , Model , T > [ ] > ,
136- ) : UseQueryResult < ModelResult < Schema , Model , T > [ ] > ;
147+ ) : ModelQueryResult < ModelResult < Schema , Model , T > [ ] > ;
137148
138149 useSuspenseFindMany < T extends FindArgs < Schema , Model , true > > (
139150 args ?: SelectSubset < T , FindArgs < Schema , Model , true > > ,
140151 options ?: ModelSuspenseQueryOptions < ModelResult < Schema , Model , T > [ ] > ,
141- ) : UseSuspenseQueryResult < ModelResult < Schema , Model , T > [ ] > ;
142-
143- useSuspenseInfiniteFindMany < T extends FindArgs < Schema , Model , true > > (
144- args ?: SelectSubset < T , FindArgs < Schema , Model , true > > ,
145- options ?: ModelSuspenseInfiniteQueryOptions < ModelResult < Schema , Model , T > [ ] > ,
146- ) : UseSuspenseInfiniteQueryResult < InfiniteData < ModelResult < Schema , Model , T > [ ] > > ;
152+ ) : ModelSuspenseQueryResult < ModelResult < Schema , Model , T > [ ] > ;
147153
148154 useInfiniteFindMany < T extends FindArgs < Schema , Model , true > > (
149155 args ?: SelectSubset < T , FindArgs < Schema , Model , true > > ,
150156 options ?: ModelInfiniteQueryOptions < ModelResult < Schema , Model , T > [ ] > ,
151- ) : UseInfiniteQueryResult < InfiniteData < ModelResult < Schema , Model , T > [ ] > > ;
157+ ) : ModelInfiniteQueryResult < InfiniteData < ModelResult < Schema , Model , T > [ ] > > ;
158+
159+ useSuspenseInfiniteFindMany < T extends FindArgs < Schema , Model , true > > (
160+ args ?: SelectSubset < T , FindArgs < Schema , Model , true > > ,
161+ options ?: ModelSuspenseInfiniteQueryOptions < ModelResult < Schema , Model , T > [ ] > ,
162+ ) : ModelSuspenseInfiniteQueryResult < InfiniteData < ModelResult < Schema , Model , T > [ ] > > ;
152163
153164 useCreate < T extends CreateArgs < Schema , Model > > (
154- options ?: UseMutationOptions < ModelResult < Schema , Model , T > , DefaultError , T > ,
165+ options ?: ModelMutationOptions < ModelResult < Schema , Model , T > , T > ,
155166 ) : ModelMutationResult < ModelResult < Schema , Model , T > , T > ;
156167
157- useCreateMany < T extends CreateManyArgs < Schema , Model > [ ] > (
168+ useCreateMany < T extends CreateManyArgs < Schema , Model > > (
158169 options ?: ModelMutationOptions < BatchResult , T > ,
159170 ) : ModelMutationResult < BatchResult , T > ;
160171
@@ -188,27 +199,27 @@ export type ModelQueryHooks<Schema extends SchemaDef, Model extends GetModels<Sc
188199
189200 useCount < T extends CountArgs < Schema , Model > > (
190201 options ?: ModelQueryOptions < CountResult < Schema , Model , T > > ,
191- ) : UseQueryResult < CountResult < Schema , Model , T > > ;
202+ ) : ModelQueryResult < CountResult < Schema , Model , T > > ;
192203
193204 useSuspenseCount < T extends CountArgs < Schema , Model > > (
194205 options ?: ModelSuspenseQueryOptions < CountResult < Schema , Model , T > > ,
195- ) : UseSuspenseQueryResult < CountResult < Schema , Model , T > > ;
206+ ) : ModelSuspenseQueryResult < CountResult < Schema , Model , T > > ;
196207
197208 useAggregate < T extends AggregateArgs < Schema , Model > > (
198209 options ?: ModelQueryOptions < AggregateResult < Schema , Model , T > > ,
199- ) : UseQueryResult < AggregateResult < Schema , Model , T > > ;
210+ ) : ModelQueryResult < AggregateResult < Schema , Model , T > > ;
200211
201212 useSuspenseAggregate < T extends AggregateArgs < Schema , Model > > (
202213 options ?: ModelSuspenseQueryOptions < AggregateResult < Schema , Model , T > > ,
203- ) : UseSuspenseQueryResult < AggregateResult < Schema , Model , T > > ;
214+ ) : ModelSuspenseQueryResult < AggregateResult < Schema , Model , T > > ;
204215
205216 useGroupBy < T extends GroupByArgs < Schema , Model > > (
206217 options ?: ModelQueryOptions < GroupByResult < Schema , Model , T > > ,
207- ) : UseQueryResult < GroupByResult < Schema , Model , T > > ;
218+ ) : ModelQueryResult < GroupByResult < Schema , Model , T > > ;
208219
209220 useSuspenseGroupBy < T extends GroupByArgs < Schema , Model > > (
210221 options ?: ModelSuspenseQueryOptions < GroupByResult < Schema , Model , T > > ,
211- ) : UseSuspenseQueryResult < GroupByResult < Schema , Model , T > > ;
222+ ) : ModelSuspenseQueryResult < GroupByResult < Schema , Model , T > > ;
212223} ;
213224
214225/**
@@ -233,7 +244,7 @@ export function useModelQueries<Schema extends SchemaDef, Model extends GetModel
233244 throw new Error ( `Model "${ model } " not found in schema` ) ;
234245 }
235246
236- const modelName = lowerCaseFirst ( modelDef . name ) ;
247+ const modelName = modelDef . name ;
237248
238249 return {
239250 useFindUnique : ( args : any , options ?: any ) => {
0 commit comments