@zenstackhq/tanstack-query 2.21.0 → 3.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.
Files changed (93) hide show
  1. package/.turbo/turbo-build.log +31 -0
  2. package/LICENSE +1 -1
  3. package/dist/react.cjs +1238 -0
  4. package/dist/react.cjs.map +1 -0
  5. package/dist/react.d.cts +696 -0
  6. package/dist/react.d.ts +696 -0
  7. package/dist/react.js +1195 -0
  8. package/dist/react.js.map +1 -0
  9. package/eslint.config.js +4 -0
  10. package/package.json +56 -109
  11. package/scripts/generate.ts +27 -0
  12. package/src/react.ts +531 -0
  13. package/src/utils/common.ts +457 -0
  14. package/src/utils/mutator.ts +441 -0
  15. package/src/utils/nested-read-visitor.ts +61 -0
  16. package/src/utils/nested-write-visitor.ts +359 -0
  17. package/src/utils/query-analysis.ts +116 -0
  18. package/src/utils/serialization.ts +39 -0
  19. package/src/utils/types.ts +19 -0
  20. package/test/react-query.test.tsx +1787 -0
  21. package/test/schemas/basic/input.ts +70 -0
  22. package/test/schemas/basic/models.ts +12 -0
  23. package/test/schemas/basic/schema-lite.ts +124 -0
  24. package/test/schemas/basic/schema.zmodel +25 -0
  25. package/tsconfig.json +7 -0
  26. package/tsconfig.test.json +8 -0
  27. package/tsup.config.ts +13 -0
  28. package/vitest.config.ts +11 -0
  29. package/README.md +0 -5
  30. package/generator.d.ts +0 -6
  31. package/generator.js +0 -578
  32. package/generator.js.map +0 -1
  33. package/index.d.ts +0 -4
  34. package/index.js +0 -22
  35. package/index.js.map +0 -1
  36. package/runtime/common-CXlL7vTW.d.mts +0 -121
  37. package/runtime/common-CXlL7vTW.d.ts +0 -121
  38. package/runtime/index.d.mts +0 -20
  39. package/runtime/index.d.ts +0 -20
  40. package/runtime/index.js +0 -44
  41. package/runtime/index.js.map +0 -1
  42. package/runtime/index.mjs +0 -21
  43. package/runtime/index.mjs.map +0 -1
  44. package/runtime/react.d.mts +0 -322
  45. package/runtime/react.d.ts +0 -322
  46. package/runtime/react.js +0 -408
  47. package/runtime/react.js.map +0 -1
  48. package/runtime/react.mjs +0 -380
  49. package/runtime/react.mjs.map +0 -1
  50. package/runtime/svelte.d.mts +0 -322
  51. package/runtime/svelte.d.ts +0 -322
  52. package/runtime/svelte.js +0 -407
  53. package/runtime/svelte.js.map +0 -1
  54. package/runtime/svelte.mjs +0 -379
  55. package/runtime/svelte.mjs.map +0 -1
  56. package/runtime/vue.d.mts +0 -330
  57. package/runtime/vue.d.ts +0 -330
  58. package/runtime/vue.js +0 -418
  59. package/runtime/vue.js.map +0 -1
  60. package/runtime/vue.mjs +0 -390
  61. package/runtime/vue.mjs.map +0 -1
  62. package/runtime-v5/angular.d.mts +0 -59
  63. package/runtime-v5/angular.d.ts +0 -59
  64. package/runtime-v5/angular.js +0 -425
  65. package/runtime-v5/angular.js.map +0 -1
  66. package/runtime-v5/angular.mjs +0 -397
  67. package/runtime-v5/angular.mjs.map +0 -1
  68. package/runtime-v5/common-CXlL7vTW.d.mts +0 -121
  69. package/runtime-v5/common-CXlL7vTW.d.ts +0 -121
  70. package/runtime-v5/index.d.mts +0 -20
  71. package/runtime-v5/index.d.ts +0 -20
  72. package/runtime-v5/index.js +0 -44
  73. package/runtime-v5/index.js.map +0 -1
  74. package/runtime-v5/index.mjs +0 -21
  75. package/runtime-v5/index.mjs.map +0 -1
  76. package/runtime-v5/react.d.mts +0 -474
  77. package/runtime-v5/react.d.ts +0 -474
  78. package/runtime-v5/react.js +0 -440
  79. package/runtime-v5/react.js.map +0 -1
  80. package/runtime-v5/react.mjs +0 -412
  81. package/runtime-v5/react.mjs.map +0 -1
  82. package/runtime-v5/svelte.d.mts +0 -386
  83. package/runtime-v5/svelte.d.ts +0 -386
  84. package/runtime-v5/svelte.js +0 -436
  85. package/runtime-v5/svelte.js.map +0 -1
  86. package/runtime-v5/svelte.mjs +0 -408
  87. package/runtime-v5/svelte.mjs.map +0 -1
  88. package/runtime-v5/vue.d.mts +0 -330
  89. package/runtime-v5/vue.d.ts +0 -330
  90. package/runtime-v5/vue.js +0 -420
  91. package/runtime-v5/vue.js.map +0 -1
  92. package/runtime-v5/vue.mjs +0 -392
  93. package/runtime-v5/vue.mjs.map +0 -1
