@@ -3,14 +3,14 @@ import type { Prisma, List } from '@prisma/client';
3
3
import { getContext } from 'svelte' ;
4
4
import { derived } from 'svelte/store' ;
5
5
import type { MutationOptions , QueryOptions } from '@tanstack/svelte-query' ;
6
- import type { RequestHandlerContext } from '@zenstackhq/tanstack-query/runtime ' ;
7
- import { query , postMutation , putMutation , deleteMutation , SvelteQueryContextKey } from './_helper' ;
6
+ import { SvelteQueryContextKey , type RequestHandlerContext } from './_helper ' ;
7
+ import { query , postMutation , putMutation , deleteMutation } from './_helper' ;
8
8
9
9
export function useCreateList (
10
10
options ?: Omit < MutationOptions < List , unknown , Prisma . ListCreateArgs > , 'mutationFn' > ,
11
11
invalidateQueries : boolean = true ,
12
12
) {
13
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
13
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
14
14
const _mutation = postMutation < Prisma . ListCreateArgs , List > (
15
15
'List' ,
16
16
`${ endpoint } /list/create` ,
@@ -44,7 +44,7 @@ export function useCreateManyList(
44
44
options ?: Omit < MutationOptions < Prisma . BatchPayload , unknown , Prisma . ListCreateManyArgs > , 'mutationFn' > ,
45
45
invalidateQueries : boolean = true ,
46
46
) {
47
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
47
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
48
48
const _mutation = postMutation < Prisma . ListCreateManyArgs , Prisma . BatchPayload > (
49
49
'List' ,
50
50
`${ endpoint } /list/createMany` ,
@@ -70,31 +70,31 @@ export function useFindManyList<T extends Prisma.ListFindManyArgs>(
70
70
args ?: Prisma . SelectSubset < T , Prisma . ListFindManyArgs > ,
71
71
options ?: QueryOptions < Array < Prisma . ListGetPayload < T > > > ,
72
72
) {
73
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
73
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
74
74
return query < Array < Prisma . ListGetPayload < T > > > ( 'List' , `${ endpoint } /list/findMany` , args , options ) ;
75
75
}
76
76
77
77
export function useFindUniqueList < T extends Prisma . ListFindUniqueArgs > (
78
78
args : Prisma . SelectSubset < T , Prisma . ListFindUniqueArgs > ,
79
79
options ?: QueryOptions < Prisma . ListGetPayload < T > > ,
80
80
) {
81
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
81
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
82
82
return query < Prisma . ListGetPayload < T > > ( 'List' , `${ endpoint } /list/findUnique` , args , options ) ;
83
83
}
84
84
85
85
export function useFindFirstList < T extends Prisma . ListFindFirstArgs > (
86
86
args ?: Prisma . SelectSubset < T , Prisma . ListFindFirstArgs > ,
87
87
options ?: QueryOptions < Prisma . ListGetPayload < T > > ,
88
88
) {
89
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
89
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
90
90
return query < Prisma . ListGetPayload < T > > ( 'List' , `${ endpoint } /list/findFirst` , args , options ) ;
91
91
}
92
92
93
93
export function useUpdateList (
94
94
options ?: Omit < MutationOptions < List , unknown , Prisma . ListUpdateArgs > , 'mutationFn' > ,
95
95
invalidateQueries : boolean = true ,
96
96
) {
97
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
97
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
98
98
const _mutation = putMutation < Prisma . ListUpdateArgs , List > (
99
99
'List' ,
100
100
`${ endpoint } /list/update` ,
@@ -128,7 +128,7 @@ export function useUpdateManyList(
128
128
options ?: Omit < MutationOptions < Prisma . BatchPayload , unknown , Prisma . ListUpdateManyArgs > , 'mutationFn' > ,
129
129
invalidateQueries : boolean = true ,
130
130
) {
131
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
131
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
132
132
const _mutation = putMutation < Prisma . ListUpdateManyArgs , Prisma . BatchPayload > (
133
133
'List' ,
134
134
`${ endpoint } /list/updateMany` ,
@@ -154,7 +154,7 @@ export function useUpsertList(
154
154
options ?: Omit < MutationOptions < List , unknown , Prisma . ListUpsertArgs > , 'mutationFn' > ,
155
155
invalidateQueries : boolean = true ,
156
156
) {
157
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
157
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
158
158
const _mutation = postMutation < Prisma . ListUpsertArgs , List > (
159
159
'List' ,
160
160
`${ endpoint } /list/upsert` ,
@@ -188,7 +188,7 @@ export function useDeleteList(
188
188
options ?: Omit < MutationOptions < List , unknown , Prisma . ListDeleteArgs > , 'mutationFn' > ,
189
189
invalidateQueries : boolean = true ,
190
190
) {
191
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
191
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
192
192
const _mutation = deleteMutation < Prisma . ListDeleteArgs , List > (
193
193
'List' ,
194
194
`${ endpoint } /list/delete` ,
@@ -222,7 +222,7 @@ export function useDeleteManyList(
222
222
options ?: Omit < MutationOptions < Prisma . BatchPayload , unknown , Prisma . ListDeleteManyArgs > , 'mutationFn' > ,
223
223
invalidateQueries : boolean = true ,
224
224
) {
225
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
225
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
226
226
const _mutation = deleteMutation < Prisma . ListDeleteManyArgs , Prisma . BatchPayload > (
227
227
'List' ,
228
228
`${ endpoint } /list/deleteMany` ,
@@ -248,7 +248,7 @@ export function useAggregateList<T extends Prisma.ListAggregateArgs>(
248
248
args : Prisma . SelectSubset < T , Prisma . ListAggregateArgs > ,
249
249
options ?: QueryOptions < Prisma . GetListAggregateType < T > > ,
250
250
) {
251
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
251
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
252
252
return query < Prisma . GetListAggregateType < T > > ( 'List' , `${ endpoint } /list/aggregate` , args , options ) ;
253
253
}
254
254
@@ -317,7 +317,7 @@ export function useGroupByList<
317
317
: InputErrors
318
318
> ,
319
319
) {
320
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
320
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
321
321
return query <
322
322
{ } extends InputErrors
323
323
? Array <
@@ -343,7 +343,7 @@ export function useCountList<T extends Prisma.ListCountArgs>(
343
343
: number
344
344
> ,
345
345
) {
346
- const endpoint = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) . endpoint ;
346
+ const { endpoint } = getContext < RequestHandlerContext > ( SvelteQueryContextKey ) ;
347
347
return query <
348
348
T extends { select : any }
349
349
? T [ 'select' ] extends true
0 commit comments