@tanstack/angular-query-experimental 5.75.6 → 5.75.8
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/build/index.d.ts +17 -5
- package/build/index.mjs +7 -17
- package/build/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/providers.ts +28 -30
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefaultError, QueryKey, OmitKeyof, QueryObserverOptions, InfiniteQueryObserverOptions, DefinedInfiniteQueryObserverResult, QueryObserverResult, InfiniteQueryObserverResult, Override, MutationObserverResult, MutateFunction, DefinedQueryObserverResult, QueryFunction, InitialDataFunction, SkipToken, DataTag, MutationObserverOptions, InfiniteData, QueryFilters, MutationFilters, MutationState, Mutation, QueriesPlaceholderDataFunction, ThrowOnError, QueryClient } from '@tanstack/query-core';
|
|
2
2
|
export * from '@tanstack/query-core';
|
|
3
|
-
import { Signal, Injector, Provider, InjectOptions, InjectionToken
|
|
3
|
+
import { Signal, Injector, Provider, InjectOptions, InjectionToken } from '@angular/core';
|
|
4
4
|
import { DevtoolsButtonPosition, DevtoolsPosition, DevtoolsErrorType } from '@tanstack/query-devtools';
|
|
5
5
|
|
|
6
6
|
type MapToSignals<T> = {
|
|
@@ -621,9 +621,10 @@ declare function injectQueryClient(injectOptions?: InjectOptions & {
|
|
|
621
621
|
/**
|
|
622
622
|
* Usually {@link provideTanStackQuery} is used once to set up TanStack Query and the
|
|
623
623
|
* {@link https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient}
|
|
624
|
-
* for the entire application.
|
|
625
|
-
* different `QueryClient` instance for a part
|
|
626
|
-
*
|
|
624
|
+
* for the entire application. Internally it calls `provideQueryClient`.
|
|
625
|
+
* You can use `provideQueryClient` to provide a different `QueryClient` instance for a part
|
|
626
|
+
* of the application or for unit testing purposes.
|
|
627
|
+
* @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
|
|
627
628
|
* @returns a provider object that can be used to provide the `QueryClient` instance.
|
|
628
629
|
*/
|
|
629
630
|
declare function provideQueryClient(queryClient: QueryClient | InjectionToken<QueryClient>): Provider;
|
|
@@ -679,13 +680,24 @@ declare function provideQueryClient(queryClient: QueryClient | InjectionToken<Qu
|
|
|
679
680
|
* }
|
|
680
681
|
* )
|
|
681
682
|
* ```
|
|
683
|
+
*
|
|
684
|
+
* **Example: using an InjectionToken**
|
|
685
|
+
*
|
|
686
|
+
* ```ts
|
|
687
|
+
* export const MY_QUERY_CLIENT = new InjectionToken('', {
|
|
688
|
+
* factory: () => new QueryClient(),
|
|
689
|
+
* })
|
|
690
|
+
*
|
|
691
|
+
* // In a lazy loaded route or lazy loaded component's providers array:
|
|
692
|
+
* providers: [provideTanStackQuery(MY_QUERY_CLIENT)]
|
|
693
|
+
* ```
|
|
682
694
|
* @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
|
|
683
695
|
* @param features - Optional features to configure additional Query functionality.
|
|
684
696
|
* @returns A set of providers to set up TanStack Query.
|
|
685
697
|
* @see https://tanstack.com/query/v5/docs/framework/angular/quick-start
|
|
686
698
|
* @see withDevtools
|
|
687
699
|
*/
|
|
688
|
-
declare function provideTanStackQuery(queryClient: QueryClient | InjectionToken<QueryClient>, ...features: Array<QueryFeatures>):
|
|
700
|
+
declare function provideTanStackQuery(queryClient: QueryClient | InjectionToken<QueryClient>, ...features: Array<QueryFeatures>): Array<Provider>;
|
|
689
701
|
/**
|
|
690
702
|
* Helper type to represent a Query feature.
|
|
691
703
|
*/
|
package/build/index.mjs
CHANGED
|
@@ -497,8 +497,7 @@ import {
|
|
|
497
497
|
PLATFORM_ID,
|
|
498
498
|
computed as computed6,
|
|
499
499
|
effect as effect4,
|
|
500
|
-
inject as inject11
|
|
501
|
-
makeEnvironmentProviders
|
|
500
|
+
inject as inject11
|
|
502
501
|
} from "@angular/core";
|
|
503
502
|
import { QueryClient as QueryClient8, onlineManager } from "@tanstack/query-core";
|
|
504
503
|
import { isPlatformBrowser } from "@angular/common";
|
|
@@ -511,27 +510,18 @@ function provideQueryClient(queryClient) {
|
|
|
511
510
|
return {
|
|
512
511
|
provide: QueryClient8,
|
|
513
512
|
useFactory: () => {
|
|
514
|
-
|
|
513
|
+
const client = queryClient instanceof InjectionToken2 ? inject11(queryClient) : queryClient;
|
|
514
|
+
inject11(DestroyRef6).onDestroy(() => client.unmount());
|
|
515
|
+
client.mount();
|
|
516
|
+
return client;
|
|
515
517
|
}
|
|
516
518
|
};
|
|
517
519
|
}
|
|
518
520
|
function provideTanStackQuery(queryClient, ...features) {
|
|
519
|
-
return
|
|
521
|
+
return [
|
|
520
522
|
provideQueryClient(queryClient),
|
|
521
|
-
{
|
|
522
|
-
// Do not use provideEnvironmentInitializer while Angular < v19 is supported
|
|
523
|
-
provide: ENVIRONMENT_INITIALIZER,
|
|
524
|
-
multi: true,
|
|
525
|
-
useFactory: () => {
|
|
526
|
-
const client = queryClient instanceof InjectionToken2 ? inject11(queryClient) : queryClient;
|
|
527
|
-
return () => {
|
|
528
|
-
client.mount();
|
|
529
|
-
inject11(DestroyRef6).onDestroy(() => client.unmount());
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
},
|
|
533
523
|
features.map((feature) => feature.\u0275providers)
|
|
534
|
-
]
|
|
524
|
+
];
|
|
535
525
|
}
|
|
536
526
|
function queryFeature(kind, providers) {
|
|
537
527
|
return { \u0275kind: kind, \u0275providers: providers };
|
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/query-options.ts","../src/mutation-options.ts","../src/infinite-query-options.ts","../src/inject-infinite-query.ts","../src/create-base-query.ts","../src/signal-proxy.ts","../src/inject-is-restoring.ts","../src/inject-is-fetching.ts","../src/inject-is-mutating.ts","../src/inject-mutation.ts","../src/util/index.ts","../src/inject-mutation-state.ts","../src/inject-queries.ts","../src/inject-query.ts","../src/inject-query-client.ts","../src/providers.ts","../src/util/is-dev-mode/is-dev-mode.ts"],"sourcesContent":["/* istanbul ignore file */\n\n// Re-export core\nexport * from '@tanstack/query-core'\n\nexport * from './types'\n\nexport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n UnusedSkipTokenOptions,\n} from './query-options'\nexport { queryOptions } from './query-options'\n\nexport type { CreateMutationOptions } from './mutation-options'\nexport { mutationOptions } from './mutation-options'\n\nexport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n UnusedSkipTokenInfiniteOptions,\n} from './infinite-query-options'\nexport { infiniteQueryOptions } from './infinite-query-options'\n\nexport type { InjectInfiniteQueryOptions } from './inject-infinite-query'\nexport { injectInfiniteQuery } from './inject-infinite-query'\n\nexport type { InjectIsFetchingOptions } from './inject-is-fetching'\nexport { injectIsFetching } from './inject-is-fetching'\n\nexport type { InjectIsMutatingOptions } from './inject-is-mutating'\nexport { injectIsMutating } from './inject-is-mutating'\n\nexport { injectIsRestoring, provideIsRestoring } from './inject-is-restoring'\n\nexport type { InjectMutationOptions } from './inject-mutation'\nexport { injectMutation } from './inject-mutation'\n\nexport type { InjectMutationStateOptions } from './inject-mutation-state'\nexport { injectMutationState } from './inject-mutation-state'\n\nexport type { QueriesOptions, QueriesResults } from './inject-queries'\nexport { injectQueries } from './inject-queries'\n\nexport type { InjectQueryOptions } from './inject-query'\nexport { injectQuery } from './inject-query'\n\nexport { injectQueryClient } from './inject-query-client'\n\nexport type {\n DeveloperToolsFeature,\n DevtoolsOptions,\n PersistQueryClientFeature,\n QueryFeature,\n QueryFeatureKind,\n QueryFeatures,\n} from './providers'\nexport {\n provideQueryClient,\n provideTanStackQuery,\n queryFeature,\n queryFeatures,\n withDevtools,\n} from './providers'\n","import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { CreateQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\ntype NonUndefinedGuard<T> = T extends undefined ? never : T\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions(options: unknown) {\n return options\n}\n","import type {\n DefaultError,\n MutationObserverOptions,\n OmitKeyof,\n} from '@tanstack/query-core'\n\n/**\n * Allows to share and re-use mutation options in a type-safe way.\n *\n * **Example**\n *\n * ```ts\n * export class QueriesService {\n * private http = inject(HttpClient);\n *\n * updatePost(id: number) {\n * return mutationOptions({\n * mutationFn: (post: Post) => Promise.resolve(post),\n * mutationKey: [\"updatePost\", id],\n * onSuccess: (newPost) => {\n * // ^? newPost: Post\n * this.queryClient.setQueryData([\"posts\", id], newPost);\n * },\n * });\n * }\n * }\n *\n * queries = inject(QueriesService)\n * idSignal = new Signal(0);\n * mutation = injectMutation(() => this.queries.updatePost(this.idSignal()))\n *\n * mutation.mutate({ title: 'New Title' })\n * ```\n * @param options - The mutation options.\n * @returns Mutation options.\n * @public\n */\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n>(\n options: MutationObserverOptions<TData, TError, TVariables, TContext>,\n): CreateMutationOptions<TData, TError, TVariables, TContext> {\n return options\n}\n\n/**\n * @public\n */\nexport interface CreateMutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n> extends OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TContext>,\n '_defaulted'\n > {}\n","import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n OmitKeyof,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { CreateInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n> & {\n initialData?:\n | undefined\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\ntype NonUndefinedGuard<T> = T extends undefined ? never : T\n\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n> & {\n initialData:\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n * @public\n */\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n * @public\n */\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n * @public\n */\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n * @public\n */\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n","import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport {\n Injector,\n assertInInjectionContext,\n inject,\n runInInjectionContext,\n} from '@angular/core'\nimport { createBaseQuery } from './create-base-query'\nimport type {\n DefaultError,\n InfiniteData,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n CreateInfiniteQueryOptions,\n CreateInfiniteQueryResult,\n DefinedCreateInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infinite-query-options'\n\nexport interface InjectInfiniteQueryOptions {\n /**\n * The `Injector` in which to create the infinite query.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n * @public\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): DefinedCreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n * @public\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): CreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n * @public\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): CreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n * @public\n */\nexport function injectInfiniteQuery(\n injectInfiniteQueryFn: () => CreateInfiniteQueryOptions,\n options?: InjectInfiniteQueryOptions,\n) {\n !options?.injector && assertInInjectionContext(injectInfiniteQuery)\n const injector = options?.injector ?? inject(Injector)\n return runInInjectionContext(injector, () =>\n createBaseQuery(\n injectInfiniteQueryFn,\n InfiniteQueryObserver as typeof QueryObserver,\n ),\n )\n}\n","import {\n NgZone,\n VERSION,\n computed,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core'\nimport {\n QueryClient,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { signalProxy } from './signal-proxy'\nimport { injectIsRestoring } from './inject-is-restoring'\nimport type {\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { CreateBaseQueryOptions } from './types'\n\n/**\n * Base implementation for `injectQuery` and `injectInfiniteQuery`.\n * @param optionsFn\n * @param Observer\n */\nexport function createBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n optionsFn: () => CreateBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n) {\n const ngZone = inject(NgZone)\n const queryClient = inject(QueryClient)\n const isRestoring = injectIsRestoring()\n\n /**\n * Signal that has the default options from query client applied\n * computed() is used so signals can be inserted into the options\n * making it reactive. Wrapping options in a function ensures embedded expressions\n * are preserved and can keep being applied after signal changes\n */\n const defaultedOptionsSignal = computed(() => {\n const defaultedOptions = queryClient.defaultQueryOptions(optionsFn())\n defaultedOptions._optimisticResults = isRestoring()\n ? 'isRestoring'\n : 'optimistic'\n return defaultedOptions\n })\n\n const observerSignal = (() => {\n let instance: QueryObserver<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n > | null = null\n\n return computed(() => {\n return (instance ||= new Observer(queryClient, defaultedOptionsSignal()))\n })\n })()\n\n const optimisticResultSignal = computed(() =>\n observerSignal().getOptimisticResult(defaultedOptionsSignal()),\n )\n\n const resultFromSubscriberSignal = signal<QueryObserverResult<\n TData,\n TError\n > | null>(null)\n\n effect(\n (onCleanup) => {\n const observer = observerSignal()\n const defaultedOptions = defaultedOptionsSignal()\n\n untracked(() => {\n observer.setOptions(defaultedOptions)\n })\n onCleanup(() => {\n ngZone.run(() => resultFromSubscriberSignal.set(null))\n })\n },\n {\n // Set allowSignalWrites to support Angular < v19\n // Set to undefined to avoid warning on newer versions\n allowSignalWrites: VERSION.major < '19' || undefined,\n },\n )\n\n effect((onCleanup) => {\n // observer.trackResult is not used as this optimization is not needed for Angular\n const observer = observerSignal()\n const unsubscribe = isRestoring()\n ? () => undefined\n : untracked(() =>\n ngZone.runOutsideAngular(() =>\n observer.subscribe(\n notifyManager.batchCalls((state) => {\n ngZone.run(() => {\n if (\n state.isError &&\n !state.isFetching &&\n shouldThrowError(observer.options.throwOnError, [\n state.error,\n observer.getCurrentQuery(),\n ])\n ) {\n ngZone.onError.emit(state.error)\n throw state.error\n }\n resultFromSubscriberSignal.set(state)\n })\n }),\n ),\n ),\n )\n onCleanup(unsubscribe)\n })\n\n return signalProxy(\n computed(() => {\n const subscriberResult = resultFromSubscriberSignal()\n const optimisticResult = optimisticResultSignal()\n return subscriberResult ?? optimisticResult\n }),\n )\n}\n","import { computed, untracked } from '@angular/core'\nimport type { Signal } from '@angular/core'\n\nexport type MapToSignals<T> = {\n [K in keyof T]: T[K] extends Function ? T[K] : Signal<T[K]>\n}\n\n/**\n * Exposes fields of an object passed via an Angular `Signal` as `Computed` signals.\n * Functions on the object are passed through as-is.\n * @param inputSignal - `Signal` that must return an object.\n * @returns A proxy object with the same fields as the input object, but with each field wrapped in a `Computed` signal.\n */\nexport function signalProxy<TInput extends Record<string | symbol, any>>(\n inputSignal: Signal<TInput>,\n) {\n const internalState = {} as MapToSignals<TInput>\n\n return new Proxy<MapToSignals<TInput>>(internalState, {\n get(target, prop) {\n // first check if we have it in our internal state and return it\n const computedField = target[prop]\n if (computedField) return computedField\n\n // then, check if it's a function on the resultState and return it\n const targetField = untracked(inputSignal)[prop]\n if (typeof targetField === 'function') return targetField\n\n // finally, create a computed field, store it and return it\n // @ts-expect-error\n return (target[prop] = computed(() => inputSignal()[prop]))\n },\n has(_, prop) {\n return !!untracked(inputSignal)[prop]\n },\n ownKeys() {\n return Reflect.ownKeys(untracked(inputSignal))\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n }\n },\n })\n}\n","import {\n InjectionToken,\n Injector,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport type { Provider, Signal } from '@angular/core'\n\nconst IS_RESTORING = new InjectionToken(\n typeof ngDevMode === 'undefined' || ngDevMode\n ? 'TANSTACK_QUERY_IS_RESTORING'\n : '',\n {\n // Default value when not provided\n factory: () => signal(false).asReadonly(),\n },\n)\n\n/**\n * The `Injector` in which to create the isRestoring signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\ninterface InjectIsRestoringOptions {\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks whether a restore is currently in progress. {@link injectQuery} and friends also check this internally to avoid race conditions between the restore and initializing queries.\n * @param options - Options for injectIsRestoring.\n * @returns signal with boolean that indicates whether a restore is in progress.\n * @public\n */\nexport function injectIsRestoring(options?: InjectIsRestoringOptions) {\n !options?.injector && assertInInjectionContext(injectIsRestoring)\n const injector = options?.injector ?? inject(Injector)\n return injector.get(IS_RESTORING)\n}\n\n/**\n * Used by TanStack Query Angular persist client plugin to provide the signal that tracks the restore state\n * @param isRestoring - a readonly signal that returns a boolean\n * @returns Provider for the `isRestoring` signal\n * @public\n */\nexport function provideIsRestoring(isRestoring: Signal<boolean>): Provider {\n return {\n provide: IS_RESTORING,\n useValue: isRestoring,\n }\n}\n","import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport { QueryClient, notifyManager } from '@tanstack/query-core'\nimport type { QueryFilters } from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\n\nexport interface InjectIsFetchingOptions {\n /**\n * The `Injector` in which to create the isFetching signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the number of queries that your application is loading or\n * fetching in the background.\n *\n * Can be used for app-wide loading indicators\n * @param filters - The filters to apply to the query.\n * @param options - Additional configuration\n * @returns signal with number of loading or fetching queries.\n * @public\n */\nexport function injectIsFetching(\n filters?: QueryFilters,\n options?: InjectIsFetchingOptions,\n): Signal<number> {\n !options?.injector && assertInInjectionContext(injectIsFetching)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n\n const cache = queryClient.getQueryCache()\n // isFetching is the prev value initialized on mount *\n let isFetching = queryClient.isFetching(filters)\n\n const result = signal(isFetching)\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n cache.subscribe(\n notifyManager.batchCalls(() => {\n const newIsFetching = queryClient.isFetching(filters)\n if (isFetching !== newIsFetching) {\n // * and update with each change\n isFetching = newIsFetching\n ngZone.run(() => {\n result.set(isFetching)\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return result\n}\n","import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport { QueryClient, notifyManager } from '@tanstack/query-core'\nimport type { MutationFilters } from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\n\nexport interface InjectIsMutatingOptions {\n /**\n * The `Injector` in which to create the isMutating signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the number of mutations that your application is fetching.\n *\n * Can be used for app-wide loading indicators\n * @param filters - The filters to apply to the query.\n * @param options - Additional configuration\n * @returns signal with number of fetching mutations.\n * @public\n */\nexport function injectIsMutating(\n filters?: MutationFilters,\n options?: InjectIsMutatingOptions,\n): Signal<number> {\n !options?.injector && assertInInjectionContext(injectIsMutating)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n\n const cache = queryClient.getMutationCache()\n // isMutating is the prev value initialized on mount *\n let isMutating = queryClient.isMutating(filters)\n\n const result = signal(isMutating)\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n cache.subscribe(\n notifyManager.batchCalls(() => {\n const newIsMutating = queryClient.isMutating(filters)\n if (isMutating !== newIsMutating) {\n // * and update with each change\n isMutating = newIsMutating\n ngZone.run(() => {\n result.set(isMutating)\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return result\n}\n","import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n computed,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core'\nimport {\n MutationObserver,\n QueryClient,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { signalProxy } from './signal-proxy'\nimport { noop } from './util'\nimport type { DefaultError, MutationObserverResult } from '@tanstack/query-core'\nimport type { CreateMutateFunction, CreateMutationResult } from './types'\nimport type { CreateMutationOptions } from './mutation-options'\n\nexport interface InjectMutationOptions {\n /**\n * The `Injector` in which to create the mutation.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a mutation: an imperative function that can be invoked which typically performs server side effects.\n *\n * Unlike queries, mutations are not run automatically.\n * @param injectMutationFn - A function that returns mutation options.\n * @param options - Additional configuration\n * @returns The mutation.\n * @public\n */\nexport function injectMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n>(\n injectMutationFn: () => CreateMutationOptions<\n TData,\n TError,\n TVariables,\n TContext\n >,\n options?: InjectMutationOptions,\n): CreateMutationResult<TData, TError, TVariables, TContext> {\n !options?.injector && assertInInjectionContext(injectMutation)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n\n /**\n * computed() is used so signals can be inserted into the options\n * making it reactive. Wrapping options in a function ensures embedded expressions\n * are preserved and can keep being applied after signal changes\n */\n const optionsSignal = computed(injectMutationFn)\n\n const observerSignal = (() => {\n let instance: MutationObserver<TData, TError, TVariables, TContext> | null =\n null\n\n return computed(() => {\n return (instance ||= new MutationObserver(queryClient, optionsSignal()))\n })\n })()\n\n const mutateFnSignal = computed<\n CreateMutateFunction<TData, TError, TVariables, TContext>\n >(() => {\n const observer = observerSignal()\n return (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop)\n }\n })\n\n /**\n * Computed signal that gets result from mutation cache based on passed options\n */\n const resultFromInitialOptionsSignal = computed(() => {\n const observer = observerSignal()\n return observer.getCurrentResult()\n })\n\n /**\n * Signal that contains result set by subscriber\n */\n const resultFromSubscriberSignal = signal<MutationObserverResult<\n TData,\n TError,\n TVariables,\n TContext\n > | null>(null)\n\n effect(\n () => {\n const observer = observerSignal()\n const observerOptions = optionsSignal()\n\n untracked(() => {\n observer.setOptions(observerOptions)\n })\n },\n {\n injector,\n },\n )\n\n effect(\n () => {\n // observer.trackResult is not used as this optimization is not needed for Angular\n const observer = observerSignal()\n\n untracked(() => {\n const unsubscribe = ngZone.runOutsideAngular(() =>\n observer.subscribe(\n notifyManager.batchCalls((state) => {\n ngZone.run(() => {\n if (\n state.isError &&\n shouldThrowError(observer.options.throwOnError, [state.error])\n ) {\n ngZone.onError.emit(state.error)\n throw state.error\n }\n\n resultFromSubscriberSignal.set(state)\n })\n }),\n ),\n )\n destroyRef.onDestroy(unsubscribe)\n })\n },\n {\n injector,\n },\n )\n\n const resultSignal = computed(() => {\n const resultFromSubscriber = resultFromSubscriberSignal()\n const resultFromInitialOptions = resultFromInitialOptionsSignal()\n\n const result = resultFromSubscriber ?? resultFromInitialOptions\n\n return {\n ...result,\n mutate: mutateFnSignal(),\n mutateAsync: result.mutate,\n }\n })\n\n return signalProxy(resultSignal) as CreateMutationResult<\n TData,\n TError,\n TVariables,\n TContext\n >\n}\n","export function noop(): void {}\n","import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n computed,\n inject,\n signal,\n} from '@angular/core'\nimport {\n QueryClient,\n notifyManager,\n replaceEqualDeep,\n} from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\nimport type {\n Mutation,\n MutationCache,\n MutationFilters,\n MutationState,\n} from '@tanstack/query-core'\n\ntype MutationStateOptions<TResult = MutationState> = {\n filters?: MutationFilters\n select?: (mutation: Mutation) => TResult\n}\n\n/**\n *\n * @param mutationCache\n * @param options\n */\nfunction getResult<TResult = MutationState>(\n mutationCache: MutationCache,\n options: MutationStateOptions<TResult>,\n): Array<TResult> {\n return mutationCache\n .findAll(options.filters)\n .map(\n (mutation): TResult =>\n (options.select ? options.select(mutation) : mutation.state) as TResult,\n )\n}\n\n/**\n * @public\n */\nexport interface InjectMutationStateOptions {\n /**\n * The `Injector` in which to create the mutation state signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the state of all mutations.\n * @param injectMutationStateFn - A function that returns mutation state options.\n * @param options - The Angular injector to use.\n * @returns The signal that tracks the state of all mutations.\n * @public\n */\nexport function injectMutationState<TResult = MutationState>(\n injectMutationStateFn: () => MutationStateOptions<TResult> = () => ({}),\n options?: InjectMutationStateOptions,\n): Signal<Array<TResult>> {\n !options?.injector && assertInInjectionContext(injectMutationState)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n const mutationCache = queryClient.getMutationCache()\n\n /**\n * Computed signal that gets result from mutation cache based on passed options\n * First element is the result, second element is the time when the result was set\n */\n const resultFromOptionsSignal = computed(() => {\n return [\n getResult(mutationCache, injectMutationStateFn()),\n performance.now(),\n ] as const\n })\n\n /**\n * Signal that contains result set by subscriber\n * First element is the result, second element is the time when the result was set\n */\n const resultFromSubscriberSignal = signal<[Array<TResult>, number] | null>(\n null,\n )\n\n /**\n * Returns the last result by either subscriber or options\n */\n const effectiveResultSignal = computed(() => {\n const optionsResult = resultFromOptionsSignal()\n const subscriberResult = resultFromSubscriberSignal()\n return subscriberResult && subscriberResult[1] > optionsResult[1]\n ? subscriberResult[0]\n : optionsResult[0]\n })\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n mutationCache.subscribe(\n notifyManager.batchCalls(() => {\n const [lastResult] = effectiveResultSignal()\n const nextResult = replaceEqualDeep(\n lastResult,\n getResult(mutationCache, injectMutationStateFn()),\n )\n if (lastResult !== nextResult) {\n ngZone.run(() => {\n resultFromSubscriberSignal.set([nextResult, performance.now()])\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return effectiveResultSignal\n}\n","import {\n QueriesObserver,\n QueryClient,\n notifyManager,\n} from '@tanstack/query-core'\nimport {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n computed,\n effect,\n inject,\n runInInjectionContext,\n signal,\n} from '@angular/core'\nimport { injectIsRestoring } from './inject-is-restoring'\nimport type { Signal } from '@angular/core'\nimport type {\n DefaultError,\n OmitKeyof,\n QueriesObserverOptions,\n QueriesPlaceholderDataFunction,\n QueryFunction,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// This defines the `CreateQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.\n// `placeholderData` function does not have a parameter\ntype QueryObserverOptionsForCreateQueries<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>,\n 'placeholderData'\n> & {\n placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>\n}\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetOptions<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? QueryObserverOptionsForCreateQueries<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? QueryObserverOptionsForCreateQueries<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? QueryObserverOptionsForCreateQueries<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError,\n unknown extends TData ? TQueryFnData : TData,\n TQueryKey\n >\n : // Fallback\n QueryObserverOptionsForCreateQueries\n\ntype GetResults<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? QueryObserverResult<TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? QueryObserverResult<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? QueryObserverResult<TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? QueryObserverResult<TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? QueryObserverResult<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? QueryObserverResult<TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? QueryObserverResult<\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n QueryObserverResult\n\n/**\n * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n * @public\n */\nexport type QueriesOptions<\n T extends Array<any>,\n TResult extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<QueryObserverOptionsForCreateQueries>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResult, GetOptions<Head>]\n : T extends [infer Head, ...infer Tail]\n ? QueriesOptions<\n [...Tail],\n [...TResult, GetOptions<Head>],\n [...TDepth, 1]\n >\n : ReadonlyArray<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n QueryObserverOptionsForCreateQueries<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n QueryObserverOptionsForCreateQueries<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n >\n : // Fallback\n Array<QueryObserverOptionsForCreateQueries>\n\n/**\n * QueriesResults reducer recursively maps type param to results\n * @public\n */\nexport type QueriesResults<\n T extends Array<any>,\n TResult extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<QueryObserverResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResult, GetResults<Head>]\n : T extends [infer Head, ...infer Tail]\n ? QueriesResults<\n [...Tail],\n [...TResult, GetResults<Head>],\n [...TDepth, 1]\n >\n : T extends Array<\n QueryObserverOptionsForCreateQueries<\n infer TQueryFnData,\n infer TError,\n infer TData,\n any\n >\n >\n ? // Dynamic-size (homogenous) CreateQueryOptions array: map directly to array of results\n Array<\n QueryObserverResult<\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n >\n : // Fallback\n Array<QueryObserverResult>\n\n/**\n * @param root0\n * @param root0.queries\n * @param root0.combine\n * @param injector\n * @param injector\n * @public\n */\nexport function injectQueries<\n T extends Array<any>,\n TCombinedResult = QueriesResults<T>,\n>(\n {\n queries,\n ...options\n }: {\n queries: Signal<[...QueriesOptions<T>]>\n combine?: (result: QueriesResults<T>) => TCombinedResult\n },\n injector?: Injector,\n): Signal<TCombinedResult> {\n !injector && assertInInjectionContext(injectQueries)\n return runInInjectionContext(injector ?? inject(Injector), () => {\n const destroyRef = inject(DestroyRef)\n const ngZone = inject(NgZone)\n const queryClient = inject(QueryClient)\n const isRestoring = injectIsRestoring()\n\n const defaultedQueries = computed(() => {\n return queries().map((opts) => {\n const defaultedOptions = queryClient.defaultQueryOptions(opts)\n // Make sure the results are already in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring()\n ? 'isRestoring'\n : 'optimistic'\n\n return defaultedOptions as QueryObserverOptions\n })\n })\n\n const observer = new QueriesObserver<TCombinedResult>(\n queryClient,\n defaultedQueries(),\n options as QueriesObserverOptions<TCombinedResult>,\n )\n\n // Do not notify on updates because of changes in the options because\n // these changes should already be reflected in the optimistic result.\n effect(() => {\n observer.setQueries(\n defaultedQueries(),\n options as QueriesObserverOptions<TCombinedResult>,\n )\n })\n\n const [, getCombinedResult] = observer.getOptimisticResult(\n defaultedQueries(),\n (options as QueriesObserverOptions<TCombinedResult>).combine,\n )\n\n const result = signal(getCombinedResult() as any)\n\n effect(() => {\n const unsubscribe = isRestoring()\n ? () => undefined\n : ngZone.runOutsideAngular(() =>\n observer.subscribe(notifyManager.batchCalls(result.set)),\n )\n destroyRef.onDestroy(unsubscribe)\n })\n\n return result\n })\n}\n","import { QueryObserver } from '@tanstack/query-core'\nimport {\n Injector,\n assertInInjectionContext,\n inject,\n runInInjectionContext,\n} from '@angular/core'\nimport { createBaseQuery } from './create-base-query'\nimport type { DefaultError, QueryKey } from '@tanstack/query-core'\nimport type {\n CreateQueryOptions,\n CreateQueryResult,\n DefinedCreateQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n} from './query-options'\n\nexport interface InjectQueryOptions {\n /**\n * The `Injector` in which to create the query.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n *\n * **Basic example**\n * ```ts\n * class ServiceOrComponent {\n * query = injectQuery(() => ({\n * queryKey: ['repoData'],\n * queryFn: () =>\n * this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),\n * }))\n * }\n * ```\n *\n * Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.\n * In the example below, the query will be automatically enabled and executed when the filter signal changes\n * to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.\n *\n * **Reactive example**\n * ```ts\n * class ServiceOrComponent {\n * filter = signal('')\n *\n * todosQuery = injectQuery(() => ({\n * queryKey: ['todos', this.filter()],\n * queryFn: () => fetchTodos(this.filter()),\n * // Signals can be combined with expressions\n * enabled: !!this.filter(),\n * }))\n * }\n * ```\n * @param injectQueryFn - A function that returns query options.\n * @param options - Additional configuration\n * @returns The query result.\n * @public\n * @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries\n */\nexport function injectQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n injectQueryFn: () => DefinedInitialDataOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n options?: InjectQueryOptions,\n): DefinedCreateQueryResult<TData, TError>\n\n/**\n * Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n *\n * **Basic example**\n * ```ts\n * class ServiceOrComponent {\n * query = injectQuery(() => ({\n * queryKey: ['repoData'],\n * queryFn: () =>\n * this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),\n * }))\n * }\n * ```\n *\n * Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.\n * In the example below, the query will be automatically enabled and executed when the filter signal changes\n * to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.\n *\n * **Reactive example**\n * ```ts\n * class ServiceOrComponent {\n * filter = signal('')\n *\n * todosQuery = injectQuery(() => ({\n * queryKey: ['todos', this.filter()],\n * queryFn: () => fetchTodos(this.filter()),\n * // Signals can be combined with expressions\n * enabled: !!this.filter(),\n * }))\n * }\n * ```\n * @param injectQueryFn - A function that returns query options.\n * @param options - Additional configuration\n * @returns The query result.\n * @public\n * @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries\n */\nexport function injectQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n injectQueryFn: () => UndefinedInitialDataOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n options?: InjectQueryOptions,\n): CreateQueryResult<TData, TError>\n\n/**\n * Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n *\n * **Basic example**\n * ```ts\n * class ServiceOrComponent {\n * query = injectQuery(() => ({\n * queryKey: ['repoData'],\n * queryFn: () =>\n * this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),\n * }))\n * }\n * ```\n *\n * Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.\n * In the example below, the query will be automatically enabled and executed when the filter signal changes\n * to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.\n *\n * **Reactive example**\n * ```ts\n * class ServiceOrComponent {\n * filter = signal('')\n *\n * todosQuery = injectQuery(() => ({\n * queryKey: ['todos', this.filter()],\n * queryFn: () => fetchTodos(this.filter()),\n * // Signals can be combined with expressions\n * enabled: !!this.filter(),\n * }))\n * }\n * ```\n * @param injectQueryFn - A function that returns query options.\n * @param options - Additional configuration\n * @returns The query result.\n * @public\n * @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries\n */\nexport function injectQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n injectQueryFn: () => CreateQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n options?: InjectQueryOptions,\n): CreateQueryResult<TData, TError>\n\n/**\n * Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n *\n * **Basic example**\n * ```ts\n * class ServiceOrComponent {\n * query = injectQuery(() => ({\n * queryKey: ['repoData'],\n * queryFn: () =>\n * this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),\n * }))\n * }\n * ```\n *\n * Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.\n * In the example below, the query will be automatically enabled and executed when the filter signal changes\n * to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.\n *\n * **Reactive example**\n * ```ts\n * class ServiceOrComponent {\n * filter = signal('')\n *\n * todosQuery = injectQuery(() => ({\n * queryKey: ['todos', this.filter()],\n * queryFn: () => fetchTodos(this.filter()),\n * // Signals can be combined with expressions\n * enabled: !!this.filter(),\n * }))\n * }\n * ```\n * @param injectQueryFn - A function that returns query options.\n * @param options - Additional configuration\n * @returns The query result.\n * @public\n * @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries\n */\nexport function injectQuery(\n injectQueryFn: () => CreateQueryOptions,\n options?: InjectQueryOptions,\n) {\n !options?.injector && assertInInjectionContext(injectQuery)\n return runInInjectionContext(options?.injector ?? inject(Injector), () =>\n createBaseQuery(injectQueryFn, QueryObserver),\n ) as unknown as CreateQueryResult\n}\n","import { Injector, inject } from '@angular/core'\nimport { QueryClient } from '@tanstack/query-core'\nimport type { InjectOptions } from '@angular/core'\n\n/**\n * Injects a `QueryClient` instance and allows passing a custom injector.\n * @param injectOptions - Type of the options argument to inject and optionally a custom injector.\n * @returns The `QueryClient` instance.\n * @public\n * @deprecated Use `inject(QueryClient)` instead.\n * If you need to get a `QueryClient` from a custom injector, use `injector.get(QueryClient)`.\n *\n *\n * **Example**\n * ```ts\n * const queryClient = injectQueryClient();\n * ```\n */\nexport function injectQueryClient(\n injectOptions: InjectOptions & { injector?: Injector } = {},\n) {\n return (injectOptions.injector ?? inject(Injector)).get(QueryClient)\n}\n","import {\n DestroyRef,\n ENVIRONMENT_INITIALIZER,\n InjectionToken,\n PLATFORM_ID,\n computed,\n effect,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core'\nimport { QueryClient, onlineManager } from '@tanstack/query-core'\nimport { isPlatformBrowser } from '@angular/common'\nimport { isDevMode } from './util/is-dev-mode/is-dev-mode'\nimport { noop } from './util'\nimport type { EnvironmentProviders, Provider } from '@angular/core'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n TanstackQueryDevtools,\n} from '@tanstack/query-devtools'\n\n/**\n * Usually {@link provideTanStackQuery} is used once to set up TanStack Query and the\n * {@link https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient}\n * for the entire application. You can use `provideQueryClient` to provide a\n * different `QueryClient` instance for a part of the application.\n * @param queryClient - the `QueryClient` instance to provide.\n * @returns a provider object that can be used to provide the `QueryClient` instance.\n */\nexport function provideQueryClient(\n queryClient: QueryClient | InjectionToken<QueryClient>,\n): Provider {\n return {\n provide: QueryClient,\n useFactory: () => {\n return queryClient instanceof InjectionToken\n ? inject(queryClient)\n : queryClient\n },\n }\n}\n\n/**\n * Sets up providers necessary to enable TanStack Query functionality for Angular applications.\n *\n * Allows to configure a `QueryClient` and optional features such as developer tools.\n *\n * **Example - standalone**\n *\n * ```ts\n * import {\n * provideTanStackQuery,\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * bootstrapApplication(AppComponent, {\n * providers: [provideTanStackQuery(new QueryClient())],\n * })\n * ```\n *\n * **Example - NgModule-based**\n *\n * ```ts\n * import {\n * provideTanStackQuery,\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * @NgModule({\n * declarations: [AppComponent],\n * imports: [BrowserModule],\n * providers: [provideTanStackQuery(new QueryClient())],\n * bootstrap: [AppComponent],\n * })\n * export class AppModule {}\n * ```\n *\n * You can also enable optional developer tools by adding `withDevtools`. By\n * default the tools will then be loaded when your app is in development mode.\n * ```ts\n * import {\n * provideTanStackQuery,\n * withDevtools\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideTanStackQuery(new QueryClient(), withDevtools())\n * ]\n * }\n * )\n * ```\n * @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.\n * @param features - Optional features to configure additional Query functionality.\n * @returns A set of providers to set up TanStack Query.\n * @see https://tanstack.com/query/v5/docs/framework/angular/quick-start\n * @see withDevtools\n */\nexport function provideTanStackQuery(\n queryClient: QueryClient | InjectionToken<QueryClient>,\n ...features: Array<QueryFeatures>\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideQueryClient(queryClient),\n {\n // Do not use provideEnvironmentInitializer while Angular < v19 is supported\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory: () => {\n const client =\n queryClient instanceof InjectionToken\n ? inject(queryClient)\n : queryClient\n return () => {\n client.mount()\n // Unmount the query client on application destroy\n inject(DestroyRef).onDestroy(() => client.unmount())\n }\n },\n },\n features.map((feature) => feature.ɵproviders),\n ])\n}\n\n/**\n * Sets up providers necessary to enable TanStack Query functionality for Angular applications.\n *\n * Allows to configure a `QueryClient`.\n * @param queryClient - A `QueryClient` instance.\n * @returns A set of providers to set up TanStack Query.\n * @public\n * @see https://tanstack.com/query/v5/docs/framework/angular/quick-start\n * @deprecated Use `provideTanStackQuery` instead.\n */\nexport function provideAngularQuery(\n queryClient: QueryClient,\n): EnvironmentProviders {\n return provideTanStackQuery(queryClient)\n}\n\n/**\n * Helper type to represent a Query feature.\n */\nexport interface QueryFeature<TFeatureKind extends QueryFeatureKind> {\n ɵkind: TFeatureKind\n ɵproviders: Array<Provider>\n}\n\n/**\n * Helper function to create an object that represents a Query feature.\n * @param kind -\n * @param providers -\n * @returns A Query feature.\n */\nexport function queryFeature<TFeatureKind extends QueryFeatureKind>(\n kind: TFeatureKind,\n providers: Array<Provider>,\n): QueryFeature<TFeatureKind> {\n return { ɵkind: kind, ɵproviders: providers }\n}\n\n/**\n * A type alias that represents a feature which enables developer tools.\n * The type is used to describe the return value of the `withDevtools` function.\n * @public\n * @see {@link withDevtools}\n */\nexport type DeveloperToolsFeature = QueryFeature<'DeveloperTools'>\n\n/**\n * A type alias that represents a feature which enables persistence.\n * The type is used to describe the return value of the `withPersistQueryClient` function.\n * @public\n */\nexport type PersistQueryClientFeature = QueryFeature<'PersistQueryClient'>\n\n/**\n * Options for configuring the TanStack Query devtools.\n * @public\n */\nexport interface DevtoolsOptions {\n /**\n * Set this true if you want the devtools to default to being open\n */\n initialIsOpen?: boolean\n /**\n * The position of the TanStack logo to open and close the devtools panel.\n * `top-left` | `top-right` | `bottom-left` | `bottom-right` | `relative`\n * Defaults to `bottom-right`.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the TanStack Query devtools panel.\n * `top` | `bottom` | `left` | `right`\n * Defaults to `bottom`.\n */\n position?: DevtoolsPosition\n /**\n * Custom instance of QueryClient\n */\n client?: QueryClient\n /**\n * Use this so you can define custom errors that can be shown in the devtools.\n */\n errorTypes?: Array<DevtoolsErrorType>\n /**\n * 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.\n */\n styleNonce?: string\n /**\n * Use this so you can attach the devtool's styles to a specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n\n /**\n * Whether the developer tools should load.\n * - `auto`- (Default) Lazily loads devtools when in development mode. Skips loading in production mode.\n * - `true`- Always load the devtools, regardless of the environment.\n * - `false`- Never load the devtools, regardless of the environment.\n *\n * You can use `true` and `false` to override loading developer tools from an environment file.\n * For example, a test environment might run in production mode but you may want to load developer tools.\n *\n * Additionally, you can use a signal in the callback to dynamically load the devtools based on a condition. For example,\n * a signal created from a RxJS observable that listens for a keyboard shortcut.\n *\n * **Example**\n * ```ts\n * withDevtools(() => ({\n * initialIsOpen: true,\n * loadDevtools: inject(ExampleService).loadDevtools()\n * }))\n * ```\n */\n loadDevtools?: 'auto' | boolean\n}\n\n/**\n * Enables developer tools.\n *\n * **Example**\n *\n * ```ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideTanStackQuery(new QueryClient(), withDevtools())\n * ]\n * }\n * ```\n * By default the devtools will be loaded when Angular runs in development mode and rendered in `<body>`.\n *\n * 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.\n *\n * If you need more control over where devtools are rendered, consider `injectDevtoolsPanel`. This allows rendering devtools inside your own devtools for example.\n * @param withDevtoolsFn - A function that returns `DevtoolsOptions`.\n * @returns A set of providers for use with `provideTanStackQuery`.\n * @public\n * @see {@link provideTanStackQuery}\n * @see {@link DevtoolsOptions}\n */\nexport function withDevtools(\n withDevtoolsFn?: () => DevtoolsOptions,\n): DeveloperToolsFeature {\n let providers: Array<Provider> = []\n if (!isDevMode() && !withDevtoolsFn) {\n providers = []\n } else {\n providers = [\n {\n // Do not use provideEnvironmentInitializer while Angular < v19 is supported\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory: () => {\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return noop\n const injectedClient = inject(QueryClient, {\n optional: true,\n })\n const destroyRef = inject(DestroyRef)\n\n const options = computed(() => withDevtoolsFn?.() ?? {})\n\n let devtools: TanstackQueryDevtools | null = null\n let el: HTMLElement | null = null\n\n const shouldLoadToolsSignal = computed(() => {\n const { loadDevtools } = options()\n return typeof loadDevtools === 'boolean'\n ? loadDevtools\n : isDevMode()\n })\n\n const getResolvedQueryClient = () => {\n const client = options().client ?? injectedClient\n if (!client) {\n throw new Error('No QueryClient found')\n }\n return client\n }\n\n const destroyDevtools = () => {\n devtools?.unmount()\n el?.remove()\n devtools = null\n }\n\n return () =>\n effect(() => {\n const shouldLoadTools = shouldLoadToolsSignal()\n const {\n client,\n position,\n errorTypes,\n buttonPosition,\n initialIsOpen,\n } = options()\n\n if (devtools && !shouldLoadTools) {\n destroyDevtools()\n return\n } else if (devtools && shouldLoadTools) {\n client && devtools.setClient(client)\n position && devtools.setPosition(position)\n errorTypes && devtools.setErrorTypes(errorTypes)\n buttonPosition && devtools.setButtonPosition(buttonPosition)\n initialIsOpen && devtools.setInitialIsOpen(initialIsOpen)\n return\n } else if (!shouldLoadTools) {\n return\n }\n\n el = document.body.appendChild(document.createElement('div'))\n el.classList.add('tsqd-parent-container')\n\n import('@tanstack/query-devtools').then((queryDevtools) => {\n devtools = new queryDevtools.TanstackQueryDevtools({\n ...options(),\n client: getResolvedQueryClient(),\n queryFlavor: 'Angular Query',\n version: '5',\n onlineManager,\n })\n\n el && devtools.mount(el)\n\n // Unmount the devtools on application destroy\n destroyRef.onDestroy(destroyDevtools)\n })\n })\n },\n },\n ]\n }\n return queryFeature('DeveloperTools', providers)\n}\n\n/**\n * A type alias that represents all Query features available for use with `provideTanStackQuery`.\n * Features can be enabled by adding special functions to the `provideTanStackQuery` call.\n * See documentation for each symbol to find corresponding function name. See also `provideTanStackQuery`\n * documentation on how to use those functions.\n * @public\n * @see {@link provideTanStackQuery}\n */\nexport type QueryFeatures = DeveloperToolsFeature | PersistQueryClientFeature\n\nexport const queryFeatures = ['DeveloperTools', 'PersistQueryClient'] as const\n\nexport type QueryFeatureKind = (typeof queryFeatures)[number]\n","// Re-export for mocking in tests\n\nexport { isDevMode } from '@angular/core'\n"],"mappings":";AAGA,cAAc;;;AC6KP,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;;;AC7IO,SAAS,gBAMd,SAC4D;AAC5D,SAAO;AACT;;;AC+IO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;;;AC/LA,SAAS,6BAA6B;AACtC;AAAA,EACE,YAAAA;AAAA,EACA,4BAAAC;AAAA,EACA,UAAAC;AAAA,EACA;AAAA,OACK;;;ACNP;AAAA,EACE;AAAA,EACA;AAAA,EACA,YAAAC;AAAA,EACA;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACbP,SAAS,UAAU,iBAAiB;AAa7B,SAAS,YACd,aACA;AACA,QAAM,gBAAgB,CAAC;AA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jD;AAYO,IAAM,gBAAgB,CAAC,kBAAkB,oBAAoB;","names":["Injector","assertInInjectionContext","inject","computed","inject","signal","untracked","inject","computed","signal","untracked","assertInInjectionContext","inject","Injector","Injector","NgZone","assertInInjectionContext","inject","signal","QueryClient","notifyManager","DestroyRef","Injector","NgZone","assertInInjectionContext","inject","signal","QueryClient","notifyManager","DestroyRef","Injector","NgZone","assertInInjectionContext","computed","effect","inject","signal","untracked","QueryClient","notifyManager","shouldThrowError","assertInInjectionContext","inject","Injector","DestroyRef","NgZone","QueryClient","computed","signal","effect","untracked","notifyManager","shouldThrowError","DestroyRef","Injector","NgZone","assertInInjectionContext","computed","inject","signal","QueryClient","notifyManager","QueryClient","notifyManager","DestroyRef","Injector","NgZone","assertInInjectionContext","computed","effect","inject","runInInjectionContext","signal","assertInInjectionContext","runInInjectionContext","inject","Injector","DestroyRef","NgZone","QueryClient","computed","effect","signal","notifyManager","Injector","assertInInjectionContext","inject","runInInjectionContext","assertInInjectionContext","runInInjectionContext","inject","Injector","Injector","inject","QueryClient","DestroyRef","InjectionToken","computed","effect","inject","QueryClient","QueryClient","InjectionToken","inject","DestroyRef","inject","QueryClient","DestroyRef","computed","effect"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/query-options.ts","../src/mutation-options.ts","../src/infinite-query-options.ts","../src/inject-infinite-query.ts","../src/create-base-query.ts","../src/signal-proxy.ts","../src/inject-is-restoring.ts","../src/inject-is-fetching.ts","../src/inject-is-mutating.ts","../src/inject-mutation.ts","../src/util/index.ts","../src/inject-mutation-state.ts","../src/inject-queries.ts","../src/inject-query.ts","../src/inject-query-client.ts","../src/providers.ts","../src/util/is-dev-mode/is-dev-mode.ts"],"sourcesContent":["/* istanbul ignore file */\n\n// Re-export core\nexport * from '@tanstack/query-core'\n\nexport * from './types'\n\nexport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n UnusedSkipTokenOptions,\n} from './query-options'\nexport { queryOptions } from './query-options'\n\nexport type { CreateMutationOptions } from './mutation-options'\nexport { mutationOptions } from './mutation-options'\n\nexport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n UnusedSkipTokenInfiniteOptions,\n} from './infinite-query-options'\nexport { infiniteQueryOptions } from './infinite-query-options'\n\nexport type { InjectInfiniteQueryOptions } from './inject-infinite-query'\nexport { injectInfiniteQuery } from './inject-infinite-query'\n\nexport type { InjectIsFetchingOptions } from './inject-is-fetching'\nexport { injectIsFetching } from './inject-is-fetching'\n\nexport type { InjectIsMutatingOptions } from './inject-is-mutating'\nexport { injectIsMutating } from './inject-is-mutating'\n\nexport { injectIsRestoring, provideIsRestoring } from './inject-is-restoring'\n\nexport type { InjectMutationOptions } from './inject-mutation'\nexport { injectMutation } from './inject-mutation'\n\nexport type { InjectMutationStateOptions } from './inject-mutation-state'\nexport { injectMutationState } from './inject-mutation-state'\n\nexport type { QueriesOptions, QueriesResults } from './inject-queries'\nexport { injectQueries } from './inject-queries'\n\nexport type { InjectQueryOptions } from './inject-query'\nexport { injectQuery } from './inject-query'\n\nexport { injectQueryClient } from './inject-query-client'\n\nexport type {\n DeveloperToolsFeature,\n DevtoolsOptions,\n PersistQueryClientFeature,\n QueryFeature,\n QueryFeatureKind,\n QueryFeatures,\n} from './providers'\nexport {\n provideQueryClient,\n provideTanStackQuery,\n queryFeature,\n queryFeatures,\n withDevtools,\n} from './providers'\n","import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { CreateQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\ntype NonUndefinedGuard<T> = T extends undefined ? never : T\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions(options: unknown) {\n return options\n}\n","import type {\n DefaultError,\n MutationObserverOptions,\n OmitKeyof,\n} from '@tanstack/query-core'\n\n/**\n * Allows to share and re-use mutation options in a type-safe way.\n *\n * **Example**\n *\n * ```ts\n * export class QueriesService {\n * private http = inject(HttpClient);\n *\n * updatePost(id: number) {\n * return mutationOptions({\n * mutationFn: (post: Post) => Promise.resolve(post),\n * mutationKey: [\"updatePost\", id],\n * onSuccess: (newPost) => {\n * // ^? newPost: Post\n * this.queryClient.setQueryData([\"posts\", id], newPost);\n * },\n * });\n * }\n * }\n *\n * queries = inject(QueriesService)\n * idSignal = new Signal(0);\n * mutation = injectMutation(() => this.queries.updatePost(this.idSignal()))\n *\n * mutation.mutate({ title: 'New Title' })\n * ```\n * @param options - The mutation options.\n * @returns Mutation options.\n * @public\n */\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n>(\n options: MutationObserverOptions<TData, TError, TVariables, TContext>,\n): CreateMutationOptions<TData, TError, TVariables, TContext> {\n return options\n}\n\n/**\n * @public\n */\nexport interface CreateMutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n> extends OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TContext>,\n '_defaulted'\n > {}\n","import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n OmitKeyof,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { CreateInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n> & {\n initialData?:\n | undefined\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\ntype NonUndefinedGuard<T> = T extends undefined ? never : T\n\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n> & {\n initialData:\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n * @public\n */\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n * @public\n */\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n * @public\n */\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n * @public\n */\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n","import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport {\n Injector,\n assertInInjectionContext,\n inject,\n runInInjectionContext,\n} from '@angular/core'\nimport { createBaseQuery } from './create-base-query'\nimport type {\n DefaultError,\n InfiniteData,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n CreateInfiniteQueryOptions,\n CreateInfiniteQueryResult,\n DefinedCreateInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infinite-query-options'\n\nexport interface InjectInfiniteQueryOptions {\n /**\n * The `Injector` in which to create the infinite query.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n * @public\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): DefinedCreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n * @public\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): CreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n * @public\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): CreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n * @public\n */\nexport function injectInfiniteQuery(\n injectInfiniteQueryFn: () => CreateInfiniteQueryOptions,\n options?: InjectInfiniteQueryOptions,\n) {\n !options?.injector && assertInInjectionContext(injectInfiniteQuery)\n const injector = options?.injector ?? inject(Injector)\n return runInInjectionContext(injector, () =>\n createBaseQuery(\n injectInfiniteQueryFn,\n InfiniteQueryObserver as typeof QueryObserver,\n ),\n )\n}\n","import {\n NgZone,\n VERSION,\n computed,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core'\nimport {\n QueryClient,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { signalProxy } from './signal-proxy'\nimport { injectIsRestoring } from './inject-is-restoring'\nimport type {\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { CreateBaseQueryOptions } from './types'\n\n/**\n * Base implementation for `injectQuery` and `injectInfiniteQuery`.\n * @param optionsFn\n * @param Observer\n */\nexport function createBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n optionsFn: () => CreateBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n) {\n const ngZone = inject(NgZone)\n const queryClient = inject(QueryClient)\n const isRestoring = injectIsRestoring()\n\n /**\n * Signal that has the default options from query client applied\n * computed() is used so signals can be inserted into the options\n * making it reactive. Wrapping options in a function ensures embedded expressions\n * are preserved and can keep being applied after signal changes\n */\n const defaultedOptionsSignal = computed(() => {\n const defaultedOptions = queryClient.defaultQueryOptions(optionsFn())\n defaultedOptions._optimisticResults = isRestoring()\n ? 'isRestoring'\n : 'optimistic'\n return defaultedOptions\n })\n\n const observerSignal = (() => {\n let instance: QueryObserver<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n > | null = null\n\n return computed(() => {\n return (instance ||= new Observer(queryClient, defaultedOptionsSignal()))\n })\n })()\n\n const optimisticResultSignal = computed(() =>\n observerSignal().getOptimisticResult(defaultedOptionsSignal()),\n )\n\n const resultFromSubscriberSignal = signal<QueryObserverResult<\n TData,\n TError\n > | null>(null)\n\n effect(\n (onCleanup) => {\n const observer = observerSignal()\n const defaultedOptions = defaultedOptionsSignal()\n\n untracked(() => {\n observer.setOptions(defaultedOptions)\n })\n onCleanup(() => {\n ngZone.run(() => resultFromSubscriberSignal.set(null))\n })\n },\n {\n // Set allowSignalWrites to support Angular < v19\n // Set to undefined to avoid warning on newer versions\n allowSignalWrites: VERSION.major < '19' || undefined,\n },\n )\n\n effect((onCleanup) => {\n // observer.trackResult is not used as this optimization is not needed for Angular\n const observer = observerSignal()\n const unsubscribe = isRestoring()\n ? () => undefined\n : untracked(() =>\n ngZone.runOutsideAngular(() =>\n observer.subscribe(\n notifyManager.batchCalls((state) => {\n ngZone.run(() => {\n if (\n state.isError &&\n !state.isFetching &&\n shouldThrowError(observer.options.throwOnError, [\n state.error,\n observer.getCurrentQuery(),\n ])\n ) {\n ngZone.onError.emit(state.error)\n throw state.error\n }\n resultFromSubscriberSignal.set(state)\n })\n }),\n ),\n ),\n )\n onCleanup(unsubscribe)\n })\n\n return signalProxy(\n computed(() => {\n const subscriberResult = resultFromSubscriberSignal()\n const optimisticResult = optimisticResultSignal()\n return subscriberResult ?? optimisticResult\n }),\n )\n}\n","import { computed, untracked } from '@angular/core'\nimport type { Signal } from '@angular/core'\n\nexport type MapToSignals<T> = {\n [K in keyof T]: T[K] extends Function ? T[K] : Signal<T[K]>\n}\n\n/**\n * Exposes fields of an object passed via an Angular `Signal` as `Computed` signals.\n * Functions on the object are passed through as-is.\n * @param inputSignal - `Signal` that must return an object.\n * @returns A proxy object with the same fields as the input object, but with each field wrapped in a `Computed` signal.\n */\nexport function signalProxy<TInput extends Record<string | symbol, any>>(\n inputSignal: Signal<TInput>,\n) {\n const internalState = {} as MapToSignals<TInput>\n\n return new Proxy<MapToSignals<TInput>>(internalState, {\n get(target, prop) {\n // first check if we have it in our internal state and return it\n const computedField = target[prop]\n if (computedField) return computedField\n\n // then, check if it's a function on the resultState and return it\n const targetField = untracked(inputSignal)[prop]\n if (typeof targetField === 'function') return targetField\n\n // finally, create a computed field, store it and return it\n // @ts-expect-error\n return (target[prop] = computed(() => inputSignal()[prop]))\n },\n has(_, prop) {\n return !!untracked(inputSignal)[prop]\n },\n ownKeys() {\n return Reflect.ownKeys(untracked(inputSignal))\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n }\n },\n })\n}\n","import {\n InjectionToken,\n Injector,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport type { Provider, Signal } from '@angular/core'\n\nconst IS_RESTORING = new InjectionToken(\n typeof ngDevMode === 'undefined' || ngDevMode\n ? 'TANSTACK_QUERY_IS_RESTORING'\n : '',\n {\n // Default value when not provided\n factory: () => signal(false).asReadonly(),\n },\n)\n\n/**\n * The `Injector` in which to create the isRestoring signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\ninterface InjectIsRestoringOptions {\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks whether a restore is currently in progress. {@link injectQuery} and friends also check this internally to avoid race conditions between the restore and initializing queries.\n * @param options - Options for injectIsRestoring.\n * @returns signal with boolean that indicates whether a restore is in progress.\n * @public\n */\nexport function injectIsRestoring(options?: InjectIsRestoringOptions) {\n !options?.injector && assertInInjectionContext(injectIsRestoring)\n const injector = options?.injector ?? inject(Injector)\n return injector.get(IS_RESTORING)\n}\n\n/**\n * Used by TanStack Query Angular persist client plugin to provide the signal that tracks the restore state\n * @param isRestoring - a readonly signal that returns a boolean\n * @returns Provider for the `isRestoring` signal\n * @public\n */\nexport function provideIsRestoring(isRestoring: Signal<boolean>): Provider {\n return {\n provide: IS_RESTORING,\n useValue: isRestoring,\n }\n}\n","import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport { QueryClient, notifyManager } from '@tanstack/query-core'\nimport type { QueryFilters } from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\n\nexport interface InjectIsFetchingOptions {\n /**\n * The `Injector` in which to create the isFetching signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the number of queries that your application is loading or\n * fetching in the background.\n *\n * Can be used for app-wide loading indicators\n * @param filters - The filters to apply to the query.\n * @param options - Additional configuration\n * @returns signal with number of loading or fetching queries.\n * @public\n */\nexport function injectIsFetching(\n filters?: QueryFilters,\n options?: InjectIsFetchingOptions,\n): Signal<number> {\n !options?.injector && assertInInjectionContext(injectIsFetching)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n\n const cache = queryClient.getQueryCache()\n // isFetching is the prev value initialized on mount *\n let isFetching = queryClient.isFetching(filters)\n\n const result = signal(isFetching)\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n cache.subscribe(\n notifyManager.batchCalls(() => {\n const newIsFetching = queryClient.isFetching(filters)\n if (isFetching !== newIsFetching) {\n // * and update with each change\n isFetching = newIsFetching\n ngZone.run(() => {\n result.set(isFetching)\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return result\n}\n","import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport { QueryClient, notifyManager } from '@tanstack/query-core'\nimport type { MutationFilters } from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\n\nexport interface InjectIsMutatingOptions {\n /**\n * The `Injector` in which to create the isMutating signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the number of mutations that your application is fetching.\n *\n * Can be used for app-wide loading indicators\n * @param filters - The filters to apply to the query.\n * @param options - Additional configuration\n * @returns signal with number of fetching mutations.\n * @public\n */\nexport function injectIsMutating(\n filters?: MutationFilters,\n options?: InjectIsMutatingOptions,\n): Signal<number> {\n !options?.injector && assertInInjectionContext(injectIsMutating)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n\n const cache = queryClient.getMutationCache()\n // isMutating is the prev value initialized on mount *\n let isMutating = queryClient.isMutating(filters)\n\n const result = signal(isMutating)\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n cache.subscribe(\n notifyManager.batchCalls(() => {\n const newIsMutating = queryClient.isMutating(filters)\n if (isMutating !== newIsMutating) {\n // * and update with each change\n isMutating = newIsMutating\n ngZone.run(() => {\n result.set(isMutating)\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return result\n}\n","import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n computed,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core'\nimport {\n MutationObserver,\n QueryClient,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { signalProxy } from './signal-proxy'\nimport { noop } from './util'\nimport type { DefaultError, MutationObserverResult } from '@tanstack/query-core'\nimport type { CreateMutateFunction, CreateMutationResult } from './types'\nimport type { CreateMutationOptions } from './mutation-options'\n\nexport interface InjectMutationOptions {\n /**\n * The `Injector` in which to create the mutation.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a mutation: an imperative function that can be invoked which typically performs server side effects.\n *\n * Unlike queries, mutations are not run automatically.\n * @param injectMutationFn - A function that returns mutation options.\n * @param options - Additional configuration\n * @returns The mutation.\n * @public\n */\nexport function injectMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n>(\n injectMutationFn: () => CreateMutationOptions<\n TData,\n TError,\n TVariables,\n TContext\n >,\n options?: InjectMutationOptions,\n): CreateMutationResult<TData, TError, TVariables, TContext> {\n !options?.injector && assertInInjectionContext(injectMutation)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n\n /**\n * computed() is used so signals can be inserted into the options\n * making it reactive. Wrapping options in a function ensures embedded expressions\n * are preserved and can keep being applied after signal changes\n */\n const optionsSignal = computed(injectMutationFn)\n\n const observerSignal = (() => {\n let instance: MutationObserver<TData, TError, TVariables, TContext> | null =\n null\n\n return computed(() => {\n return (instance ||= new MutationObserver(queryClient, optionsSignal()))\n })\n })()\n\n const mutateFnSignal = computed<\n CreateMutateFunction<TData, TError, TVariables, TContext>\n >(() => {\n const observer = observerSignal()\n return (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop)\n }\n })\n\n /**\n * Computed signal that gets result from mutation cache based on passed options\n */\n const resultFromInitialOptionsSignal = computed(() => {\n const observer = observerSignal()\n return observer.getCurrentResult()\n })\n\n /**\n * Signal that contains result set by subscriber\n */\n const resultFromSubscriberSignal = signal<MutationObserverResult<\n TData,\n TError,\n TVariables,\n TContext\n > | null>(null)\n\n effect(\n () => {\n const observer = observerSignal()\n const observerOptions = optionsSignal()\n\n untracked(() => {\n observer.setOptions(observerOptions)\n })\n },\n {\n injector,\n },\n )\n\n effect(\n () => {\n // observer.trackResult is not used as this optimization is not needed for Angular\n const observer = observerSignal()\n\n untracked(() => {\n const unsubscribe = ngZone.runOutsideAngular(() =>\n observer.subscribe(\n notifyManager.batchCalls((state) => {\n ngZone.run(() => {\n if (\n state.isError &&\n shouldThrowError(observer.options.throwOnError, [state.error])\n ) {\n ngZone.onError.emit(state.error)\n throw state.error\n }\n\n resultFromSubscriberSignal.set(state)\n })\n }),\n ),\n )\n destroyRef.onDestroy(unsubscribe)\n })\n },\n {\n injector,\n },\n )\n\n const resultSignal = computed(() => {\n const resultFromSubscriber = resultFromSubscriberSignal()\n const resultFromInitialOptions = resultFromInitialOptionsSignal()\n\n const result = resultFromSubscriber ?? resultFromInitialOptions\n\n return {\n ...result,\n mutate: mutateFnSignal(),\n mutateAsync: result.mutate,\n }\n })\n\n return signalProxy(resultSignal) as CreateMutationResult<\n TData,\n TError,\n TVariables,\n TContext\n >\n}\n","export function noop(): void {}\n","import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n computed,\n inject,\n signal,\n} from '@angular/core'\nimport {\n QueryClient,\n notifyManager,\n replaceEqualDeep,\n} from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\nimport type {\n Mutation,\n MutationCache,\n MutationFilters,\n MutationState,\n} from '@tanstack/query-core'\n\ntype MutationStateOptions<TResult = MutationState> = {\n filters?: MutationFilters\n select?: (mutation: Mutation) => TResult\n}\n\n/**\n *\n * @param mutationCache\n * @param options\n */\nfunction getResult<TResult = MutationState>(\n mutationCache: MutationCache,\n options: MutationStateOptions<TResult>,\n): Array<TResult> {\n return mutationCache\n .findAll(options.filters)\n .map(\n (mutation): TResult =>\n (options.select ? options.select(mutation) : mutation.state) as TResult,\n )\n}\n\n/**\n * @public\n */\nexport interface InjectMutationStateOptions {\n /**\n * The `Injector` in which to create the mutation state signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the state of all mutations.\n * @param injectMutationStateFn - A function that returns mutation state options.\n * @param options - The Angular injector to use.\n * @returns The signal that tracks the state of all mutations.\n * @public\n */\nexport function injectMutationState<TResult = MutationState>(\n injectMutationStateFn: () => MutationStateOptions<TResult> = () => ({}),\n options?: InjectMutationStateOptions,\n): Signal<Array<TResult>> {\n !options?.injector && assertInInjectionContext(injectMutationState)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n const mutationCache = queryClient.getMutationCache()\n\n /**\n * Computed signal that gets result from mutation cache based on passed options\n * First element is the result, second element is the time when the result was set\n */\n const resultFromOptionsSignal = computed(() => {\n return [\n getResult(mutationCache, injectMutationStateFn()),\n performance.now(),\n ] as const\n })\n\n /**\n * Signal that contains result set by subscriber\n * First element is the result, second element is the time when the result was set\n */\n const resultFromSubscriberSignal = signal<[Array<TResult>, number] | null>(\n null,\n )\n\n /**\n * Returns the last result by either subscriber or options\n */\n const effectiveResultSignal = computed(() => {\n const optionsResult = resultFromOptionsSignal()\n const subscriberResult = resultFromSubscriberSignal()\n return subscriberResult && subscriberResult[1] > optionsResult[1]\n ? subscriberResult[0]\n : optionsResult[0]\n })\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n mutationCache.subscribe(\n notifyManager.batchCalls(() => {\n const [lastResult] = effectiveResultSignal()\n const nextResult = replaceEqualDeep(\n lastResult,\n getResult(mutationCache, injectMutationStateFn()),\n )\n if (lastResult !== nextResult) {\n ngZone.run(() => {\n resultFromSubscriberSignal.set([nextResult, performance.now()])\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return effectiveResultSignal\n}\n","import {\n QueriesObserver,\n QueryClient,\n notifyManager,\n} from '@tanstack/query-core'\nimport {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n computed,\n effect,\n inject,\n runInInjectionContext,\n signal,\n} from '@angular/core'\nimport { injectIsRestoring } from './inject-is-restoring'\nimport type { Signal } from '@angular/core'\nimport type {\n DefaultError,\n OmitKeyof,\n QueriesObserverOptions,\n QueriesPlaceholderDataFunction,\n QueryFunction,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// This defines the `CreateQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.\n// `placeholderData` function does not have a parameter\ntype QueryObserverOptionsForCreateQueries<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>,\n 'placeholderData'\n> & {\n placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>\n}\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetOptions<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? QueryObserverOptionsForCreateQueries<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? QueryObserverOptionsForCreateQueries<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? QueryObserverOptionsForCreateQueries<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? QueryObserverOptionsForCreateQueries<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError,\n unknown extends TData ? TQueryFnData : TData,\n TQueryKey\n >\n : // Fallback\n QueryObserverOptionsForCreateQueries\n\ntype GetResults<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? QueryObserverResult<TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? QueryObserverResult<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? QueryObserverResult<TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? QueryObserverResult<TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? QueryObserverResult<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? QueryObserverResult<TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? QueryObserverResult<\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n QueryObserverResult\n\n/**\n * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n * @public\n */\nexport type QueriesOptions<\n T extends Array<any>,\n TResult extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<QueryObserverOptionsForCreateQueries>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResult, GetOptions<Head>]\n : T extends [infer Head, ...infer Tail]\n ? QueriesOptions<\n [...Tail],\n [...TResult, GetOptions<Head>],\n [...TDepth, 1]\n >\n : ReadonlyArray<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n QueryObserverOptionsForCreateQueries<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n QueryObserverOptionsForCreateQueries<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n >\n : // Fallback\n Array<QueryObserverOptionsForCreateQueries>\n\n/**\n * QueriesResults reducer recursively maps type param to results\n * @public\n */\nexport type QueriesResults<\n T extends Array<any>,\n TResult extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<QueryObserverResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResult, GetResults<Head>]\n : T extends [infer Head, ...infer Tail]\n ? QueriesResults<\n [...Tail],\n [...TResult, GetResults<Head>],\n [...TDepth, 1]\n >\n : T extends Array<\n QueryObserverOptionsForCreateQueries<\n infer TQueryFnData,\n infer TError,\n infer TData,\n any\n >\n >\n ? // Dynamic-size (homogenous) CreateQueryOptions array: map directly to array of results\n Array<\n QueryObserverResult<\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n >\n : // Fallback\n Array<QueryObserverResult>\n\n/**\n * @param root0\n * @param root0.queries\n * @param root0.combine\n * @param injector\n * @param injector\n * @public\n */\nexport function injectQueries<\n T extends Array<any>,\n TCombinedResult = QueriesResults<T>,\n>(\n {\n queries,\n ...options\n }: {\n queries: Signal<[...QueriesOptions<T>]>\n combine?: (result: QueriesResults<T>) => TCombinedResult\n },\n injector?: Injector,\n): Signal<TCombinedResult> {\n !injector && assertInInjectionContext(injectQueries)\n return runInInjectionContext(injector ?? inject(Injector), () => {\n const destroyRef = inject(DestroyRef)\n const ngZone = inject(NgZone)\n const queryClient = inject(QueryClient)\n const isRestoring = injectIsRestoring()\n\n const defaultedQueries = computed(() => {\n return queries().map((opts) => {\n const defaultedOptions = queryClient.defaultQueryOptions(opts)\n // Make sure the results are already in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring()\n ? 'isRestoring'\n : 'optimistic'\n\n return defaultedOptions as QueryObserverOptions\n })\n })\n\n const observer = new QueriesObserver<TCombinedResult>(\n queryClient,\n defaultedQueries(),\n options as QueriesObserverOptions<TCombinedResult>,\n )\n\n // Do not notify on updates because of changes in the options because\n // these changes should already be reflected in the optimistic result.\n effect(() => {\n observer.setQueries(\n defaultedQueries(),\n options as QueriesObserverOptions<TCombinedResult>,\n )\n })\n\n const [, getCombinedResult] = observer.getOptimisticResult(\n defaultedQueries(),\n (options as QueriesObserverOptions<TCombinedResult>).combine,\n )\n\n const result = signal(getCombinedResult() as any)\n\n effect(() => {\n const unsubscribe = isRestoring()\n ? () => undefined\n : ngZone.runOutsideAngular(() =>\n observer.subscribe(notifyManager.batchCalls(result.set)),\n )\n destroyRef.onDestroy(unsubscribe)\n })\n\n return result\n })\n}\n","import { QueryObserver } from '@tanstack/query-core'\nimport {\n Injector,\n assertInInjectionContext,\n inject,\n runInInjectionContext,\n} from '@angular/core'\nimport { createBaseQuery } from './create-base-query'\nimport type { DefaultError, QueryKey } from '@tanstack/query-core'\nimport type {\n CreateQueryOptions,\n CreateQueryResult,\n DefinedCreateQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n} from './query-options'\n\nexport interface InjectQueryOptions {\n /**\n * The `Injector` in which to create the query.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n *\n * **Basic example**\n * ```ts\n * class ServiceOrComponent {\n * query = injectQuery(() => ({\n * queryKey: ['repoData'],\n * queryFn: () =>\n * this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),\n * }))\n * }\n * ```\n *\n * Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.\n * In the example below, the query will be automatically enabled and executed when the filter signal changes\n * to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.\n *\n * **Reactive example**\n * ```ts\n * class ServiceOrComponent {\n * filter = signal('')\n *\n * todosQuery = injectQuery(() => ({\n * queryKey: ['todos', this.filter()],\n * queryFn: () => fetchTodos(this.filter()),\n * // Signals can be combined with expressions\n * enabled: !!this.filter(),\n * }))\n * }\n * ```\n * @param injectQueryFn - A function that returns query options.\n * @param options - Additional configuration\n * @returns The query result.\n * @public\n * @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries\n */\nexport function injectQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n injectQueryFn: () => DefinedInitialDataOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n options?: InjectQueryOptions,\n): DefinedCreateQueryResult<TData, TError>\n\n/**\n * Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n *\n * **Basic example**\n * ```ts\n * class ServiceOrComponent {\n * query = injectQuery(() => ({\n * queryKey: ['repoData'],\n * queryFn: () =>\n * this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),\n * }))\n * }\n * ```\n *\n * Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.\n * In the example below, the query will be automatically enabled and executed when the filter signal changes\n * to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.\n *\n * **Reactive example**\n * ```ts\n * class ServiceOrComponent {\n * filter = signal('')\n *\n * todosQuery = injectQuery(() => ({\n * queryKey: ['todos', this.filter()],\n * queryFn: () => fetchTodos(this.filter()),\n * // Signals can be combined with expressions\n * enabled: !!this.filter(),\n * }))\n * }\n * ```\n * @param injectQueryFn - A function that returns query options.\n * @param options - Additional configuration\n * @returns The query result.\n * @public\n * @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries\n */\nexport function injectQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n injectQueryFn: () => UndefinedInitialDataOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n options?: InjectQueryOptions,\n): CreateQueryResult<TData, TError>\n\n/**\n * Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n *\n * **Basic example**\n * ```ts\n * class ServiceOrComponent {\n * query = injectQuery(() => ({\n * queryKey: ['repoData'],\n * queryFn: () =>\n * this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),\n * }))\n * }\n * ```\n *\n * Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.\n * In the example below, the query will be automatically enabled and executed when the filter signal changes\n * to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.\n *\n * **Reactive example**\n * ```ts\n * class ServiceOrComponent {\n * filter = signal('')\n *\n * todosQuery = injectQuery(() => ({\n * queryKey: ['todos', this.filter()],\n * queryFn: () => fetchTodos(this.filter()),\n * // Signals can be combined with expressions\n * enabled: !!this.filter(),\n * }))\n * }\n * ```\n * @param injectQueryFn - A function that returns query options.\n * @param options - Additional configuration\n * @returns The query result.\n * @public\n * @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries\n */\nexport function injectQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n injectQueryFn: () => CreateQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n options?: InjectQueryOptions,\n): CreateQueryResult<TData, TError>\n\n/**\n * Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n *\n * **Basic example**\n * ```ts\n * class ServiceOrComponent {\n * query = injectQuery(() => ({\n * queryKey: ['repoData'],\n * queryFn: () =>\n * this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),\n * }))\n * }\n * ```\n *\n * Similar to `computed` from Angular, the function passed to `injectQuery` will be run in the reactive context.\n * In the example below, the query will be automatically enabled and executed when the filter signal changes\n * to a truthy value. When the filter signal changes back to a falsy value, the query will be disabled.\n *\n * **Reactive example**\n * ```ts\n * class ServiceOrComponent {\n * filter = signal('')\n *\n * todosQuery = injectQuery(() => ({\n * queryKey: ['todos', this.filter()],\n * queryFn: () => fetchTodos(this.filter()),\n * // Signals can be combined with expressions\n * enabled: !!this.filter(),\n * }))\n * }\n * ```\n * @param injectQueryFn - A function that returns query options.\n * @param options - Additional configuration\n * @returns The query result.\n * @public\n * @see https://tanstack.com/query/latest/docs/framework/angular/guides/queries\n */\nexport function injectQuery(\n injectQueryFn: () => CreateQueryOptions,\n options?: InjectQueryOptions,\n) {\n !options?.injector && assertInInjectionContext(injectQuery)\n return runInInjectionContext(options?.injector ?? inject(Injector), () =>\n createBaseQuery(injectQueryFn, QueryObserver),\n ) as unknown as CreateQueryResult\n}\n","import { Injector, inject } from '@angular/core'\nimport { QueryClient } from '@tanstack/query-core'\nimport type { InjectOptions } from '@angular/core'\n\n/**\n * Injects a `QueryClient` instance and allows passing a custom injector.\n * @param injectOptions - Type of the options argument to inject and optionally a custom injector.\n * @returns The `QueryClient` instance.\n * @public\n * @deprecated Use `inject(QueryClient)` instead.\n * If you need to get a `QueryClient` from a custom injector, use `injector.get(QueryClient)`.\n *\n *\n * **Example**\n * ```ts\n * const queryClient = injectQueryClient();\n * ```\n */\nexport function injectQueryClient(\n injectOptions: InjectOptions & { injector?: Injector } = {},\n) {\n return (injectOptions.injector ?? inject(Injector)).get(QueryClient)\n}\n","import {\n DestroyRef,\n ENVIRONMENT_INITIALIZER,\n InjectionToken,\n PLATFORM_ID,\n computed,\n effect,\n inject,\n} from '@angular/core'\nimport { QueryClient, onlineManager } from '@tanstack/query-core'\nimport { isPlatformBrowser } from '@angular/common'\nimport { isDevMode } from './util/is-dev-mode/is-dev-mode'\nimport { noop } from './util'\nimport type { Provider } from '@angular/core'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n TanstackQueryDevtools,\n} from '@tanstack/query-devtools'\n\n/**\n * Usually {@link provideTanStackQuery} is used once to set up TanStack Query and the\n * {@link https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient}\n * for the entire application. Internally it calls `provideQueryClient`.\n * You can use `provideQueryClient` to provide a different `QueryClient` instance for a part\n * of the application or for unit testing purposes.\n * @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.\n * @returns a provider object that can be used to provide the `QueryClient` instance.\n */\nexport function provideQueryClient(\n queryClient: QueryClient | InjectionToken<QueryClient>,\n): Provider {\n return {\n provide: QueryClient,\n useFactory: () => {\n const client =\n queryClient instanceof InjectionToken\n ? inject(queryClient)\n : queryClient\n // Unmount the query client on injector destroy\n inject(DestroyRef).onDestroy(() => client.unmount())\n client.mount()\n return client\n },\n }\n}\n\n/**\n * Sets up providers necessary to enable TanStack Query functionality for Angular applications.\n *\n * Allows to configure a `QueryClient` and optional features such as developer tools.\n *\n * **Example - standalone**\n *\n * ```ts\n * import {\n * provideTanStackQuery,\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * bootstrapApplication(AppComponent, {\n * providers: [provideTanStackQuery(new QueryClient())],\n * })\n * ```\n *\n * **Example - NgModule-based**\n *\n * ```ts\n * import {\n * provideTanStackQuery,\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * @NgModule({\n * declarations: [AppComponent],\n * imports: [BrowserModule],\n * providers: [provideTanStackQuery(new QueryClient())],\n * bootstrap: [AppComponent],\n * })\n * export class AppModule {}\n * ```\n *\n * You can also enable optional developer tools by adding `withDevtools`. By\n * default the tools will then be loaded when your app is in development mode.\n * ```ts\n * import {\n * provideTanStackQuery,\n * withDevtools\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideTanStackQuery(new QueryClient(), withDevtools())\n * ]\n * }\n * )\n * ```\n *\n * **Example: using an InjectionToken**\n *\n * ```ts\n * export const MY_QUERY_CLIENT = new InjectionToken('', {\n * factory: () => new QueryClient(),\n * })\n *\n * // In a lazy loaded route or lazy loaded component's providers array:\n * providers: [provideTanStackQuery(MY_QUERY_CLIENT)]\n * ```\n * @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.\n * @param features - Optional features to configure additional Query functionality.\n * @returns A set of providers to set up TanStack Query.\n * @see https://tanstack.com/query/v5/docs/framework/angular/quick-start\n * @see withDevtools\n */\nexport function provideTanStackQuery(\n queryClient: QueryClient | InjectionToken<QueryClient>,\n ...features: Array<QueryFeatures>\n): Array<Provider> {\n return [\n provideQueryClient(queryClient),\n features.map((feature) => feature.ɵproviders),\n ]\n}\n\n/**\n * Sets up providers necessary to enable TanStack Query functionality for Angular applications.\n *\n * Allows to configure a `QueryClient`.\n * @param queryClient - A `QueryClient` instance.\n * @returns A set of providers to set up TanStack Query.\n * @public\n * @see https://tanstack.com/query/v5/docs/framework/angular/quick-start\n * @deprecated Use `provideTanStackQuery` instead.\n */\nexport function provideAngularQuery(queryClient: QueryClient): Array<Provider> {\n return provideTanStackQuery(queryClient)\n}\n\n/**\n * Helper type to represent a Query feature.\n */\nexport interface QueryFeature<TFeatureKind extends QueryFeatureKind> {\n ɵkind: TFeatureKind\n ɵproviders: Array<Provider>\n}\n\n/**\n * Helper function to create an object that represents a Query feature.\n * @param kind -\n * @param providers -\n * @returns A Query feature.\n */\nexport function queryFeature<TFeatureKind extends QueryFeatureKind>(\n kind: TFeatureKind,\n providers: Array<Provider>,\n): QueryFeature<TFeatureKind> {\n return { ɵkind: kind, ɵproviders: providers }\n}\n\n/**\n * A type alias that represents a feature which enables developer tools.\n * The type is used to describe the return value of the `withDevtools` function.\n * @public\n * @see {@link withDevtools}\n */\nexport type DeveloperToolsFeature = QueryFeature<'DeveloperTools'>\n\n/**\n * A type alias that represents a feature which enables persistence.\n * The type is used to describe the return value of the `withPersistQueryClient` function.\n * @public\n */\nexport type PersistQueryClientFeature = QueryFeature<'PersistQueryClient'>\n\n/**\n * Options for configuring the TanStack Query devtools.\n * @public\n */\nexport interface DevtoolsOptions {\n /**\n * Set this true if you want the devtools to default to being open\n */\n initialIsOpen?: boolean\n /**\n * The position of the TanStack logo to open and close the devtools panel.\n * `top-left` | `top-right` | `bottom-left` | `bottom-right` | `relative`\n * Defaults to `bottom-right`.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the TanStack Query devtools panel.\n * `top` | `bottom` | `left` | `right`\n * Defaults to `bottom`.\n */\n position?: DevtoolsPosition\n /**\n * Custom instance of QueryClient\n */\n client?: QueryClient\n /**\n * Use this so you can define custom errors that can be shown in the devtools.\n */\n errorTypes?: Array<DevtoolsErrorType>\n /**\n * 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.\n */\n styleNonce?: string\n /**\n * Use this so you can attach the devtool's styles to a specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n\n /**\n * Whether the developer tools should load.\n * - `auto`- (Default) Lazily loads devtools when in development mode. Skips loading in production mode.\n * - `true`- Always load the devtools, regardless of the environment.\n * - `false`- Never load the devtools, regardless of the environment.\n *\n * You can use `true` and `false` to override loading developer tools from an environment file.\n * For example, a test environment might run in production mode but you may want to load developer tools.\n *\n * Additionally, you can use a signal in the callback to dynamically load the devtools based on a condition. For example,\n * a signal created from a RxJS observable that listens for a keyboard shortcut.\n *\n * **Example**\n * ```ts\n * withDevtools(() => ({\n * initialIsOpen: true,\n * loadDevtools: inject(ExampleService).loadDevtools()\n * }))\n * ```\n */\n loadDevtools?: 'auto' | boolean\n}\n\n/**\n * Enables developer tools.\n *\n * **Example**\n *\n * ```ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideTanStackQuery(new QueryClient(), withDevtools())\n * ]\n * }\n * ```\n * By default the devtools will be loaded when Angular runs in development mode and rendered in `<body>`.\n *\n * 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.\n *\n * If you need more control over where devtools are rendered, consider `injectDevtoolsPanel`. This allows rendering devtools inside your own devtools for example.\n * @param withDevtoolsFn - A function that returns `DevtoolsOptions`.\n * @returns A set of providers for use with `provideTanStackQuery`.\n * @public\n * @see {@link provideTanStackQuery}\n * @see {@link DevtoolsOptions}\n */\nexport function withDevtools(\n withDevtoolsFn?: () => DevtoolsOptions,\n): DeveloperToolsFeature {\n let providers: Array<Provider> = []\n if (!isDevMode() && !withDevtoolsFn) {\n providers = []\n } else {\n providers = [\n {\n // Do not use provideEnvironmentInitializer while Angular < v19 is supported\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory: () => {\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return noop\n const injectedClient = inject(QueryClient, {\n optional: true,\n })\n const destroyRef = inject(DestroyRef)\n\n const options = computed(() => withDevtoolsFn?.() ?? {})\n\n let devtools: TanstackQueryDevtools | null = null\n let el: HTMLElement | null = null\n\n const shouldLoadToolsSignal = computed(() => {\n const { loadDevtools } = options()\n return typeof loadDevtools === 'boolean'\n ? loadDevtools\n : isDevMode()\n })\n\n const getResolvedQueryClient = () => {\n const client = options().client ?? injectedClient\n if (!client) {\n throw new Error('No QueryClient found')\n }\n return client\n }\n\n const destroyDevtools = () => {\n devtools?.unmount()\n el?.remove()\n devtools = null\n }\n\n return () =>\n effect(() => {\n const shouldLoadTools = shouldLoadToolsSignal()\n const {\n client,\n position,\n errorTypes,\n buttonPosition,\n initialIsOpen,\n } = options()\n\n if (devtools && !shouldLoadTools) {\n destroyDevtools()\n return\n } else if (devtools && shouldLoadTools) {\n client && devtools.setClient(client)\n position && devtools.setPosition(position)\n errorTypes && devtools.setErrorTypes(errorTypes)\n buttonPosition && devtools.setButtonPosition(buttonPosition)\n initialIsOpen && devtools.setInitialIsOpen(initialIsOpen)\n return\n } else if (!shouldLoadTools) {\n return\n }\n\n el = document.body.appendChild(document.createElement('div'))\n el.classList.add('tsqd-parent-container')\n\n import('@tanstack/query-devtools').then((queryDevtools) => {\n devtools = new queryDevtools.TanstackQueryDevtools({\n ...options(),\n client: getResolvedQueryClient(),\n queryFlavor: 'Angular Query',\n version: '5',\n onlineManager,\n })\n\n el && devtools.mount(el)\n\n // Unmount the devtools on application destroy\n destroyRef.onDestroy(destroyDevtools)\n })\n })\n },\n },\n ]\n }\n return queryFeature('DeveloperTools', providers)\n}\n\n/**\n * A type alias that represents all Query features available for use with `provideTanStackQuery`.\n * Features can be enabled by adding special functions to the `provideTanStackQuery` call.\n * See documentation for each symbol to find corresponding function name. See also `provideTanStackQuery`\n * documentation on how to use those functions.\n * @public\n * @see {@link provideTanStackQuery}\n */\nexport type QueryFeatures = DeveloperToolsFeature | PersistQueryClientFeature\n\nexport const queryFeatures = ['DeveloperTools', 'PersistQueryClient'] as const\n\nexport type QueryFeatureKind = (typeof queryFeatures)[number]\n","// Re-export for mocking in tests\n\nexport { isDevMode } from '@angular/core'\n"],"mappings":";AAGA,cAAc;;;AC6KP,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;;;AC7IO,SAAS,gBAMd,SAC4D;AAC5D,SAAO;AACT;;;AC+IO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;;;AC/LA,SAAS,6BAA6B;AACtC;AAAA,EACE,YAAAA;AAAA,EACA,4BAAAC;AAAA,EACA,UAAAC;AAAA,EACA;AAAA,OACK;;;ACNP;AAAA,EACE;AAAA,EACA;AAAA,EACA,YAAAC;AAAA,EACA;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACbP,SAAS,UAAU,iBAAiB;AAa7B,SAAS,YACd,aACA;AACA,QAAM,gBAAgB,CAAC;AAEvB,SAAO,IAAI,MAA4B,eAAe;AAAA,IACpD,IAAI,QAAQ,MAAM;AAEhB,YAAM,gBAAgB,OAAO,IAAI;AACjC,UAAI,cAAe,QAAO;AAG1B,YAAM,cAAc,UAAU,WAAW,EAAE,IAAI;AAC/C,UAAI,OAA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9C,kBAAM;AAAA,cACJ;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF,IAAI,QAAQ;AAEZ,gBAAI,YAAY,CAAC,iBAAiB;AAChC,8BAAgB;AAChB;AAAA,YACF,WAAW,YAAY,iBAAiB;AACtC,wBAAU,SAAS,UAAU,MAAM;AACnC,0BAAY,SAAS,YAAY,QAAQ;AACzC,4BAAc,SAAS,cAAc,UAAU;AAC/C,gCAAkB,SAAS,kBAAkB,cAAc;AAC3D,+BAAiB,SAAS,iBAAiB,aAAa;AACxD;AAAA,YACF,WAAW,CAAC,iBAAiB;AAC3B;AAAA,YACF;AAEA,iBAAK,SAAS,KAAK,YAAY,SAAS,cAAc,KAAK,CAAC;AAC5D,eAAG,UAAU,IAAI,uBAAuB;AAExC,mBAAO,0BAA0B,EAAE,KAAK,CAAC,kBAAkB;AACzD,yBAAW,IAAI,cAAc,sBAAsB;AAAA,gBACjD,GAAG,QAAQ;AAAA,gBACX,QAAQ,uBAAuB;AAAA,gBAC/B,aAAa;AAAA,gBACb,SAAS;AAAA,gBACT;AAAA,cACF,CAAC;AAED,oBAAM,SAAS,MAAM,EAAE;AAGvB,yBAAW,UAAU,eAAe;AAAA,YACtC,CAAC;AAAA,UACH,CAAC;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO,aAAa,kBAAkB,SAAS;AACjD;AAYO,IAAM,gBAAgB,CAAC,kBAAkB,oBAAoB;","names":["Injector","assertInInjectionContext","inject","computed","inject","signal","untracked","inject","computed","signal","untracked","assertInInjectionContext","inject","Injector","Injector","NgZone","assertInInjectionContext","inject","signal","QueryClient","notifyManager","DestroyRef","Injector","NgZone","assertInInjectionContext","inject","signal","QueryClient","notifyManager","DestroyRef","Injector","NgZone","assertInInjectionContext","computed","effect","inject","signal","untracked","QueryClient","notifyManager","shouldThrowError","assertInInjectionContext","inject","Injector","DestroyRef","NgZone","QueryClient","computed","signal","effect","untracked","notifyManager","shouldThrowError","DestroyRef","Injector","NgZone","assertInInjectionContext","computed","inject","signal","QueryClient","notifyManager","QueryClient","notifyManager","DestroyRef","Injector","NgZone","assertInInjectionContext","computed","effect","inject","runInInjectionContext","signal","assertInInjectionContext","runInInjectionContext","inject","Injector","DestroyRef","NgZone","QueryClient","computed","effect","signal","notifyManager","Injector","assertInInjectionContext","inject","runInInjectionContext","assertInInjectionContext","runInInjectionContext","inject","Injector","Injector","inject","QueryClient","DestroyRef","InjectionToken","computed","effect","inject","QueryClient","QueryClient","InjectionToken","inject","DestroyRef","inject","QueryClient","DestroyRef","computed","effect"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/angular-query-experimental",
|
|
3
|
-
"version": "5.75.
|
|
3
|
+
"version": "5.75.8",
|
|
4
4
|
"description": "Signals for managing, caching and syncing asynchronous and remote data in Angular",
|
|
5
5
|
"author": "Arnoud de Vries",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"!src/__tests__"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@tanstack/query-core": "5.75.
|
|
49
|
+
"@tanstack/query-core": "5.75.7",
|
|
50
50
|
"@tanstack/query-devtools": "5.74.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
package/src/providers.ts
CHANGED
|
@@ -6,13 +6,12 @@ import {
|
|
|
6
6
|
computed,
|
|
7
7
|
effect,
|
|
8
8
|
inject,
|
|
9
|
-
makeEnvironmentProviders,
|
|
10
9
|
} from '@angular/core'
|
|
11
10
|
import { QueryClient, onlineManager } from '@tanstack/query-core'
|
|
12
11
|
import { isPlatformBrowser } from '@angular/common'
|
|
13
12
|
import { isDevMode } from './util/is-dev-mode/is-dev-mode'
|
|
14
13
|
import { noop } from './util'
|
|
15
|
-
import type {
|
|
14
|
+
import type { Provider } from '@angular/core'
|
|
16
15
|
import type {
|
|
17
16
|
DevtoolsButtonPosition,
|
|
18
17
|
DevtoolsErrorType,
|
|
@@ -23,9 +22,10 @@ import type {
|
|
|
23
22
|
/**
|
|
24
23
|
* Usually {@link provideTanStackQuery} is used once to set up TanStack Query and the
|
|
25
24
|
* {@link https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient}
|
|
26
|
-
* for the entire application.
|
|
27
|
-
* different `QueryClient` instance for a part
|
|
28
|
-
*
|
|
25
|
+
* for the entire application. Internally it calls `provideQueryClient`.
|
|
26
|
+
* You can use `provideQueryClient` to provide a different `QueryClient` instance for a part
|
|
27
|
+
* of the application or for unit testing purposes.
|
|
28
|
+
* @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
|
|
29
29
|
* @returns a provider object that can be used to provide the `QueryClient` instance.
|
|
30
30
|
*/
|
|
31
31
|
export function provideQueryClient(
|
|
@@ -34,9 +34,14 @@ export function provideQueryClient(
|
|
|
34
34
|
return {
|
|
35
35
|
provide: QueryClient,
|
|
36
36
|
useFactory: () => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const client =
|
|
38
|
+
queryClient instanceof InjectionToken
|
|
39
|
+
? inject(queryClient)
|
|
40
|
+
: queryClient
|
|
41
|
+
// Unmount the query client on injector destroy
|
|
42
|
+
inject(DestroyRef).onDestroy(() => client.unmount())
|
|
43
|
+
client.mount()
|
|
44
|
+
return client
|
|
40
45
|
},
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -93,6 +98,17 @@ export function provideQueryClient(
|
|
|
93
98
|
* }
|
|
94
99
|
* )
|
|
95
100
|
* ```
|
|
101
|
+
*
|
|
102
|
+
* **Example: using an InjectionToken**
|
|
103
|
+
*
|
|
104
|
+
* ```ts
|
|
105
|
+
* export const MY_QUERY_CLIENT = new InjectionToken('', {
|
|
106
|
+
* factory: () => new QueryClient(),
|
|
107
|
+
* })
|
|
108
|
+
*
|
|
109
|
+
* // In a lazy loaded route or lazy loaded component's providers array:
|
|
110
|
+
* providers: [provideTanStackQuery(MY_QUERY_CLIENT)]
|
|
111
|
+
* ```
|
|
96
112
|
* @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
|
|
97
113
|
* @param features - Optional features to configure additional Query functionality.
|
|
98
114
|
* @returns A set of providers to set up TanStack Query.
|
|
@@ -102,27 +118,11 @@ export function provideQueryClient(
|
|
|
102
118
|
export function provideTanStackQuery(
|
|
103
119
|
queryClient: QueryClient | InjectionToken<QueryClient>,
|
|
104
120
|
...features: Array<QueryFeatures>
|
|
105
|
-
):
|
|
106
|
-
return
|
|
121
|
+
): Array<Provider> {
|
|
122
|
+
return [
|
|
107
123
|
provideQueryClient(queryClient),
|
|
108
|
-
{
|
|
109
|
-
// Do not use provideEnvironmentInitializer while Angular < v19 is supported
|
|
110
|
-
provide: ENVIRONMENT_INITIALIZER,
|
|
111
|
-
multi: true,
|
|
112
|
-
useFactory: () => {
|
|
113
|
-
const client =
|
|
114
|
-
queryClient instanceof InjectionToken
|
|
115
|
-
? inject(queryClient)
|
|
116
|
-
: queryClient
|
|
117
|
-
return () => {
|
|
118
|
-
client.mount()
|
|
119
|
-
// Unmount the query client on application destroy
|
|
120
|
-
inject(DestroyRef).onDestroy(() => client.unmount())
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
124
|
features.map((feature) => feature.ɵproviders),
|
|
125
|
-
]
|
|
125
|
+
]
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
@@ -135,9 +135,7 @@ export function provideTanStackQuery(
|
|
|
135
135
|
* @see https://tanstack.com/query/v5/docs/framework/angular/quick-start
|
|
136
136
|
* @deprecated Use `provideTanStackQuery` instead.
|
|
137
137
|
*/
|
|
138
|
-
export function provideAngularQuery(
|
|
139
|
-
queryClient: QueryClient,
|
|
140
|
-
): EnvironmentProviders {
|
|
138
|
+
export function provideAngularQuery(queryClient: QueryClient): Array<Provider> {
|
|
141
139
|
return provideTanStackQuery(queryClient)
|
|
142
140
|
}
|
|
143
141
|
|