@@ -1,322 +0,0 @@
1
- import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { UseQueryOptions, UseInfiniteQueryOptions, UseMutationOptions } from '@tanstack/react-query';
3
- import * as react from 'react';
4
- import { ModelMeta } from '@zenstackhq/runtime/cross';
5
- import { A as APIContext, F as FetchFn, a as ExtraQueryOptions, E as ExtraMutationOptions } from './common-CXlL7vTW.mjs';
6
-
7
- /**
8
- * Context for configuring react hooks.
9
- */
10
- declare const RequestHandlerContext: react.Context<APIContext>;
11
- /**
12
- * Context provider.
13
- */
14
- declare const Provider: react.Provider<APIContext>;
15
- /**
16
- * Hooks context.
17
- */
18
- declare function getHooksContext(): {
19
- fetch?: FetchFn;
20
- logging?: boolean;
21
- endpoint: string;
22
- };
23
- /**
24
- * Creates a react-query query.
25
- *
26
- * @param model The name of the model under query.
27
- * @param url The request URL.
28
- * @param args The request args object, URL-encoded and appended as "?q=" parameter
29
- * @param options The react-query options object
30
- * @param fetch The fetch function to use for sending the HTTP request
31
- * @returns useQuery hook
32
- */
33
- declare function useModelQuery<TQueryFnData, TData, TError>(model: string, url: string, args?: unknown, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData>, 'queryKey'> & ExtraQueryOptions, fetch?: FetchFn): {
34
- data: TData;
35
- error: TError;
36
- isError: true;
37
- isLoading: false;
38
- isLoadingError: false;
39
- isRefetchError: true;
40
- isSuccess: false;
41
- status: "error";
42
- dataUpdatedAt: number;
43
- errorUpdatedAt: number;
44
- failureCount: number;
45
- failureReason: TError | null;
46
- errorUpdateCount: number;
47
- isFetched: boolean;
48
- isFetchedAfterMount: boolean;
49
- isFetching: boolean;
50
- isInitialLoading: boolean;
51
- isPaused: boolean;
52
- isPlaceholderData: boolean;
53
- isPreviousData: boolean;
54
- isRefetching: boolean;
55
- isStale: boolean;
56
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<TData, TError>>;
57
- remove: () => void;
58
- fetchStatus: _tanstack_react_query.FetchStatus;
59
- queryKey: [string, string, string, unknown, {
60
- infinite: boolean;
61
- optimisticUpdate: boolean;
62
- }];
63
- } | {
64
- data: TData;
65
- error: null;
66
- isError: false;
67
- isLoading: false;
68
- isLoadingError: false;
69
- isRefetchError: false;
70
- isSuccess: true;
71
- status: "success";
72
- dataUpdatedAt: number;
73
- errorUpdatedAt: number;
74
- failureCount: number;
75
- failureReason: TError | null;
76
- errorUpdateCount: number;
77
- isFetched: boolean;
78
- isFetchedAfterMount: boolean;
79
- isFetching: boolean;
80
- isInitialLoading: boolean;
81
- isPaused: boolean;
82
- isPlaceholderData: boolean;
83
- isPreviousData: boolean;
84
- isRefetching: boolean;
85
- isStale: boolean;
86
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<TData, TError>>;
87
- remove: () => void;
88
- fetchStatus: _tanstack_react_query.FetchStatus;
89
- queryKey: [string, string, string, unknown, {
90
- infinite: boolean;
91
- optimisticUpdate: boolean;
92
- }];
93
- } | {
94
- data: undefined;
95
- error: TError;
96
- isError: true;
97
- isLoading: false;
98
- isLoadingError: true;
99
- isRefetchError: false;
100
- isSuccess: false;
101
- status: "error";
102
- dataUpdatedAt: number;
103
- errorUpdatedAt: number;
104
- failureCount: number;
105
- failureReason: TError | null;
106
- errorUpdateCount: number;
107
- isFetched: boolean;
108
- isFetchedAfterMount: boolean;
109
- isFetching: boolean;
110
- isInitialLoading: boolean;
111
- isPaused: boolean;
112
- isPlaceholderData: boolean;
113
- isPreviousData: boolean;
114
- isRefetching: boolean;
115
- isStale: boolean;
116
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<TData, TError>>;
117
- remove: () => void;
118
- fetchStatus: _tanstack_react_query.FetchStatus;
119
- queryKey: [string, string, string, unknown, {
120
- infinite: boolean;
121
- optimisticUpdate: boolean;
122
- }];
123
- } | {
124
- data: undefined;
125
- error: null;
126
- isError: false;
127
- isLoading: true;
128
- isLoadingError: false;
129
- isRefetchError: false;
130
- isSuccess: false;
131
- status: "loading";
132
- dataUpdatedAt: number;
133
- errorUpdatedAt: number;
134
- failureCount: number;
135
- failureReason: TError | null;
136
- errorUpdateCount: number;
137
- isFetched: boolean;
138
- isFetchedAfterMount: boolean;
139
- isFetching: boolean;
140
- isInitialLoading: boolean;
141
- isPaused: boolean;
142
- isPlaceholderData: boolean;
143
- isPreviousData: boolean;
144
- isRefetching: boolean;
145
- isStale: boolean;
146
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<TData, TError>>;
147
- remove: () => void;
148
- fetchStatus: _tanstack_react_query.FetchStatus;
149
- queryKey: [string, string, string, unknown, {
150
- infinite: boolean;
151
- optimisticUpdate: boolean;
152
- }];
153
- };
154
- /**
155
- * Creates a react-query infinite query.
156
- *
157
- * @param model The name of the model under query.
158
- * @param url The request URL.
159
- * @param args The initial request args object, URL-encoded and appended as "?q=" parameter
160
- * @param options The react-query infinite query options object
161
- * @param fetch The fetch function to use for sending the HTTP request
162
- * @returns useInfiniteQuery hook
163
- */
164
- declare function useInfiniteModelQuery<TQueryFnData, TData, TError>(model: string, url: string, args?: unknown, options?: Omit<UseInfiniteQueryOptions<TQueryFnData, TError, TData>, 'queryKey'>, fetch?: FetchFn): {
165
- data: undefined;
166
- error: TError;
167
- isError: true;
168
- isLoading: false;
169
- isLoadingError: true;
170
- isRefetchError: false;
171
- isSuccess: false;
172
- status: "error";
173
- fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
174
- fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
175
- hasNextPage?: boolean;
176
- hasPreviousPage?: boolean;
177
- isFetchingNextPage: boolean;
178
- isFetchingPreviousPage: boolean;
179
- dataUpdatedAt: number;
180
- errorUpdatedAt: number;
181
- failureCount: number;
182
- failureReason: TError | null;
183
- errorUpdateCount: number;
184
- isFetched: boolean;
185
- isFetchedAfterMount: boolean;
186
- isFetching: boolean;
187
- isInitialLoading: boolean;
188
- isPaused: boolean;
189
- isPlaceholderData: boolean;
190
- isPreviousData: boolean;
191
- isRefetching: boolean;
192
- isStale: boolean;
193
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<TData>, TError>>;
194
- remove: () => void;
195
- fetchStatus: _tanstack_react_query.FetchStatus;
196
- queryKey: [string, string, string, unknown, {
197
- infinite: boolean;
198
- optimisticUpdate: boolean;
199
- }];
200
- } | {
201
- data: undefined;
202
- error: null;
203
- isError: false;
204
- isLoading: true;
205
- isLoadingError: false;
206
- isRefetchError: false;
207
- isSuccess: false;
208
- status: "loading";
209
- fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
210
- fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
211
- hasNextPage?: boolean;
212
- hasPreviousPage?: boolean;
213
- isFetchingNextPage: boolean;
214
- isFetchingPreviousPage: boolean;
215
- dataUpdatedAt: number;
216
- errorUpdatedAt: number;
217
- failureCount: number;
218
- failureReason: TError | null;
219
- errorUpdateCount: number;
220
- isFetched: boolean;
221
- isFetchedAfterMount: boolean;
222
- isFetching: boolean;
223
- isInitialLoading: boolean;
224
- isPaused: boolean;
225
- isPlaceholderData: boolean;
226
- isPreviousData: boolean;
227
- isRefetching: boolean;
228
- isStale: boolean;
229
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<TData>, TError>>;
230
- remove: () => void;
231
- fetchStatus: _tanstack_react_query.FetchStatus;
232
- queryKey: [string, string, string, unknown, {
233
- infinite: boolean;
234
- optimisticUpdate: boolean;
235
- }];
236
- } | {
237
- data: _tanstack_react_query.InfiniteData<TData>;
238
- error: TError;
239
- isError: true;
240
- isLoading: false;
241
- isLoadingError: false;
242
- isRefetchError: true;
243
- isSuccess: false;
244
- status: "error";
245
- fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
246
- fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
247
- hasNextPage?: boolean;
248
- hasPreviousPage?: boolean;
249
- isFetchingNextPage: boolean;
250
- isFetchingPreviousPage: boolean;
251
- dataUpdatedAt: number;
252
- errorUpdatedAt: number;
253
- failureCount: number;
254
- failureReason: TError | null;
255
- errorUpdateCount: number;
256
- isFetched: boolean;
257
- isFetchedAfterMount: boolean;
258
- isFetching: boolean;
259
- isInitialLoading: boolean;
260
- isPaused: boolean;
261
- isPlaceholderData: boolean;
262
- isPreviousData: boolean;
263
- isRefetching: boolean;
264
- isStale: boolean;
265
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<TData>, TError>>;
266
- remove: () => void;
267
- fetchStatus: _tanstack_react_query.FetchStatus;
268
- queryKey: [string, string, string, unknown, {
269
- infinite: boolean;
270
- optimisticUpdate: boolean;
271
- }];
272
- } | {
273
- data: _tanstack_react_query.InfiniteData<TData>;
274
- error: null;
275
- isError: false;
276
- isLoading: false;
277
- isLoadingError: false;
278
- isRefetchError: false;
279
- isSuccess: true;
280
- status: "success";
281
- fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
282
- fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
283
- hasNextPage?: boolean;
284
- hasPreviousPage?: boolean;
285
- isFetchingNextPage: boolean;
286
- isFetchingPreviousPage: boolean;
287
- dataUpdatedAt: number;
288
- errorUpdatedAt: number;
289
- failureCount: number;
290
- failureReason: TError | null;
291
- errorUpdateCount: number;
292
- isFetched: boolean;
293
- isFetchedAfterMount: boolean;
294
- isFetching: boolean;
295
- isInitialLoading: boolean;
296
- isPaused: boolean;
297
- isPlaceholderData: boolean;
298
- isPreviousData: boolean;
299
- isRefetching: boolean;
300
- isStale: boolean;
301
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<TData>, TError>>;
302
- remove: () => void;
303
- fetchStatus: _tanstack_react_query.FetchStatus;
304
- queryKey: [string, string, string, unknown, {
305
- infinite: boolean;
306
- optimisticUpdate: boolean;
307
- }];
308
- };
309
- /**
310
- * Creates a mutation with react-query.
311
- *
312
- * @param model The name of the model under mutation.
313
- * @param method The HTTP method.
314
- * @param modelMeta The model metadata.
315
- * @param url The request URL.
316
- * @param options The react-query options.
317
- * @param checkReadBack Whether to check for read back errors and return undefined if found.
318
- * @returns useMutation hooks
319
- */
320
- declare function useModelMutation<TArgs, TError, R = any, C extends boolean = boolean, Result = C extends true ? R | undefined : R>(model: string, method: 'POST' | 'PUT' | 'DELETE', url: string, modelMeta: ModelMeta, options?: Omit<UseMutationOptions<Result, TError, TArgs>, 'mutationFn'> & ExtraMutationOptions, fetch?: FetchFn, checkReadBack?: C): _tanstack_react_query.UseMutationResult<Result, TError, TArgs, unknown>;
321
-
322
- export { Provider, RequestHandlerContext, getHooksContext, useInfiniteModelQuery, useModelMutation, useModelQuery };
@@ -1,322 +0,0 @@
1
- import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { UseQueryOptions, UseInfiniteQueryOptions, UseMutationOptions } from '@tanstack/react-query';
3
- import * as react from 'react';
4
- import { ModelMeta } from '@zenstackhq/runtime/cross';
5
- import { A as APIContext, F as FetchFn, a as ExtraQueryOptions, E as ExtraMutationOptions } from './common-CXlL7vTW.js';
6
-
7
- /**
8
- * Context for configuring react hooks.
9
- */
10
- declare const RequestHandlerContext: react.Context<APIContext>;
11
- /**
12
- * Context provider.
13
- */
14
- declare const Provider: react.Provider<APIContext>;
15
- /**
16
- * Hooks context.
17
- */
18
- declare function getHooksContext(): {
19
- fetch?: FetchFn;
20
- logging?: boolean;
21
- endpoint: string;
22
- };
23
- /**
24
- * Creates a react-query query.
25
- *
26
- * @param model The name of the model under query.
27
- * @param url The request URL.
28
- * @param args The request args object, URL-encoded and appended as "?q=" parameter
29
- * @param options The react-query options object
30
- * @param fetch The fetch function to use for sending the HTTP request
31
- * @returns useQuery hook
32
- */
33
- declare function useModelQuery<TQueryFnData, TData, TError>(model: string, url: string, args?: unknown, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData>, 'queryKey'> & ExtraQueryOptions, fetch?: FetchFn): {
34
- data: TData;
35
- error: TError;
36
- isError: true;
37
- isLoading: false;
38
- isLoadingError: false;
39
- isRefetchError: true;
40
- isSuccess: false;
41
- status: "error";
42
- dataUpdatedAt: number;
43
- errorUpdatedAt: number;
44
- failureCount: number;
45
- failureReason: TError | null;
46
- errorUpdateCount: number;
47
- isFetched: boolean;
48
- isFetchedAfterMount: boolean;
49
- isFetching: boolean;
50
- isInitialLoading: boolean;
51
- isPaused: boolean;
52
- isPlaceholderData: boolean;
53
- isPreviousData: boolean;
54
- isRefetching: boolean;
55
- isStale: boolean;
56
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<TData, TError>>;
57
- remove: () => void;
58
- fetchStatus: _tanstack_react_query.FetchStatus;
59
- queryKey: [string, string, string, unknown, {
60
- infinite: boolean;
61
- optimisticUpdate: boolean;
62
- }];
63
- } | {
64
- data: TData;
65
- error: null;
66
- isError: false;
67
- isLoading: false;
68
- isLoadingError: false;
69
- isRefetchError: false;
70
- isSuccess: true;
71
- status: "success";
72
- dataUpdatedAt: number;
73
- errorUpdatedAt: number;
74
- failureCount: number;
75
- failureReason: TError | null;
76
- errorUpdateCount: number;
77
- isFetched: boolean;
78
- isFetchedAfterMount: boolean;
79
- isFetching: boolean;
80
- isInitialLoading: boolean;
81
- isPaused: boolean;
82
- isPlaceholderData: boolean;
83
- isPreviousData: boolean;
84
- isRefetching: boolean;
85
- isStale: boolean;
86
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<TData, TError>>;
87
- remove: () => void;
88
- fetchStatus: _tanstack_react_query.FetchStatus;
89
- queryKey: [string, string, string, unknown, {
90
- infinite: boolean;
91
- optimisticUpdate: boolean;
92
- }];
93
- } | {
94
- data: undefined;
95
- error: TError;
96
- isError: true;
97
- isLoading: false;
98
- isLoadingError: true;
99
- isRefetchError: false;
100
- isSuccess: false;
101
- status: "error";
102
- dataUpdatedAt: number;
103
- errorUpdatedAt: number;
104
- failureCount: number;
105
- failureReason: TError | null;
106
- errorUpdateCount: number;
107
- isFetched: boolean;
108
- isFetchedAfterMount: boolean;
109
- isFetching: boolean;
110
- isInitialLoading: boolean;
111
- isPaused: boolean;
112
- isPlaceholderData: boolean;
113
- isPreviousData: boolean;
114
- isRefetching: boolean;
115
- isStale: boolean;
116
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<TData, TError>>;
117
- remove: () => void;
118
- fetchStatus: _tanstack_react_query.FetchStatus;
119
- queryKey: [string, string, string, unknown, {
120
- infinite: boolean;
121
- optimisticUpdate: boolean;
122
- }];
123
- } | {
124
- data: undefined;
125
- error: null;
126
- isError: false;
127
- isLoading: true;
128
- isLoadingError: false;
129
- isRefetchError: false;
130
- isSuccess: false;
131
- status: "loading";
132
- dataUpdatedAt: number;
133
- errorUpdatedAt: number;
134
- failureCount: number;
135
- failureReason: TError | null;
136
- errorUpdateCount: number;
137
- isFetched: boolean;
138
- isFetchedAfterMount: boolean;
139
- isFetching: boolean;
140
- isInitialLoading: boolean;
141
- isPaused: boolean;
142
- isPlaceholderData: boolean;
143
- isPreviousData: boolean;
144
- isRefetching: boolean;
145
- isStale: boolean;
146
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<TData, TError>>;
147
- remove: () => void;
148
- fetchStatus: _tanstack_react_query.FetchStatus;
149
- queryKey: [string, string, string, unknown, {
150
- infinite: boolean;
151
- optimisticUpdate: boolean;
152
- }];
153
- };
154
- /**
155
- * Creates a react-query infinite query.
156
- *
157
- * @param model The name of the model under query.
158
- * @param url The request URL.
159
- * @param args The initial request args object, URL-encoded and appended as "?q=" parameter
160
- * @param options The react-query infinite query options object
161
- * @param fetch The fetch function to use for sending the HTTP request
162
- * @returns useInfiniteQuery hook
163
- */
164
- declare function useInfiniteModelQuery<TQueryFnData, TData, TError>(model: string, url: string, args?: unknown, options?: Omit<UseInfiniteQueryOptions<TQueryFnData, TError, TData>, 'queryKey'>, fetch?: FetchFn): {
165
- data: undefined;
166
- error: TError;
167
- isError: true;
168
- isLoading: false;
169
- isLoadingError: true;
170
- isRefetchError: false;
171
- isSuccess: false;
172
- status: "error";
173
- fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
174
- fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
175
- hasNextPage?: boolean;
176
- hasPreviousPage?: boolean;
177
- isFetchingNextPage: boolean;
178
- isFetchingPreviousPage: boolean;
179
- dataUpdatedAt: number;
180
- errorUpdatedAt: number;
181
- failureCount: number;
182
- failureReason: TError | null;
183
- errorUpdateCount: number;
184
- isFetched: boolean;
185
- isFetchedAfterMount: boolean;
186
- isFetching: boolean;
187
- isInitialLoading: boolean;
188
- isPaused: boolean;
189
- isPlaceholderData: boolean;
190
- isPreviousData: boolean;
191
- isRefetching: boolean;
192
- isStale: boolean;
193
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<TData>, TError>>;
194
- remove: () => void;
195
- fetchStatus: _tanstack_react_query.FetchStatus;
196
- queryKey: [string, string, string, unknown, {
197
- infinite: boolean;
198
- optimisticUpdate: boolean;
199
- }];
200
- } | {
201
- data: undefined;
202
- error: null;
203
- isError: false;
204
- isLoading: true;
205
- isLoadingError: false;
206
- isRefetchError: false;
207
- isSuccess: false;
208
- status: "loading";
209
- fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
210
- fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
211
- hasNextPage?: boolean;
212
- hasPreviousPage?: boolean;
213
- isFetchingNextPage: boolean;
214
- isFetchingPreviousPage: boolean;
215
- dataUpdatedAt: number;
216
- errorUpdatedAt: number;
217
- failureCount: number;
218
- failureReason: TError | null;
219
- errorUpdateCount: number;
220
- isFetched: boolean;
221
- isFetchedAfterMount: boolean;
222
- isFetching: boolean;
223
- isInitialLoading: boolean;
224
- isPaused: boolean;
225
- isPlaceholderData: boolean;
226
- isPreviousData: boolean;
227
- isRefetching: boolean;
228
- isStale: boolean;
229
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<TData>, TError>>;
230
- remove: () => void;
231
- fetchStatus: _tanstack_react_query.FetchStatus;
232
- queryKey: [string, string, string, unknown, {
233
- infinite: boolean;
234
- optimisticUpdate: boolean;
235
- }];
236
- } | {
237
- data: _tanstack_react_query.InfiniteData<TData>;
238
- error: TError;
239
- isError: true;
240
- isLoading: false;
241
- isLoadingError: false;
242
- isRefetchError: true;
243
- isSuccess: false;
244
- status: "error";
245
- fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
246
- fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
247
- hasNextPage?: boolean;
248
- hasPreviousPage?: boolean;
249
- isFetchingNextPage: boolean;
250
- isFetchingPreviousPage: boolean;
251
- dataUpdatedAt: number;
252
- errorUpdatedAt: number;
253
- failureCount: number;
254
- failureReason: TError | null;
255
- errorUpdateCount: number;
256
- isFetched: boolean;
257
- isFetchedAfterMount: boolean;
258
- isFetching: boolean;
259
- isInitialLoading: boolean;
260
- isPaused: boolean;
261
- isPlaceholderData: boolean;
262
- isPreviousData: boolean;
263
- isRefetching: boolean;
264
- isStale: boolean;
265
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<TData>, TError>>;
266
- remove: () => void;
267
- fetchStatus: _tanstack_react_query.FetchStatus;
268
- queryKey: [string, string, string, unknown, {
269
- infinite: boolean;
270
- optimisticUpdate: boolean;
271
- }];
272
- } | {
273
- data: _tanstack_react_query.InfiniteData<TData>;
274
- error: null;
275
- isError: false;
276
- isLoading: false;
277
- isLoadingError: false;
278
- isRefetchError: false;
279
- isSuccess: true;
280
- status: "success";
281
- fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
282
- fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<TData, TError>>;
283
- hasNextPage?: boolean;
284
- hasPreviousPage?: boolean;
285
- isFetchingNextPage: boolean;
286
- isFetchingPreviousPage: boolean;
287
- dataUpdatedAt: number;
288
- errorUpdatedAt: number;
289
- failureCount: number;
290
- failureReason: TError | null;
291
- errorUpdateCount: number;
292
- isFetched: boolean;
293
- isFetchedAfterMount: boolean;
294
- isFetching: boolean;
295
- isInitialLoading: boolean;
296
- isPaused: boolean;
297
- isPlaceholderData: boolean;
298
- isPreviousData: boolean;
299
- isRefetching: boolean;
300
- isStale: boolean;
301
- refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<TData>, TError>>;
302
- remove: () => void;
303
- fetchStatus: _tanstack_react_query.FetchStatus;
304
- queryKey: [string, string, string, unknown, {
305
- infinite: boolean;
306
- optimisticUpdate: boolean;
307
- }];
308
- };
309
- /**
310
- * Creates a mutation with react-query.
311
- *
312
- * @param model The name of the model under mutation.
313
- * @param method The HTTP method.
314
- * @param modelMeta The model metadata.
315
- * @param url The request URL.
316
- * @param options The react-query options.
317
- * @param checkReadBack Whether to check for read back errors and return undefined if found.
318
- * @returns useMutation hooks
319
- */
320
- declare function useModelMutation<TArgs, TError, R = any, C extends boolean = boolean, Result = C extends true ? R | undefined : R>(model: string, method: 'POST' | 'PUT' | 'DELETE', url: string, modelMeta: ModelMeta, options?: Omit<UseMutationOptions<Result, TError, TArgs>, 'mutationFn'> & ExtraMutationOptions, fetch?: FetchFn, checkReadBack?: C): _tanstack_react_query.UseMutationResult<Result, TError, TArgs, unknown>;
321
-
322
- export { Provider, RequestHandlerContext, getHooksContext, useInfiniteModelQuery, useModelMutation, useModelQuery };