@tanstack/angular-query-experimental 5.73.3 → 5.74.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DefaultError, QueryKey, OmitKeyof, QueryObserverOptions, InfiniteQueryObserverOptions, QueryObserverResult, DefinedQueryObserverResult, InfiniteQueryObserverResult, DefinedInfiniteQueryObserverResult, MutateFunction, Override, MutationObserverResult, InitialDataFunction, DataTag, MutationObserverOptions, InfiniteData, QueryFilters, MutationFilters, MutationState, Mutation, QueriesPlaceholderDataFunction, QueryFunction, ThrowOnError, QueryClient } from '@tanstack/query-core';
2
2
  export * from '@tanstack/query-core';
3
- import { Signal, Injector, InjectOptions, Provider, EnvironmentProviders } from '@angular/core';
3
+ import { Signal, Injector, Provider, InjectOptions, EnvironmentProviders } from '@angular/core';
4
4
  import { DevtoolsButtonPosition, DevtoolsPosition, DevtoolsErrorType } from '@tanstack/query-devtools';
5
5
 
6
6
  type MapToSignals<T> = {
@@ -233,6 +233,14 @@ declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData
233
233
  queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>>;
234
234
  };
235
235
 
236
+ interface InjectInfiniteQueryOptions {
237
+ /**
238
+ * The `Injector` in which to create the infinite query.
239
+ *
240
+ * If this is not provided, the current injection context will be used instead (via `inject`).
241
+ */
242
+ injector?: Injector;
243
+ }
236
244
  /**
237
245
  * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
238
246
  * Infinite queries can additively "load more" data onto an existing set of data or "infinite scroll"
@@ -260,17 +268,6 @@ declare function injectInfiniteQuery<TQueryFnData, TError = DefaultError, TData
260
268
  * @public
261
269
  */
262
270
  declare function injectInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(injectInfiniteQueryFn: () => CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam>, options?: InjectInfiniteQueryOptions): CreateInfiniteQueryResult<TData, TError>;
263
- interface InjectInfiniteQueryOptions {
264
- /**
265
- * The `Injector` in which to create the infinite query.
266
- *
267
- * If this is not provided, the current injection context will be used instead (via `inject`).
268
- */
269
- injector?: Injector;
270
- }
271
- interface InjectInfiniteQueryOptions {
272
- injector?: Injector;
273
- }
274
271
 
