@zenstackhq/tanstack-query 3.0.0-beta.17 → 3.0.0-beta.18
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/.turbo/turbo-build.log +27 -13
- package/dist/react.cjs +35 -33
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +26 -106
- package/dist/react.d.ts +26 -106
- package/dist/react.js +35 -33
- package/dist/react.js.map +1 -1
- package/dist/svelte.cjs +1224 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +381 -0
- package/dist/svelte.d.ts +381 -0
- package/dist/svelte.js +1183 -0
- package/dist/svelte.js.map +1 -0
- package/dist/types-BRIDXxNC.d.cts +92 -0
- package/dist/types-BRIDXxNC.d.ts +92 -0
- package/dist/vue.cjs +1192 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +382 -0
- package/dist/vue.d.ts +382 -0
- package/dist/vue.js +1152 -0
- package/dist/vue.js.map +1 -0
- package/package.json +43 -11
- package/src/react.ts +168 -155
- package/src/svelte.ts +483 -0
- package/src/utils/common.ts +4 -13
- package/src/utils/types.ts +13 -0
- package/src/vue.ts +429 -0
- package/test/react-typing-test.ts +109 -0
- package/test/schemas/basic/input.ts +40 -0
- package/test/schemas/basic/models.ts +2 -0
- package/test/schemas/basic/schema-lite.ts +48 -0
- package/test/schemas/basic/schema.zmodel +11 -1
- package/test/svelte-typing-test.ts +106 -0
- package/test/vue-typing-test.ts +107 -0
- package/tsup.config.ts +2 -0
package/dist/svelte.d.ts
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import * as _tanstack_svelte_query from '@tanstack/svelte-query';
|
|
2
|
+
import { CreateQueryOptions, DefaultError, CreateQueryResult, QueryKey, CreateInfiniteQueryOptions, InfiniteData, CreateInfiniteQueryResult, CreateMutationOptions, CreateMutationResult, StoreOrVal } from '@tanstack/svelte-query';
|
|
3
|
+
import { SelectIncludeOmit, ModelResult, FindUniqueArgs, SelectSubset, FindArgs, CreateArgs, CreateManyArgs, BatchResult, CreateManyAndReturnArgs, UpdateArgs, UpdateManyArgs, UpdateManyAndReturnArgs, UpsertArgs, DeleteArgs, DeleteManyArgs, CountArgs, Subset, CountResult, AggregateArgs, AggregateResult, GroupByArgs, GroupByResult } from '@zenstackhq/orm';
|
|
4
|
+
import { SchemaDef, GetModels } from '@zenstackhq/schema';
|
|
5
|
+
import { Readable } from 'svelte/store';
|
|
6
|
+
import { A as APIContext, E as ExtraQueryOptions, a as ExtraMutationOptions, T as TrimDelegateModelOperations } from './types-BRIDXxNC.js';
|
|
7
|
+
export { F as FetchFn } from './types-BRIDXxNC.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The default query endpoint.
|
|
11
|
+
*/
|
|
12
|
+
declare const DEFAULT_QUERY_ENDPOINT = "/api/model";
|
|
13
|
+
/**
|
|
14
|
+
* Key for setting and getting the global query context.
|
|
15
|
+
*/
|
|
16
|
+
declare const SvelteQueryContextKey = "zenstack-svelte-query-context";
|
|
17
|
+
/**
|
|
18
|
+
* Set context for query settings.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated use {@link setQuerySettingsContext} instead.
|
|
21
|
+
*/
|
|
22
|
+
declare function setHooksContext(context: APIContext): void;
|
|
23
|
+
/**
|
|
24
|
+
* Set context for query settings.
|
|
25
|
+
*/
|
|
26
|
+
declare function setQuerySettingsContext(context: APIContext): void;
|
|
27
|
+
type ModelQueryOptions<T> = Omit<CreateQueryOptions<T, DefaultError>, 'queryKey'> & ExtraQueryOptions;
|
|
28
|
+
type ModelQueryResult<T> = Readable<UnwrapStore<CreateQueryResult<T, DefaultError>> & {
|
|
29
|
+
queryKey: QueryKey;
|
|
30
|
+
}>;
|
|
31
|
+
type ModelInfiniteQueryOptions<T> = Omit<CreateInfiniteQueryOptions<T, DefaultError, InfiniteData<T>>, 'queryKey' | 'initialPageParam'>;
|
|
32
|
+
type ModelInfiniteQueryResult<T> = Readable<UnwrapStore<CreateInfiniteQueryResult<T, DefaultError>> & {
|
|
33
|
+
queryKey: QueryKey;
|
|
34
|
+
}>;
|
|
35
|
+
type ModelMutationOptions<T, TArgs> = Omit<CreateMutationOptions<T, DefaultError, TArgs>, 'mutationFn'> & ExtraMutationOptions;
|
|
36
|
+
type ModelMutationResult<T, TArgs> = CreateMutationResult<T, DefaultError, TArgs>;
|
|
37
|
+
type ModelMutationModelResult<Schema extends SchemaDef, Model extends GetModels<Schema>, TArgs extends SelectIncludeOmit<Schema, Model, boolean>, Array extends boolean = false> = Readable<Omit<UnwrapStore<ModelMutationResult<ModelResult<Schema, Model, TArgs>, TArgs>>, 'mutateAsync'> & {
|
|
38
|
+
mutateAsync<T extends TArgs>(args: T, options?: ModelMutationOptions<ModelResult<Schema, Model, T>, T>): Promise<Array extends true ? ModelResult<Schema, Model, T>[] : ModelResult<Schema, Model, T>>;
|
|
39
|
+
}>;
|
|
40
|
+
type ClientHooks<Schema extends SchemaDef> = {
|
|
41
|
+
[Model in GetModels<Schema> as `${Uncapitalize<Model>}`]: ModelQueryHooks<Schema, Model>;
|
|
42
|
+
};
|
|
43
|
+
type ModelQueryHooks<Schema extends SchemaDef, Model extends GetModels<Schema>> = TrimDelegateModelOperations<Schema, Model, {
|
|
44
|
+
useFindUnique<T extends FindUniqueArgs<Schema, Model>>(args: SelectSubset<T, FindUniqueArgs<Schema, Model>>, options?: ModelQueryOptions<ModelResult<Schema, Model, T> | null>): ModelQueryResult<ModelResult<Schema, Model, T> | null>;
|
|
45
|
+
useFindFirst<T extends FindArgs<Schema, Model, false>>(args?: SelectSubset<T, FindArgs<Schema, Model, false>>, options?: ModelQueryOptions<ModelResult<Schema, Model, T> | null>): ModelQueryResult<ModelResult<Schema, Model, T> | null>;
|
|
46
|
+
useFindMany<T extends FindArgs<Schema, Model, true>>(args?: SelectSubset<T, FindArgs<Schema, Model, true>>, options?: ModelQueryOptions<ModelResult<Schema, Model, T>[]>): ModelQueryResult<ModelResult<Schema, Model, T>[]>;
|
|
47
|
+
useInfiniteFindMany<T extends FindArgs<Schema, Model, true>>(args?: SelectSubset<T, FindArgs<Schema, Model, true>>, options?: ModelInfiniteQueryOptions<ModelResult<Schema, Model, T>[]>): ModelInfiniteQueryResult<InfiniteData<ModelResult<Schema, Model, T>[]>>;
|
|
48
|
+
useCreate<T extends CreateArgs<Schema, Model>>(options?: ModelMutationOptions<ModelResult<Schema, Model, T>, T>): ModelMutationModelResult<Schema, Model, T>;
|
|
49
|
+
useCreateMany<T extends CreateManyArgs<Schema, Model>>(options?: ModelMutationOptions<BatchResult, T>): ModelMutationResult<BatchResult, T>;
|
|
50
|
+
useCreateManyAndReturn<T extends CreateManyAndReturnArgs<Schema, Model>>(options?: ModelMutationOptions<ModelResult<Schema, Model, T>[], T>): ModelMutationModelResult<Schema, Model, T, true>;
|
|
51
|
+
useUpdate<T extends UpdateArgs<Schema, Model>>(options?: ModelMutationOptions<ModelResult<Schema, Model, T>, T>): ModelMutationModelResult<Schema, Model, T>;
|
|
52
|
+
useUpdateMany<T extends UpdateManyArgs<Schema, Model>>(options?: ModelMutationOptions<BatchResult, T>): ModelMutationResult<BatchResult, T>;
|
|
53
|
+
useUpdateManyAndReturn<T extends UpdateManyAndReturnArgs<Schema, Model>>(options?: ModelMutationOptions<ModelResult<Schema, Model, T>[], T>): ModelMutationModelResult<Schema, Model, T, true>;
|
|
54
|
+
useUpsert<T extends UpsertArgs<Schema, Model>>(options?: ModelMutationOptions<ModelResult<Schema, Model, T>, T>): ModelMutationModelResult<Schema, Model, T>;
|
|
55
|
+
useDelete<T extends DeleteArgs<Schema, Model>>(options?: ModelMutationOptions<ModelResult<Schema, Model, T>, T>): ModelMutationModelResult<Schema, Model, T>;
|
|
56
|
+
useDeleteMany<T extends DeleteManyArgs<Schema, Model>>(options?: ModelMutationOptions<BatchResult, T>): ModelMutationResult<BatchResult, T>;
|
|
57
|
+
useCount<T extends CountArgs<Schema, Model>>(args?: Subset<T, CountArgs<Schema, Model>>, options?: ModelQueryOptions<CountResult<Schema, Model, T>>): ModelQueryResult<CountResult<Schema, Model, T>>;
|
|
58
|
+
useAggregate<T extends AggregateArgs<Schema, Model>>(args: Subset<T, AggregateArgs<Schema, Model>>, options?: ModelQueryOptions<AggregateResult<Schema, Model, T>>): ModelQueryResult<AggregateResult<Schema, Model, T>>;
|
|
59
|
+
useGroupBy<T extends GroupByArgs<Schema, Model>>(args: Subset<T, GroupByArgs<Schema, Model>>, options?: ModelQueryOptions<GroupByResult<Schema, Model, T>>): ModelQueryResult<GroupByResult<Schema, Model, T>>;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Gets data query hooks for all models in the schema.
|
|
63
|
+
*/
|
|
64
|
+
declare function useClientQueries<Schema extends SchemaDef>(schema: Schema): ClientHooks<Schema>;
|
|
65
|
+
/**
|
|
66
|
+
* Gets data query hooks for a specific model in the schema.
|
|
67
|
+
*/
|
|
68
|
+
declare function useModelQueries<Schema extends SchemaDef, Model extends GetModels<Schema>>(schema: Schema, model: Model): ModelQueryHooks<Schema, Model>;
|
|
69
|
+
declare function useInternalQuery<TQueryFnData, TData>(_schema: SchemaDef, model: string, operation: string, args?: StoreOrVal<unknown>, options?: StoreOrVal<Omit<CreateQueryOptions<TQueryFnData, DefaultError, TData>, 'queryKey'> & ExtraQueryOptions>): Readable<{
|
|
70
|
+
data: TData;
|
|
71
|
+
error: Error;
|
|
72
|
+
isError: true;
|
|
73
|
+
isPending: false;
|
|
74
|
+
isLoading: false;
|
|
75
|
+
isLoadingError: false;
|
|
76
|
+
isRefetchError: true;
|
|
77
|
+
isSuccess: false;
|
|
78
|
+
isPlaceholderData: false;
|
|
79
|
+
status: "error";
|
|
80
|
+
dataUpdatedAt: number;
|
|
81
|
+
errorUpdatedAt: number;
|
|
82
|
+
failureCount: number;
|
|
83
|
+
failureReason: Error | null;
|
|
84
|
+
errorUpdateCount: number;
|
|
85
|
+
isFetched: boolean;
|
|
86
|
+
isFetchedAfterMount: boolean;
|
|
87
|
+
isFetching: boolean;
|
|
88
|
+
isInitialLoading: boolean;
|
|
89
|
+
isPaused: boolean;
|
|
90
|
+
isRefetching: boolean;
|
|
91
|
+
isStale: boolean;
|
|
92
|
+
isEnabled: boolean;
|
|
93
|
+
refetch: (options?: _tanstack_svelte_query.RefetchOptions) => Promise<_tanstack_svelte_query.QueryObserverResult<TData, Error>>;
|
|
94
|
+
fetchStatus: _tanstack_svelte_query.FetchStatus;
|
|
95
|
+
promise: Promise<TData>;
|
|
96
|
+
queryKey: [string, string, string, unknown, {
|
|
97
|
+
infinite: boolean;
|
|
98
|
+
optimisticUpdate: boolean;
|
|
99
|
+
}];
|
|
100
|
+
} | {
|
|
101
|
+
data: TData;
|
|
102
|
+
error: null;
|
|
103
|
+
isError: false;
|
|
104
|
+
isPending: false;
|
|
105
|
+
isLoading: false;
|
|
106
|
+
isLoadingError: false;
|
|
107
|
+
isRefetchError: false;
|
|
108
|
+
isSuccess: true;
|
|
109
|
+
isPlaceholderData: false;
|
|
110
|
+
status: "success";
|
|
111
|
+
dataUpdatedAt: number;
|
|
112
|
+
errorUpdatedAt: number;
|
|
113
|
+
failureCount: number;
|
|
114
|
+
failureReason: Error | null;
|
|
115
|
+
errorUpdateCount: number;
|
|
116
|
+
isFetched: boolean;
|
|
117
|
+
isFetchedAfterMount: boolean;
|
|
118
|
+
isFetching: boolean;
|
|
119
|
+
isInitialLoading: boolean;
|
|
120
|
+
isPaused: boolean;
|
|
121
|
+
isRefetching: boolean;
|
|
122
|
+
isStale: boolean;
|
|
123
|
+
isEnabled: boolean;
|
|
124
|
+
refetch: (options?: _tanstack_svelte_query.RefetchOptions) => Promise<_tanstack_svelte_query.QueryObserverResult<TData, Error>>;
|
|
125
|
+
fetchStatus: _tanstack_svelte_query.FetchStatus;
|
|
126
|
+
promise: Promise<TData>;
|
|
127
|
+
queryKey: [string, string, string, unknown, {
|
|
128
|
+
infinite: boolean;
|
|
129
|
+
optimisticUpdate: boolean;
|
|
130
|
+
}];
|
|
131
|
+
}>;
|
|
132
|
+
declare function useInternalInfiniteQuery<TQueryFnData, TData>(_schema: SchemaDef, model: string, operation: string, args: StoreOrVal<unknown>, options: StoreOrVal<Omit<CreateInfiniteQueryOptions<TQueryFnData, DefaultError, InfiniteData<TData>>, 'queryKey' | 'initialPageParam'>> | undefined): Readable<{
|
|
133
|
+
data: InfiniteData<TData, unknown>;
|
|
134
|
+
error: Error;
|
|
135
|
+
isError: true;
|
|
136
|
+
isPending: false;
|
|
137
|
+
isLoading: false;
|
|
138
|
+
isLoadingError: false;
|
|
139
|
+
isRefetchError: true;
|
|
140
|
+
isSuccess: false;
|
|
141
|
+
isPlaceholderData: false;
|
|
142
|
+
status: "error";
|
|
143
|
+
fetchNextPage: (options?: _tanstack_svelte_query.FetchNextPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
144
|
+
fetchPreviousPage: (options?: _tanstack_svelte_query.FetchPreviousPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
145
|
+
hasNextPage: boolean;
|
|
146
|
+
hasPreviousPage: boolean;
|
|
147
|
+
isFetchNextPageError: boolean;
|
|
148
|
+
isFetchingNextPage: boolean;
|
|
149
|
+
isFetchPreviousPageError: boolean;
|
|
150
|
+
isFetchingPreviousPage: boolean;
|
|
151
|
+
dataUpdatedAt: number;
|
|
152
|
+
errorUpdatedAt: number;
|
|
153
|
+
failureCount: number;
|
|
154
|
+
failureReason: Error | null;
|
|
155
|
+
errorUpdateCount: number;
|
|
156
|
+
isFetched: boolean;
|
|
157
|
+
isFetchedAfterMount: boolean;
|
|
158
|
+
isFetching: boolean;
|
|
159
|
+
isInitialLoading: boolean;
|
|
160
|
+
isPaused: boolean;
|
|
161
|
+
isRefetching: boolean;
|
|
162
|
+
isStale: boolean;
|
|
163
|
+
isEnabled: boolean;
|
|
164
|
+
refetch: (options?: _tanstack_svelte_query.RefetchOptions) => Promise<_tanstack_svelte_query.QueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
165
|
+
fetchStatus: _tanstack_svelte_query.FetchStatus;
|
|
166
|
+
promise: Promise<InfiniteData<TData, unknown>>;
|
|
167
|
+
queryKey: [string, string, string, unknown, {
|
|
168
|
+
infinite: boolean;
|
|
169
|
+
optimisticUpdate: boolean;
|
|
170
|
+
}];
|
|
171
|
+
} | {
|
|
172
|
+
data: InfiniteData<TData, unknown>;
|
|
173
|
+
error: null;
|
|
174
|
+
isError: false;
|
|
175
|
+
isPending: false;
|
|
176
|
+
isLoading: false;
|
|
177
|
+
isLoadingError: false;
|
|
178
|
+
isRefetchError: false;
|
|
179
|
+
isFetchNextPageError: false;
|
|
180
|
+
isFetchPreviousPageError: false;
|
|
181
|
+
isSuccess: true;
|
|
182
|
+
isPlaceholderData: false;
|
|
183
|
+
status: "success";
|
|
184
|
+
fetchNextPage: (options?: _tanstack_svelte_query.FetchNextPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
185
|
+
fetchPreviousPage: (options?: _tanstack_svelte_query.FetchPreviousPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
186
|
+
hasNextPage: boolean;
|
|
187
|
+
hasPreviousPage: boolean;
|
|
188
|
+
isFetchingNextPage: boolean;
|
|
189
|
+
isFetchingPreviousPage: boolean;
|
|
190
|
+
dataUpdatedAt: number;
|
|
191
|
+
errorUpdatedAt: number;
|
|
192
|
+
failureCount: number;
|
|
193
|
+
failureReason: Error | null;
|
|
194
|
+
errorUpdateCount: number;
|
|
195
|
+
isFetched: boolean;
|
|
196
|
+
isFetchedAfterMount: boolean;
|
|
197
|
+
isFetching: boolean;
|
|
198
|
+
isInitialLoading: boolean;
|
|
199
|
+
isPaused: boolean;
|
|
200
|
+
isRefetching: boolean;
|
|
201
|
+
isStale: boolean;
|
|
202
|
+
isEnabled: boolean;
|
|
203
|
+
refetch: (options?: _tanstack_svelte_query.RefetchOptions) => Promise<_tanstack_svelte_query.QueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
204
|
+
fetchStatus: _tanstack_svelte_query.FetchStatus;
|
|
205
|
+
promise: Promise<InfiniteData<TData, unknown>>;
|
|
206
|
+
queryKey: [string, string, string, unknown, {
|
|
207
|
+
infinite: boolean;
|
|
208
|
+
optimisticUpdate: boolean;
|
|
209
|
+
}];
|
|
210
|
+
} | {
|
|
211
|
+
data: undefined;
|
|
212
|
+
error: Error;
|
|
213
|
+
isError: true;
|
|
214
|
+
isPending: false;
|
|
215
|
+
isLoading: false;
|
|
216
|
+
isLoadingError: true;
|
|
217
|
+
isRefetchError: false;
|
|
218
|
+
isFetchNextPageError: false;
|
|
219
|
+
isFetchPreviousPageError: false;
|
|
220
|
+
isSuccess: false;
|
|
221
|
+
isPlaceholderData: false;
|
|
222
|
+
status: "error";
|
|
223
|
+
fetchNextPage: (options?: _tanstack_svelte_query.FetchNextPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
224
|
+
fetchPreviousPage: (options?: _tanstack_svelte_query.FetchPreviousPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
225
|
+
hasNextPage: boolean;
|
|
226
|
+
hasPreviousPage: boolean;
|
|
227
|
+
isFetchingNextPage: boolean;
|
|
228
|
+
isFetchingPreviousPage: boolean;
|
|
229
|
+
dataUpdatedAt: number;
|
|
230
|
+
errorUpdatedAt: number;
|
|
231
|
+
failureCount: number;
|
|
232
|
+
failureReason: Error | null;
|
|
233
|
+
errorUpdateCount: number;
|
|
234
|
+
isFetched: boolean;
|
|
235
|
+
isFetchedAfterMount: boolean;
|
|
236
|
+
isFetching: boolean;
|
|
237
|
+
isInitialLoading: boolean;
|
|
238
|
+
isPaused: boolean;
|
|
239
|
+
isRefetching: boolean;
|
|
240
|
+
isStale: boolean;
|
|
241
|
+
isEnabled: boolean;
|
|
242
|
+
refetch: (options?: _tanstack_svelte_query.RefetchOptions) => Promise<_tanstack_svelte_query.QueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
243
|
+
fetchStatus: _tanstack_svelte_query.FetchStatus;
|
|
244
|
+
promise: Promise<InfiniteData<TData, unknown>>;
|
|
245
|
+
queryKey: [string, string, string, unknown, {
|
|
246
|
+
infinite: boolean;
|
|
247
|
+
optimisticUpdate: boolean;
|
|
248
|
+
}];
|
|
249
|
+
} | {
|
|
250
|
+
data: undefined;
|
|
251
|
+
error: null;
|
|
252
|
+
isError: false;
|
|
253
|
+
isPending: true;
|
|
254
|
+
isLoading: true;
|
|
255
|
+
isLoadingError: false;
|
|
256
|
+
isRefetchError: false;
|
|
257
|
+
isFetchNextPageError: false;
|
|
258
|
+
isFetchPreviousPageError: false;
|
|
259
|
+
isSuccess: false;
|
|
260
|
+
isPlaceholderData: false;
|
|
261
|
+
status: "pending";
|
|
262
|
+
fetchNextPage: (options?: _tanstack_svelte_query.FetchNextPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
263
|
+
fetchPreviousPage: (options?: _tanstack_svelte_query.FetchPreviousPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
264
|
+
hasNextPage: boolean;
|
|
265
|
+
hasPreviousPage: boolean;
|
|
266
|
+
isFetchingNextPage: boolean;
|
|
267
|
+
isFetchingPreviousPage: boolean;
|
|
268
|
+
dataUpdatedAt: number;
|
|
269
|
+
errorUpdatedAt: number;
|
|
270
|
+
failureCount: number;
|
|
271
|
+
failureReason: Error | null;
|
|
272
|
+
errorUpdateCount: number;
|
|
273
|
+
isFetched: boolean;
|
|
274
|
+
isFetchedAfterMount: boolean;
|
|
275
|
+
isFetching: boolean;
|
|
276
|
+
isInitialLoading: boolean;
|
|
277
|
+
isPaused: boolean;
|
|
278
|
+
isRefetching: boolean;
|
|
279
|
+
isStale: boolean;
|
|
280
|
+
isEnabled: boolean;
|
|
281
|
+
refetch: (options?: _tanstack_svelte_query.RefetchOptions) => Promise<_tanstack_svelte_query.QueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
282
|
+
fetchStatus: _tanstack_svelte_query.FetchStatus;
|
|
283
|
+
promise: Promise<InfiniteData<TData, unknown>>;
|
|
284
|
+
queryKey: [string, string, string, unknown, {
|
|
285
|
+
infinite: boolean;
|
|
286
|
+
optimisticUpdate: boolean;
|
|
287
|
+
}];
|
|
288
|
+
} | {
|
|
289
|
+
data: undefined;
|
|
290
|
+
error: null;
|
|
291
|
+
isError: false;
|
|
292
|
+
isPending: true;
|
|
293
|
+
isLoadingError: false;
|
|
294
|
+
isRefetchError: false;
|
|
295
|
+
isFetchNextPageError: false;
|
|
296
|
+
isFetchPreviousPageError: false;
|
|
297
|
+
isSuccess: false;
|
|
298
|
+
isPlaceholderData: false;
|
|
299
|
+
status: "pending";
|
|
300
|
+
fetchNextPage: (options?: _tanstack_svelte_query.FetchNextPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
301
|
+
fetchPreviousPage: (options?: _tanstack_svelte_query.FetchPreviousPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
302
|
+
hasNextPage: boolean;
|
|
303
|
+
hasPreviousPage: boolean;
|
|
304
|
+
isFetchingNextPage: boolean;
|
|
305
|
+
isFetchingPreviousPage: boolean;
|
|
306
|
+
dataUpdatedAt: number;
|
|
307
|
+
errorUpdatedAt: number;
|
|
308
|
+
failureCount: number;
|
|
309
|
+
failureReason: Error | null;
|
|
310
|
+
errorUpdateCount: number;
|
|
311
|
+
isFetched: boolean;
|
|
312
|
+
isFetchedAfterMount: boolean;
|
|
313
|
+
isFetching: boolean;
|
|
314
|
+
isLoading: boolean;
|
|
315
|
+
isInitialLoading: boolean;
|
|
316
|
+
isPaused: boolean;
|
|
317
|
+
isRefetching: boolean;
|
|
318
|
+
isStale: boolean;
|
|
319
|
+
isEnabled: boolean;
|
|
320
|
+
refetch: (options?: _tanstack_svelte_query.RefetchOptions) => Promise<_tanstack_svelte_query.QueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
321
|
+
fetchStatus: _tanstack_svelte_query.FetchStatus;
|
|
322
|
+
promise: Promise<InfiniteData<TData, unknown>>;
|
|
323
|
+
queryKey: [string, string, string, unknown, {
|
|
324
|
+
infinite: boolean;
|
|
325
|
+
optimisticUpdate: boolean;
|
|
326
|
+
}];
|
|
327
|
+
} | {
|
|
328
|
+
data: InfiniteData<TData, unknown>;
|
|
329
|
+
isError: false;
|
|
330
|
+
error: null;
|
|
331
|
+
isPending: false;
|
|
332
|
+
isLoading: false;
|
|
333
|
+
isLoadingError: false;
|
|
334
|
+
isRefetchError: false;
|
|
335
|
+
isSuccess: true;
|
|
336
|
+
isPlaceholderData: true;
|
|
337
|
+
isFetchNextPageError: false;
|
|
338
|
+
isFetchPreviousPageError: false;
|
|
339
|
+
status: "success";
|
|
340
|
+
fetchNextPage: (options?: _tanstack_svelte_query.FetchNextPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
341
|
+
fetchPreviousPage: (options?: _tanstack_svelte_query.FetchPreviousPageOptions) => Promise<_tanstack_svelte_query.InfiniteQueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
342
|
+
hasNextPage: boolean;
|
|
343
|
+
hasPreviousPage: boolean;
|
|
344
|
+
isFetchingNextPage: boolean;
|
|
345
|
+
isFetchingPreviousPage: boolean;
|
|
346
|
+
dataUpdatedAt: number;
|
|
347
|
+
errorUpdatedAt: number;
|
|
348
|
+
failureCount: number;
|
|
349
|
+
failureReason: Error | null;
|
|
350
|
+
errorUpdateCount: number;
|
|
351
|
+
isFetched: boolean;
|
|
352
|
+
isFetchedAfterMount: boolean;
|
|
353
|
+
isFetching: boolean;
|
|
354
|
+
isInitialLoading: boolean;
|
|
355
|
+
isPaused: boolean;
|
|
356
|
+
isRefetching: boolean;
|
|
357
|
+
isStale: boolean;
|
|
358
|
+
isEnabled: boolean;
|
|
359
|
+
refetch: (options?: _tanstack_svelte_query.RefetchOptions) => Promise<_tanstack_svelte_query.QueryObserverResult<InfiniteData<TData, unknown>, Error>>;
|
|
360
|
+
fetchStatus: _tanstack_svelte_query.FetchStatus;
|
|
361
|
+
promise: Promise<InfiniteData<TData, unknown>>;
|
|
362
|
+
queryKey: [string, string, string, unknown, {
|
|
363
|
+
infinite: boolean;
|
|
364
|
+
optimisticUpdate: boolean;
|
|
365
|
+
}];
|
|
366
|
+
}>;
|
|
367
|
+
/**
|
|
368
|
+
* Creates a svelte-query mutation
|
|
369
|
+
*
|
|
370
|
+
* @private
|
|
371
|
+
*
|
|
372
|
+
* @param model The name of the model under mutation.
|
|
373
|
+
* @param method The HTTP method.
|
|
374
|
+
* @param operation The mutation operation (e.g. `create`).
|
|
375
|
+
* @param options The svelte-query options.
|
|
376
|
+
* @param checkReadBack Whether to check for read back errors and return undefined if found.
|
|
377
|
+
*/
|
|
378
|
+
declare function useInternalMutation<TArgs, R = any>(schema: SchemaDef, model: string, method: 'POST' | 'PUT' | 'DELETE', operation: string, options?: StoreOrVal<Omit<CreateMutationOptions<R, DefaultError, TArgs>, 'mutationFn'> & ExtraMutationOptions>): CreateMutationResult<R, Error, TArgs, unknown>;
|
|
379
|
+
type UnwrapStore<T> = T extends Readable<infer U> ? U : T;
|
|
380
|
+
|
|
381
|
+
export { type ClientHooks, DEFAULT_QUERY_ENDPOINT, type ModelInfiniteQueryOptions, type ModelInfiniteQueryResult, type ModelMutationModelResult, type ModelMutationOptions, type ModelMutationResult, type ModelQueryHooks, type ModelQueryOptions, type ModelQueryResult, SvelteQueryContextKey, setHooksContext, setQuerySettingsContext, useClientQueries, useInternalInfiniteQuery, useInternalMutation, useInternalQuery, useModelQueries };
|