@tanstack/angular-query-experimental 5.59.20 → 5.60.2
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/README.md +6 -6
- package/build/index.d.ts +680 -0
- package/build/index.js +616 -0
- package/build/index.js.map +1 -0
- package/package.json +13 -14
- package/src/create-base-query.ts +119 -0
- package/src/index.ts +28 -0
- package/src/infinite-query-options.ts +125 -0
- package/src/inject-infinite-query.ts +119 -0
- package/src/inject-is-fetching.ts +50 -0
- package/src/inject-is-mutating.ts +49 -0
- package/src/inject-mutation-state.ts +99 -0
- package/src/inject-mutation.ts +122 -0
- package/src/inject-queries.ts +243 -0
- package/src/inject-query-client.ts +27 -0
- package/src/inject-query.ts +207 -0
- package/src/providers.ts +344 -0
- package/src/query-options.ts +125 -0
- package/src/signal-proxy.ts +46 -0
- package/src/test-setup.ts +12 -0
- package/src/types.ts +328 -0
- package/src/util/assert-injector/assert-injector.test.ts +74 -0
- package/src/util/assert-injector/assert-injector.ts +81 -0
- package/src/util/create-injection-token/create-injection-token.test.ts +32 -0
- package/src/util/create-injection-token/create-injection-token.ts +183 -0
- package/src/util/index.ts +13 -0
- package/src/util/is-dev-mode/is-dev-mode.ts +3 -0
- package/src/util/lazy-init/lazy-init.ts +34 -0
- package/src/util/lazy-signal-initializer/lazy-signal-initializer.ts +23 -0
- package/build/README.md +0 -133
- package/build/esm2022/create-base-query.mjs +0 -62
- package/build/esm2022/index.mjs +0 -16
- package/build/esm2022/infinite-query-options.mjs +0 -12
- package/build/esm2022/inject-infinite-query.mjs +0 -15
- package/build/esm2022/inject-is-fetching.mjs +0 -38
- package/build/esm2022/inject-is-mutating.mjs +0 -37
- package/build/esm2022/inject-mutation-state.mjs +0 -47
- package/build/esm2022/inject-mutation.mjs +0 -51
- package/build/esm2022/inject-queries.mjs +0 -33
- package/build/esm2022/inject-query-client.mjs +0 -22
- package/build/esm2022/inject-query.mjs +0 -44
- package/build/esm2022/providers.mjs +0 -56
- package/build/esm2022/query-options.mjs +0 -26
- package/build/esm2022/signal-proxy.mjs +0 -38
- package/build/esm2022/tanstack-angular-query-experimental.mjs +0 -5
- package/build/esm2022/types.mjs +0 -3
- package/build/esm2022/util/assert-injector/assert-injector.mjs +0 -21
- package/build/esm2022/util/create-injection-token/create-injection-token.mjs +0 -61
- package/build/esm2022/util/index.mjs +0 -9
- package/build/esm2022/util/lazy-init/lazy-init.mjs +0 -31
- package/build/esm2022/util/lazy-signal-initializer/lazy-signal-initializer.mjs +0 -14
- package/build/fesm2022/tanstack-angular-query-experimental.mjs +0 -587
- package/build/fesm2022/tanstack-angular-query-experimental.mjs.map +0 -1
- package/build/rollup.d.ts +0 -605
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+
import { DefaultError, QueryKey, QueryObserverOptions, OmitKeyof, InfiniteQueryObserverOptions, QueryObserverResult, DefinedQueryObserverResult, InfiniteQueryObserverResult, DefinedInfiniteQueryObserverResult, MutationObserverOptions, MutateFunction, Override, MutationObserverResult, InitialDataFunction, DataTag, InfiniteData, QueryClient, QueryFilters, MutationFilters, MutationState, Mutation, QueriesPlaceholderDataFunction, QueryFunction, ThrowOnError } from '@tanstack/query-core';
|
|
2
|
+
export * from '@tanstack/query-core';
|
|
3
|
+
import * as _angular_core from '@angular/core';
|
|
4
|
+
import { Signal, Injector, EnvironmentProviders, Provider } from '@angular/core';
|
|
5
|
+
import { DevtoolsButtonPosition, DevtoolsPosition, DevtoolsErrorType } from '@tanstack/query-devtools';
|
|
6
|
+
|
|
7
|
+
type MapToSignals<T> = {
|
|
8
|
+
[K in keyof T]: T[K] extends Function ? T[K] : Signal<T[K]>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
interface CreateBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
interface CreateQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<CreateBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
type CreateStatusBasedQueryResult<TStatus extends QueryObserverResult['status'], TData = unknown, TError = DefaultError> = Extract<QueryObserverResult<TData, TError>, {
|
|
25
|
+
status: TStatus;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
interface BaseQueryNarrowing<TData = unknown, TError = DefaultError> {
|
|
31
|
+
isSuccess: (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'success', TData, TError>>;
|
|
32
|
+
isError: (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'error', TData, TError>>;
|
|
33
|
+
isPending: (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'pending', TData, TError>>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
interface CreateInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>, 'suspense'> {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
type CreateBaseQueryResult<TData = unknown, TError = DefaultError, TState = QueryObserverResult<TData, TError>> = BaseQueryNarrowing<TData, TError> & MapToSignals<OmitKeyof<TState, keyof BaseQueryNarrowing, 'safely'>>;
|
|
44
|
+
/**
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
type CreateQueryResult<TData = unknown, TError = DefaultError> = CreateBaseQueryResult<TData, TError>;
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
type DefinedCreateQueryResult<TData = unknown, TError = DefaultError, TDefinedQueryObserver = DefinedQueryObserverResult<TData, TError>> = MapToSignals<TDefinedQueryObserver>;
|
|
52
|
+
/**
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
type CreateInfiniteQueryResult<TData = unknown, TError = DefaultError> = MapToSignals<InfiniteQueryObserverResult<TData, TError>>;
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
type DefinedCreateInfiniteQueryResult<TData = unknown, TError = DefaultError, TDefinedInfiniteQueryObserver = DefinedInfiniteQueryObserverResult<TData, TError>> = MapToSignals<TDefinedInfiniteQueryObserver>;
|
|
60
|
+
/**
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
interface CreateMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TContext>, '_defaulted'> {
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
type CreateMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>) => void;
|
|
69
|
+
/**
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
type CreateMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MutateFunction<TData, TError, TVariables, TContext>;
|
|
73
|
+
/**
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
type CreateBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TContext>, {
|
|
77
|
+
mutate: CreateMutateFunction<TData, TError, TVariables, TContext>;
|
|
78
|
+
}> & {
|
|
79
|
+
mutateAsync: CreateMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
type CreateStatusBasedMutationResult<TStatus extends CreateBaseMutationResult['status'], TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = Extract<CreateBaseMutationResult<TData, TError, TVariables, TContext>, {
|
|
85
|
+
status: TStatus;
|
|
86
|
+
}>;
|
|
87
|
+
type SignalFunction<T extends () => any> = T & Signal<ReturnType<T>>;
|
|
88
|
+
/**
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
interface BaseMutationNarrowing<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> {
|
|
92
|
+
isSuccess: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TContext>) => this is CreateMutationResult<TData, TError, TVariables, TContext, CreateStatusBasedMutationResult<'success', TData, TError, TVariables, TContext>>>;
|
|
93
|
+
isError: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TContext>) => this is CreateMutationResult<TData, TError, TVariables, TContext, CreateStatusBasedMutationResult<'error', TData, TError, TVariables, TContext>>>;
|
|
94
|
+
isPending: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TContext>) => this is CreateMutationResult<TData, TError, TVariables, TContext, CreateStatusBasedMutationResult<'pending', TData, TError, TVariables, TContext>>>;
|
|
95
|
+
isIdle: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TContext>) => this is CreateMutationResult<TData, TError, TVariables, TContext, CreateStatusBasedMutationResult<'idle', TData, TError, TVariables, TContext>>>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
type CreateMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown, TState = CreateStatusBasedMutationResult<CreateBaseMutationResult['status'], TData, TError, TVariables, TContext>> = BaseMutationNarrowing<TData, TError, TVariables, TContext> & MapToSignals<OmitKeyof<TState, keyof BaseMutationNarrowing, 'safely'>>;
|
|
101
|
+
/**
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
type NonUndefinedGuard<T> = T extends undefined ? never : T;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
110
|
+
initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
116
|
+
initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Allows to share and re-use query options in a type-safe way.
|
|
120
|
+
*
|
|
121
|
+
* The `queryKey` will be tagged with the type from `queryFn`.
|
|
122
|
+
*
|
|
123
|
+
* **Example**
|
|
124
|
+
*
|
|
125
|
+
* ```ts
|
|
126
|
+
* const { queryKey } = queryOptions({
|
|
127
|
+
* queryKey: ['key'],
|
|
128
|
+
* queryFn: () => Promise.resolve(5),
|
|
129
|
+
* // ^? Promise<number>
|
|
130
|
+
* })
|
|
131
|
+
*
|
|
132
|
+
* const queryClient = new QueryClient()
|
|
133
|
+
* const data = queryClient.getQueryData(queryKey)
|
|
134
|
+
* // ^? number | undefined
|
|
135
|
+
* ```
|
|
136
|
+
* @param options - The query options to tag with the type from `queryFn`.
|
|
137
|
+
* @returns The tagged query options.
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
141
|
+
queryKey: DataTag<TQueryKey, TQueryFnData>;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Allows to share and re-use query options in a type-safe way.
|
|
145
|
+
*
|
|
146
|
+
* The `queryKey` will be tagged with the type from `queryFn`.
|
|
147
|
+
*
|
|
148
|
+
* **Example**
|
|
149
|
+
*
|
|
150
|
+
* ```ts
|
|
151
|
+
* const { queryKey } = queryOptions({
|
|
152
|
+
* queryKey: ['key'],
|
|
153
|
+
* queryFn: () => Promise.resolve(5),
|
|
154
|
+
* // ^? Promise<number>
|
|
155
|
+
* })
|
|
156
|
+
*
|
|
157
|
+
* const queryClient = new QueryClient()
|
|
158
|
+
* const data = queryClient.getQueryData(queryKey)
|
|
159
|
+
* // ^? number | undefined
|
|
160
|
+
* ```
|
|
161
|
+
* @param options - The query options to tag with the type from `queryFn`.
|
|
162
|
+
* @returns The tagged query options.
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
166
|
+
queryKey: DataTag<TQueryKey, TQueryFnData>;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam> & {
|
|
173
|
+
initialData?: undefined;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* @public
|
|
177
|
+
*/
|
|
178
|
+
type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam> & {
|
|
179
|
+
initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>);
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Allows to share and re-use infinite query options in a type-safe way.
|
|
183
|
+
*
|
|
184
|
+
* The `queryKey` will be tagged with the type from `queryFn`.
|
|
185
|
+
* @param options - The infinite query options to tag with the type from `queryFn`.
|
|
186
|
+
* @returns The tagged infinite query options.
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
|
|
190
|
+
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>>;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Allows to share and re-use infinite query options in a type-safe way.
|
|
194
|
+
*
|
|
195
|
+
* The `queryKey` will be tagged with the type from `queryFn`.
|
|
196
|
+
* @param options - The infinite query options to tag with the type from `queryFn`.
|
|
197
|
+
* @returns The tagged infinite query options.
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
|
|
201
|
+
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>>;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
206
|
+
* Infinite queries can additively "load more" data onto an existing set of data or "infinite scroll"
|
|
207
|
+
* @param optionsFn - A function that returns infinite query options.
|
|
208
|
+
* @param injector - The Angular injector to use.
|
|
209
|
+
* @returns The infinite query result.
|
|
210
|
+
* @public
|
|
211
|
+
*/
|
|
212
|
+
declare function injectInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(optionsFn: (client: QueryClient) => DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, injector?: Injector): DefinedCreateInfiniteQueryResult<TData, TError>;
|
|
213
|
+
/**
|
|
214
|
+
* Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
215
|
+
* Infinite queries can additively "load more" data onto an existing set of data or "infinite scroll"
|
|
216
|
+
* @param optionsFn - A function that returns infinite query options.
|
|
217
|
+
* @param injector - The Angular injector to use.
|
|
218
|
+
* @returns The infinite query result.
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
221
|
+
declare function injectInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(optionsFn: (client: QueryClient) => UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, injector?: Injector): CreateInfiniteQueryResult<TData, TError>;
|
|
222
|
+
/**
|
|
223
|
+
* Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
224
|
+
* Infinite queries can additively "load more" data onto an existing set of data or "infinite scroll"
|
|
225
|
+
* @param optionsFn - A function that returns infinite query options.
|
|
226
|
+
* @param injector - The Angular injector to use.
|
|
227
|
+
* @returns The infinite query result.
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
declare function injectInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(optionsFn: (client: QueryClient) => CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam>, injector?: Injector): CreateInfiniteQueryResult<TData, TError>;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Injects a signal that tracks the number of queries that your application is loading or
|
|
234
|
+
* fetching in the background.
|
|
235
|
+
*
|
|
236
|
+
* Can be used for app-wide loading indicators
|
|
237
|
+
* @param filters - The filters to apply to the query.
|
|
238
|
+
* @param injector - The Angular injector to use.
|
|
239
|
+
* @returns signal with number of loading or fetching queries.
|
|
240
|
+
* @public
|
|
241
|
+
*/
|
|
242
|
+
declare function injectIsFetching(filters?: QueryFilters, injector?: Injector): Signal<number>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Injects a signal that tracks the number of mutations that your application is fetching.
|
|
246
|
+
*
|
|
247
|
+
* Can be used for app-wide loading indicators
|
|
248
|
+
* @param filters - The filters to apply to the query.
|
|
249
|
+
* @param injector - The Angular injector to use.
|
|
250
|
+
* @returns signal with number of fetching mutations.
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
253
|
+
declare function injectIsMutating(filters?: MutationFilters, injector?: Injector): Signal<number>;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Injects a mutation: an imperative function that can be invoked which typically performs server side effects.
|
|
257
|
+
*
|
|
258
|
+
* Unlike queries, mutations are not run automatically.
|
|
259
|
+
* @param optionsFn - A function that returns mutation options.
|
|
260
|
+
* @param injector - The Angular injector to use.
|
|
261
|
+
* @returns The mutation.
|
|
262
|
+
* @public
|
|
263
|
+
*/
|
|
264
|
+
declare function injectMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(optionsFn: (client: QueryClient) => CreateMutationOptions<TData, TError, TVariables, TContext>, injector?: Injector): CreateMutationResult<TData, TError, TVariables, TContext>;
|
|
265
|
+
|
|
266
|
+
type MutationStateOptions<TResult = MutationState> = {
|
|
267
|
+
filters?: MutationFilters;
|
|
268
|
+
select?: (mutation: Mutation) => TResult;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* @public
|
|
272
|
+
*/
|
|
273
|
+
interface InjectMutationStateOptions {
|
|
274
|
+
injector?: Injector;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Injects a signal that tracks the state of all mutations.
|
|
278
|
+
* @param mutationStateOptionsFn - A function that returns mutation state options.
|
|
279
|
+
* @param options - The Angular injector to use.
|
|
280
|
+
* @returns The signal that tracks the state of all mutations.
|
|
281
|
+
* @public
|
|
282
|
+
*/
|
|
283
|
+
declare function injectMutationState<TResult = MutationState>(mutationStateOptionsFn?: () => MutationStateOptions<TResult>, options?: InjectMutationStateOptions): Signal<Array<TResult>>;
|
|
284
|
+
|
|
285
|
+
type QueryObserverOptionsForCreateQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'placeholderData'> & {
|
|
286
|
+
placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>;
|
|
287
|
+
};
|
|
288
|
+
type MAXIMUM_DEPTH = 20;
|
|
289
|
+
type SkipTokenForUseQueries = symbol;
|
|
290
|
+
type GetOptions<T> = T extends {
|
|
291
|
+
queryFnData: infer TQueryFnData;
|
|
292
|
+
error?: infer TError;
|
|
293
|
+
data: infer TData;
|
|
294
|
+
} ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError, TData> : T extends {
|
|
295
|
+
queryFnData: infer TQueryFnData;
|
|
296
|
+
error?: infer TError;
|
|
297
|
+
} ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError> : T extends {
|
|
298
|
+
data: infer TData;
|
|
299
|
+
error?: infer TError;
|
|
300
|
+
} ? QueryObserverOptionsForCreateQueries<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError> : T extends [infer TQueryFnData] ? QueryObserverOptionsForCreateQueries<TQueryFnData> : T extends {
|
|
301
|
+
queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries;
|
|
302
|
+
select: (data: any) => infer TData;
|
|
303
|
+
throwOnError?: ThrowOnError<any, infer TError, any, any>;
|
|
304
|
+
} ? QueryObserverOptionsForCreateQueries<TQueryFnData, unknown extends TError ? DefaultError : TError, unknown extends TData ? TQueryFnData : TData, TQueryKey> : QueryObserverOptionsForCreateQueries;
|
|
305
|
+
type GetResults<T> = T extends {
|
|
306
|
+
queryFnData: any;
|
|
307
|
+
error?: infer TError;
|
|
308
|
+
data: infer TData;
|
|
309
|
+
} ? QueryObserverResult<TData, TError> : T extends {
|
|
310
|
+
queryFnData: infer TQueryFnData;
|
|
311
|
+
error?: infer TError;
|
|
312
|
+
} ? QueryObserverResult<TQueryFnData, TError> : T extends {
|
|
313
|
+
data: infer TData;
|
|
314
|
+
error?: infer TError;
|
|
315
|
+
} ? QueryObserverResult<TData, TError> : T extends [any, infer TError, infer TData] ? QueryObserverResult<TData, TError> : T extends [infer TQueryFnData, infer TError] ? QueryObserverResult<TQueryFnData, TError> : T extends [infer TQueryFnData] ? QueryObserverResult<TQueryFnData> : T extends {
|
|
316
|
+
queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries;
|
|
317
|
+
select: (data: any) => infer TData;
|
|
318
|
+
throwOnError?: ThrowOnError<any, infer TError, any, any>;
|
|
319
|
+
} ? QueryObserverResult<unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : QueryObserverResult;
|
|
320
|
+
/**
|
|
321
|
+
* QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
324
|
+
type QueriesOptions<T extends Array<any>, TResult extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<QueryObserverOptionsForCreateQueries> : T extends [] ? [] : T extends [infer Head] ? [...TResult, GetOptions<Head>] : T extends [infer Head, ...infer Tail] ? QueriesOptions<[
|
|
325
|
+
...Tail
|
|
326
|
+
], [
|
|
327
|
+
...TResult,
|
|
328
|
+
GetOptions<Head>
|
|
329
|
+
], [
|
|
330
|
+
...TDepth,
|
|
331
|
+
1
|
|
332
|
+
]> : ReadonlyArray<unknown> extends T ? T : T extends Array<QueryObserverOptionsForCreateQueries<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<QueryObserverOptionsForCreateQueries<TQueryFnData, TError, TData, TQueryKey>> : Array<QueryObserverOptionsForCreateQueries>;
|
|
333
|
+
/**
|
|
334
|
+
* QueriesResults reducer recursively maps type param to results
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
337
|
+
type QueriesResults<T extends Array<any>, TResult extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<QueryObserverResult> : T extends [] ? [] : T extends [infer Head] ? [...TResult, GetResults<Head>] : T extends [infer Head, ...infer Tail] ? QueriesResults<[
|
|
338
|
+
...Tail
|
|
339
|
+
], [
|
|
340
|
+
...TResult,
|
|
341
|
+
GetResults<Head>
|
|
342
|
+
], [
|
|
343
|
+
...TDepth,
|
|
344
|
+
1
|
|
345
|
+
]> : T extends Array<QueryObserverOptionsForCreateQueries<infer TQueryFnData, infer TError, infer TData, any>> ? Array<QueryObserverResult<unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError>> : Array<QueryObserverResult>;
|
|
346
|
+
/**
|
|
347
|
+
* @public
|
|
348
|
+
*/
|
|
349
|
+
declare function injectQueries<T extends Array<any>, TCombinedResult = QueriesResults<T>>({ queries, ...options }: {
|
|
350
|
+
queries: Signal<[...QueriesOptions<T>]>;
|
|
351
|
+
combine?: (result: QueriesResults<T>) => TCombinedResult;
|
|
352
|
+
}, injector?: Injector): Signal<TCombinedResult>;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
356
|
+
*
|
|
357
|
+
* **Basic example**
|
|
358
|
+
* ```ts
|
|
359
|
+
* class ServiceOrComponent {
|
|
360
|
+
* query = injectQuery(() => ({
|
|
361
|
+
* queryKey: ['repoData'],
|
|
362
|
+
* queryFn: () =>
|
|
363
|
+
* this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),
|
|
364
|
+
* }))
|
|
365
|
+
* }
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.
|
|
369
|
+
* In the example below, the query will be automatically enabled and executed when the filter signal changes
|
|
370
|
+
* to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.
|
|
371
|
+
*
|
|
372
|
+
* **Reactive example**
|
|
373
|
+
* ```ts
|
|
374
|
+
* class ServiceOrComponent {
|
|
375
|
+
* filter = signal('')
|
|
376
|
+
*
|
|
377
|
+
* todosQuery = injectQuery(() => ({
|
|
378
|
+
* queryKey: ['todos', this.filter()],
|
|
379
|
+
* queryFn: () => fetchTodos(this.filter()),
|
|
380
|
+
* // Signals can be combined with expressions
|
|
381
|
+
* enabled: !!this.filter(),
|
|
382
|
+
* }))
|
|
383
|
+
* }
|
|
384
|
+
* ```
|
|
385
|
+
* @param optionsFn - A function that returns query options.
|
|
386
|
+
* @param injector - The Angular injector to use.
|
|
387
|
+
* @returns The query result.
|
|
388
|
+
* @public
|
|
389
|
+
* @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries
|
|
390
|
+
*/
|
|
391
|
+
declare function injectQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(optionsFn: (client: QueryClient) => DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, injector?: Injector): DefinedCreateQueryResult<TData, TError>;
|
|
392
|
+
/**
|
|
393
|
+
* Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
394
|
+
*
|
|
395
|
+
* **Basic example**
|
|
396
|
+
* ```ts
|
|
397
|
+
* class ServiceOrComponent {
|
|
398
|
+
* query = injectQuery(() => ({
|
|
399
|
+
* queryKey: ['repoData'],
|
|
400
|
+
* queryFn: () =>
|
|
401
|
+
* this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),
|
|
402
|
+
* }))
|
|
403
|
+
* }
|
|
404
|
+
* ```
|
|
405
|
+
*
|
|
406
|
+
* Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.
|
|
407
|
+
* In the example below, the query will be automatically enabled and executed when the filter signal changes
|
|
408
|
+
* to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.
|
|
409
|
+
*
|
|
410
|
+
* **Reactive example**
|
|
411
|
+
* ```ts
|
|
412
|
+
* class ServiceOrComponent {
|
|
413
|
+
* filter = signal('')
|
|
414
|
+
*
|
|
415
|
+
* todosQuery = injectQuery(() => ({
|
|
416
|
+
* queryKey: ['todos', this.filter()],
|
|
417
|
+
* queryFn: () => fetchTodos(this.filter()),
|
|
418
|
+
* // Signals can be combined with expressions
|
|
419
|
+
* enabled: !!this.filter(),
|
|
420
|
+
* }))
|
|
421
|
+
* }
|
|
422
|
+
* ```
|
|
423
|
+
* @param optionsFn - A function that returns query options.
|
|
424
|
+
* @param injector - The Angular injector to use.
|
|
425
|
+
* @returns The query result.
|
|
426
|
+
* @public
|
|
427
|
+
* @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries
|
|
428
|
+
*/
|
|
429
|
+
declare function injectQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(optionsFn: (client: QueryClient) => UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, injector?: Injector): CreateQueryResult<TData, TError>;
|
|
430
|
+
/**
|
|
431
|
+
* Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
432
|
+
*
|
|
433
|
+
* **Basic example**
|
|
434
|
+
* ```ts
|
|
435
|
+
* class ServiceOrComponent {
|
|
436
|
+
* query = injectQuery(() => ({
|
|
437
|
+
* queryKey: ['repoData'],
|
|
438
|
+
* queryFn: () =>
|
|
439
|
+
* this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),
|
|
440
|
+
* }))
|
|
441
|
+
* }
|
|
442
|
+
* ```
|
|
443
|
+
*
|
|
444
|
+
* Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.
|
|
445
|
+
* In the example below, the query will be automatically enabled and executed when the filter signal changes
|
|
446
|
+
* to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.
|
|
447
|
+
*
|
|
448
|
+
* **Reactive example**
|
|
449
|
+
* ```ts
|
|
450
|
+
* class ServiceOrComponent {
|
|
451
|
+
* filter = signal('')
|
|
452
|
+
*
|
|
453
|
+
* todosQuery = injectQuery(() => ({
|
|
454
|
+
* queryKey: ['todos', this.filter()],
|
|
455
|
+
* queryFn: () => fetchTodos(this.filter()),
|
|
456
|
+
* // Signals can be combined with expressions
|
|
457
|
+
* enabled: !!this.filter(),
|
|
458
|
+
* }))
|
|
459
|
+
* }
|
|
460
|
+
* ```
|
|
461
|
+
* @param optionsFn - A function that returns query options.
|
|
462
|
+
* @param injector - The Angular injector to use.
|
|
463
|
+
* @returns The query result.
|
|
464
|
+
* @public
|
|
465
|
+
* @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries
|
|
466
|
+
*/
|
|
467
|
+
declare function injectQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(optionsFn: (client: QueryClient) => CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>, injector?: Injector): CreateQueryResult<TData, TError>;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Injects the `QueryClient` instance into the component or service.
|
|
471
|
+
*
|
|
472
|
+
* **Example**
|
|
473
|
+
* ```ts
|
|
474
|
+
* const queryClient = injectQueryClient();
|
|
475
|
+
* ```
|
|
476
|
+
* @returns The `QueryClient` instance.
|
|
477
|
+
* @public
|
|
478
|
+
*/
|
|
479
|
+
declare const injectQueryClient: {
|
|
480
|
+
(): QueryClient;
|
|
481
|
+
(injectOptions: _angular_core.InjectOptions & {
|
|
482
|
+
optional?: false | undefined;
|
|
483
|
+
} & {
|
|
484
|
+
injector?: _angular_core.Injector | undefined;
|
|
485
|
+
}): QueryClient;
|
|
486
|
+
(injectOptions: _angular_core.InjectOptions & {
|
|
487
|
+
injector?: _angular_core.Injector | undefined;
|
|
488
|
+
}): QueryClient | null;
|
|
489
|
+
};
|
|
490
|
+
/**
|
|
491
|
+
* Usually {@link provideTanStackQuery} is used once to set up TanStack Query and the
|
|
492
|
+
* {@link https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient}
|
|
493
|
+
* for the entire application. You can use `provideQueryClient` to provide a
|
|
494
|
+
* different `QueryClient` instance for a part of the application.
|
|
495
|
+
* @public
|
|
496
|
+
*/
|
|
497
|
+
declare const provideQueryClient: ((value: QueryClient | (() => QueryClient)) => _angular_core.Provider) & ((value: QueryClient | (() => QueryClient)) => _angular_core.Provider);
|
|
498
|
+
declare const QUERY_CLIENT: _angular_core.InjectionToken<QueryClient>;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Sets up providers necessary to enable TanStack Query functionality for Angular applications.
|
|
502
|
+
*
|
|
503
|
+
* Allows to configure a `QueryClient` and optional features such as developer tools.
|
|
504
|
+
*
|
|
505
|
+
* **Example - standalone**
|
|
506
|
+
*
|
|
507
|
+
* ```ts
|
|
508
|
+
* import {
|
|
509
|
+
* provideTanStackQuery,
|
|
510
|
+
* QueryClient,
|
|
511
|
+
* } from '@tanstack/angular-query-experimental'
|
|
512
|
+
*
|
|
513
|
+
* bootstrapApplication(AppComponent, {
|
|
514
|
+
* providers: [provideTanStackQuery(new QueryClient())],
|
|
515
|
+
* })
|
|
516
|
+
* ```
|
|
517
|
+
*
|
|
518
|
+
* **Example - NgModule-based**
|
|
519
|
+
*
|
|
520
|
+
* ```ts
|
|
521
|
+
* import {
|
|
522
|
+
* provideTanStackQuery,
|
|
523
|
+
* QueryClient,
|
|
524
|
+
* } from '@tanstack/angular-query-experimental'
|
|
525
|
+
*
|
|
526
|
+
* @NgModule({
|
|
527
|
+
* declarations: [AppComponent],
|
|
528
|
+
* imports: [BrowserModule],
|
|
529
|
+
* providers: [provideTanStackQuery(new QueryClient())],
|
|
530
|
+
* bootstrap: [AppComponent],
|
|
531
|
+
* })
|
|
532
|
+
* export class AppModule {}
|
|
533
|
+
* ```
|
|
534
|
+
*
|
|
535
|
+
* You can also enable optional developer tools by adding `withDevtools`. By
|
|
536
|
+
* default the tools will then be loaded when your app is in development mode.
|
|
537
|
+
* ```ts
|
|
538
|
+
* import {
|
|
539
|
+
* provideTanStackQuery,
|
|
540
|
+
* withDevtools
|
|
541
|
+
* QueryClient,
|
|
542
|
+
* } from '@tanstack/angular-query-experimental'
|
|
543
|
+
*
|
|
544
|
+
* bootstrapApplication(AppComponent,
|
|
545
|
+
* {
|
|
546
|
+
* providers: [
|
|
547
|
+
* provideTanStackQuery(new QueryClient(), withDevtools())
|
|
548
|
+
* ]
|
|
549
|
+
* }
|
|
550
|
+
* )
|
|
551
|
+
* ```
|
|
552
|
+
* @param queryClient - A `QueryClient` instance.
|
|
553
|
+
* @param features - Optional features to configure additional Query functionality.
|
|
554
|
+
* @returns A set of providers to set up TanStack Query.
|
|
555
|
+
* @public
|
|
556
|
+
* @see https://tanstack.com/query/v5/docs/framework/angular/quick-start
|
|
557
|
+
* @see withDevtools
|
|
558
|
+
*/
|
|
559
|
+
declare function provideTanStackQuery(queryClient: QueryClient, ...features: Array<QueryFeatures>): EnvironmentProviders;
|
|
560
|
+
/**
|
|
561
|
+
* Sets up providers necessary to enable TanStack Query functionality for Angular applications.
|
|
562
|
+
*
|
|
563
|
+
* Allows to configure a `QueryClient`.
|
|
564
|
+
* @param queryClient - A `QueryClient` instance.
|
|
565
|
+
* @returns A set of providers to set up TanStack Query.
|
|
566
|
+
* @public
|
|
567
|
+
* @see https://tanstack.com/query/v5/docs/framework/angular/quick-start
|
|
568
|
+
* @deprecated Use `provideTanStackQuery` instead.
|
|
569
|
+
*/
|
|
570
|
+
declare function provideAngularQuery(queryClient: QueryClient): EnvironmentProviders;
|
|
571
|
+
/**
|
|
572
|
+
* Helper type to represent a Query feature.
|
|
573
|
+
*/
|
|
574
|
+
interface QueryFeature<TFeatureKind extends QueryFeatureKind> {
|
|
575
|
+
ɵkind: TFeatureKind;
|
|
576
|
+
ɵproviders: Array<Provider>;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* A type alias that represents a feature which enables developer tools.
|
|
580
|
+
* The type is used to describe the return value of the `withDevtools` function.
|
|
581
|
+
* @public
|
|
582
|
+
* @see {@link withDevtools}
|
|
583
|
+
*/
|
|
584
|
+
type DeveloperToolsFeature = QueryFeature<'DeveloperTools'>;
|
|
585
|
+
/**
|
|
586
|
+
* Options for configuring the TanStack Query devtools.
|
|
587
|
+
* @public
|
|
588
|
+
*/
|
|
589
|
+
interface DevtoolsOptions {
|
|
590
|
+
/**
|
|
591
|
+
* Set this true if you want the devtools to default to being open
|
|
592
|
+
*/
|
|
593
|
+
initialIsOpen?: boolean;
|
|
594
|
+
/**
|
|
595
|
+
* The position of the TanStack logo to open and close the devtools panel.
|
|
596
|
+
* `top-left` | `top-right` | `bottom-left` | `bottom-right` | `relative`
|
|
597
|
+
* Defaults to `bottom-right`.
|
|
598
|
+
*/
|
|
599
|
+
buttonPosition?: DevtoolsButtonPosition;
|
|
600
|
+
/**
|
|
601
|
+
* The position of the TanStack Query devtools panel.
|
|
602
|
+
* `top` | `bottom` | `left` | `right`
|
|
603
|
+
* Defaults to `bottom`.
|
|
604
|
+
*/
|
|
605
|
+
position?: DevtoolsPosition;
|
|
606
|
+
/**
|
|
607
|
+
* Custom instance of QueryClient
|
|
608
|
+
*/
|
|
609
|
+
client?: QueryClient;
|
|
610
|
+
/**
|
|
611
|
+
* Use this so you can define custom errors that can be shown in the devtools.
|
|
612
|
+
*/
|
|
613
|
+
errorTypes?: Array<DevtoolsErrorType>;
|
|
614
|
+
/**
|
|
615
|
+
* Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
|
|
616
|
+
*/
|
|
617
|
+
styleNonce?: string;
|
|
618
|
+
/**
|
|
619
|
+
* Use this so you can attach the devtool's styles to a specific element in the DOM.
|
|
620
|
+
*/
|
|
621
|
+
shadowDOMTarget?: ShadowRoot;
|
|
622
|
+
/**
|
|
623
|
+
* Whether the developer tools should load.
|
|
624
|
+
* - `auto`- (Default) Lazily loads devtools when in development mode. Skips loading in production mode.
|
|
625
|
+
* - `true`- Always load the devtools, regardless of the environment.
|
|
626
|
+
* - `false`- Never load the devtools, regardless of the environment.
|
|
627
|
+
*
|
|
628
|
+
* You can use `true` and `false` to override loading developer tools from an environment file.
|
|
629
|
+
* For example, a test environment might run in production mode but you may want to load developer tools.
|
|
630
|
+
*
|
|
631
|
+
* Additionally, you can use a signal in the callback to dynamically load the devtools based on a condition. For example,
|
|
632
|
+
* a signal created from a RxJS observable that listens for a keyboard shortcut.
|
|
633
|
+
*
|
|
634
|
+
* **Example**
|
|
635
|
+
* ```ts
|
|
636
|
+
* withDevtools(() => ({
|
|
637
|
+
* initialIsOpen: true,
|
|
638
|
+
* loadDevtools: inject(ExampleService).loadDevtools()
|
|
639
|
+
* }))
|
|
640
|
+
* ```
|
|
641
|
+
*/
|
|
642
|
+
loadDevtools?: 'auto' | boolean;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Enables developer tools.
|
|
646
|
+
*
|
|
647
|
+
* **Example**
|
|
648
|
+
*
|
|
649
|
+
* ```ts
|
|
650
|
+
* export const appConfig: ApplicationConfig = {
|
|
651
|
+
* providers: [
|
|
652
|
+
* provideTanStackQuery(new QueryClient(), withDevtools())
|
|
653
|
+
* ]
|
|
654
|
+
* }
|
|
655
|
+
* ```
|
|
656
|
+
* By default the devtools will be loaded when Angular runs in development mode and rendered in `<body>`.
|
|
657
|
+
*
|
|
658
|
+
* If you need more control over when devtools are loaded, you can use the `loadDevtools` option. This is particularly useful if you want to load devtools based on environment configurations. For instance, you might have a test environment running in production mode but still require devtools to be available.
|
|
659
|
+
*
|
|
660
|
+
* If you need more control over where devtools are rendered, consider `injectDevtoolsPanel`. This allows rendering devtools inside your own devtools for example.
|
|
661
|
+
* @param optionsFn - A function that returns `DevtoolsOptions`.
|
|
662
|
+
* @returns A set of providers for use with `provideTanStackQuery`.
|
|
663
|
+
* @public
|
|
664
|
+
* @see {@link provideTanStackQuery}
|
|
665
|
+
* @see {@link DevtoolsOptions}
|
|
666
|
+
*/
|
|
667
|
+
declare function withDevtools(optionsFn?: () => DevtoolsOptions): DeveloperToolsFeature;
|
|
668
|
+
/**
|
|
669
|
+
* A type alias that represents all Query features available for use with `provideTanStackQuery`.
|
|
670
|
+
* Features can be enabled by adding special functions to the `provideTanStackQuery` call.
|
|
671
|
+
* See documentation for each symbol to find corresponding function name. See also `provideTanStackQuery`
|
|
672
|
+
* documentation on how to use those functions.
|
|
673
|
+
* @public
|
|
674
|
+
* @see {@link provideTanStackQuery}
|
|
675
|
+
*/
|
|
676
|
+
type QueryFeatures = DeveloperToolsFeature;
|
|
677
|
+
declare const queryFeatures: readonly ["DeveloperTools"];
|
|
678
|
+
type QueryFeatureKind = (typeof queryFeatures)[number];
|
|
679
|
+
|
|
680
|
+
export { type BaseMutationNarrowing, type BaseQueryNarrowing, type CreateBaseMutationResult, type CreateBaseQueryOptions, type CreateBaseQueryResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreateMutateAsyncFunction, type CreateMutateFunction, type CreateMutationOptions, type CreateMutationResult, type CreateQueryOptions, type CreateQueryResult, type DefinedCreateInfiniteQueryResult, type DefinedCreateQueryResult, type DefinedInitialDataInfiniteOptions, type DefinedInitialDataOptions, type DeveloperToolsFeature, type DevtoolsOptions, type InjectMutationStateOptions, type NonUndefinedGuard, QUERY_CLIENT, type QueriesOptions, type QueriesResults, type QueryFeature, type QueryFeatureKind, type QueryFeatures, type UndefinedInitialDataInfiniteOptions, type UndefinedInitialDataOptions, infiniteQueryOptions, injectInfiniteQuery, injectIsFetching, injectIsMutating, injectMutation, injectMutationState, injectQueries, injectQuery, injectQueryClient, provideAngularQuery, provideQueryClient, provideTanStackQuery, queryFeatures, queryOptions, withDevtools };
|