275
272
  interface InjectIsFetchingOptions {
276
273
  /**
@@ -311,6 +308,29 @@ interface InjectIsMutatingOptions {
311
308
  */
312
309
  declare function injectIsMutating(filters?: MutationFilters, options?: InjectIsMutatingOptions): Signal<number>;
313
310
 
311
+ /**
312
+ * The `Injector` in which to create the isRestoring signal.
313
+ *
314
+ * If this is not provided, the current injection context will be used instead (via `inject`).
315
+ */
316
+ interface InjectIsRestoringOptions {
317
+ injector?: Injector;
318
+ }
319
+ /**
320
+ * 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 mounting queries.
321
+ * @param options - Options for injectIsRestoring.
322
+ * @returns signal with boolean that indicates whether a restore is in progress.
323
+ * @public
324
+ */
325
+ declare function injectIsRestoring(options?: InjectIsRestoringOptions): Signal<boolean>;
326
+ /**
327
+ * Used by TanStack Query Angular persist client plugin to provide the signal that tracks the restore state
328
+ * @param isRestoring - a readonly signal that returns a boolean
329
+ * @returns Provider for the `isRestoring` signal
330
+ * @public
331
+ */
332
+ declare function provideIsRestoring(isRestoring: Signal<boolean>): Provider;
333
+
314
334
  interface InjectMutationOptions {
315
335
  /**
316
336
  * The `Injector` in which to create the mutation.
@@ -659,6 +679,13 @@ interface QueryFeature<TFeatureKind extends QueryFeatureKind> {
659
679
  ɵkind: TFeatureKind;
660
680
  ɵproviders: Array<Provider>;
661
681
  }
682
+ /**
683
+ * Helper function to create an object that represents a Query feature.
684
+ * @param kind -
685
+ * @param providers -
686
+ * @returns A Query feature.
687
+ */
688
+ declare function queryFeature<TFeatureKind extends QueryFeatureKind>(kind: TFeatureKind, providers: Array<Provider>): QueryFeature<TFeatureKind>;
662
689
  /**
663
690
  * A type alias that represents a feature which enables developer tools.
664
691
  * The type is used to describe the return value of the `withDevtools` function.
@@ -666,6 +693,12 @@ interface QueryFeature<TFeatureKind extends QueryFeatureKind> {
666
693
  * @see {@link withDevtools}
667
694
  */
668
695
  type DeveloperToolsFeature = QueryFeature<'DeveloperTools'>;
696
+ /**
697
+ * A type alias that represents a feature which enables persistence.
698
+ * The type is used to describe the return value of the `withPersistQueryClient` function.
699
+ * @public
700
+ */
701
+ type PersistQueryClientFeature = QueryFeature<'PersistQueryClient'>;
669
702
  /**
670
703
  * Options for configuring the TanStack Query devtools.
671
704
  * @public
@@ -757,8 +790,8 @@ declare function withDevtools(withDevtoolsFn?: () => DevtoolsOptions): Developer
757
790
  * @public
758
791
  * @see {@link provideTanStackQuery}
759
792
  */
760
- type QueryFeatures = DeveloperToolsFeature;
761
- declare const queryFeatures: readonly ["DeveloperTools"];
793
+ type QueryFeatures = DeveloperToolsFeature | PersistQueryClientFeature;
794
+ declare const queryFeatures: readonly ["DeveloperTools", "PersistQueryClient"];
762
795
  type QueryFeatureKind = (typeof queryFeatures)[number];
763
796
 
764
- export { type BaseMutationNarrowing, type BaseQueryNarrowing, type CreateBaseMutationResult, type CreateBaseQueryOptions, type CreateBaseQueryResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreateMutateAsyncFunction, type CreateMutateFunction, type CreateMutationOptions, type CreateMutationResult, type CreateQueryOptions, type CreateQueryResult, type DefinedCreateInfiniteQueryResult, type DefinedCreateQueryResult, type DefinedInitialDataInfiniteOptions, type DefinedInitialDataOptions, type DeveloperToolsFeature, type DevtoolsOptions, type InjectInfiniteQueryOptions, type InjectIsFetchingOptions, type InjectIsMutatingOptions, type InjectMutationOptions, type InjectMutationStateOptions, type InjectQueryOptions, type NonUndefinedGuard, type QueriesOptions, type QueriesResults, type QueryFeature, type QueryFeatureKind, type QueryFeatures, type UndefinedInitialDataInfiniteOptions, type UndefinedInitialDataOptions, infiniteQueryOptions, injectInfiniteQuery, injectIsFetching, injectIsMutating, injectMutation, injectMutationState, injectQueries, injectQuery, injectQueryClient, mutationOptions, provideAngularQuery, provideQueryClient, provideTanStackQuery, queryFeatures, queryOptions, withDevtools };
797
+ export { type BaseMutationNarrowing, type BaseQueryNarrowing, type CreateBaseMutationResult, type CreateBaseQueryOptions, type CreateBaseQueryResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreateMutateAsyncFunction, type CreateMutateFunction, type CreateMutationOptions, type CreateMutationResult, type CreateQueryOptions, type CreateQueryResult, type DefinedCreateInfiniteQueryResult, type DefinedCreateQueryResult, type DefinedInitialDataInfiniteOptions, type DefinedInitialDataOptions, type DeveloperToolsFeature, type DevtoolsOptions, type InjectInfiniteQueryOptions, type InjectIsFetchingOptions, type InjectIsMutatingOptions, type InjectMutationOptions, type InjectMutationStateOptions, type InjectQueryOptions, type NonUndefinedGuard, type PersistQueryClientFeature, type QueriesOptions, type QueriesResults, type QueryFeature, type QueryFeatureKind, type QueryFeatures, type UndefinedInitialDataInfiniteOptions, type UndefinedInitialDataOptions, infiniteQueryOptions, injectInfiniteQuery, injectIsFetching, injectIsMutating, injectIsRestoring, injectMutation, injectMutationState, injectQueries, injectQuery, injectQueryClient, mutationOptions, provideAngularQuery, provideIsRestoring, provideQueryClient, provideTanStackQuery, queryFeature, queryFeatures, queryOptions, withDevtools };