reactjrx 1.80.1 → 1.82.0
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/dist/index.cjs +1 -1
- package/dist/index.d.ts +25 -24
- package/dist/index.js +813 -785
- package/dist/lib/binding/types.d.ts +2 -1
- package/dist/lib/binding/useBehaviorSubject.d.ts +2 -1
- package/dist/lib/binding/useLiveBehaviorSubject.d.ts +3 -0
- package/dist/lib/binding/useObservableEvent.d.ts +1 -1
- package/dist/lib/binding/useObservableState.d.ts +2 -1
- package/dist/lib/binding/useObserve.d.ts +3 -6
- package/dist/lib/binding/useSubject.d.ts +4 -3
- package/dist/lib/binding/useSubscribe.d.ts +3 -2
- package/dist/lib/binding/useSubscribeEffect.d.ts +3 -2
- package/dist/lib/queries/client/QueryClient.d.ts +14 -13
- package/dist/lib/queries/client/focusManager.d.ts +3 -2
- package/dist/lib/queries/client/keys/hashKey.d.ts +3 -2
- package/dist/lib/queries/client/keys/matchKey.d.ts +3 -2
- package/dist/lib/queries/client/keys/partialMatchKey.d.ts +2 -1
- package/dist/lib/queries/client/mutations/cache/MutationCache.d.ts +9 -8
- package/dist/lib/queries/client/mutations/cache/types.d.ts +4 -3
- package/dist/lib/queries/client/mutations/defaultMutationState.d.ts +2 -1
- package/dist/lib/queries/client/mutations/filters.d.ts +3 -2
- package/dist/lib/queries/client/mutations/mutation/Mutation.d.ts +5 -4
- package/dist/lib/queries/client/mutations/mutation/delayWhenNetworkOnline.d.ts +2 -1
- package/dist/lib/queries/client/mutations/mutation/executeMutation.d.ts +3 -2
- package/dist/lib/queries/client/mutations/mutation/observeUntilFinished.d.ts +3 -2
- package/dist/lib/queries/client/mutations/mutation/types.d.ts +5 -4
- package/dist/lib/queries/client/mutations/mutation/waitForNetworkOnError.d.ts +2 -1
- package/dist/lib/queries/client/mutations/observers/MutationObserver.d.ts +8 -7
- package/dist/lib/queries/client/mutations/observers/types.d.ts +4 -3
- package/dist/lib/queries/client/mutations/runner/MutationRunner.d.ts +6 -5
- package/dist/lib/queries/client/mutations/types.d.ts +5 -4
- package/dist/lib/queries/client/onlineManager.d.ts +4 -3
- package/dist/lib/queries/client/queries/cache/QueryCache.d.ts +10 -9
- package/dist/lib/queries/client/queries/cache/types.d.ts +6 -5
- package/dist/lib/queries/client/queries/observer/QueryObserver.d.ts +10 -9
- package/dist/lib/queries/client/queries/observer/queryStateHelpers.d.ts +4 -3
- package/dist/lib/queries/client/queries/observer/types.d.ts +6 -5
- package/dist/lib/queries/client/queries/query/Query.d.ts +12 -11
- package/dist/lib/queries/client/queries/query/delayOnNetworkMode.d.ts +5 -4
- package/dist/lib/queries/client/queries/query/delayUntilFocus.d.ts +2 -1
- package/dist/lib/queries/client/queries/query/execution/completeFnIfNotMoreObservers.d.ts +2 -1
- package/dist/lib/queries/client/queries/query/execution/executeQuery.d.ts +6 -5
- package/dist/lib/queries/client/queries/query/getDefaultState.d.ts +4 -3
- package/dist/lib/queries/client/queries/query/operators.d.ts +5 -4
- package/dist/lib/queries/client/queries/query/state/whenNewData.d.ts +4 -3
- package/dist/lib/queries/client/queries/query/types.d.ts +6 -5
- package/dist/lib/queries/client/queries/retryer/CancelledError.d.ts +2 -1
- package/dist/lib/queries/client/queries/retryer/utils.d.ts +2 -1
- package/dist/lib/queries/client/queries/types.d.ts +7 -6
- package/dist/lib/queries/client/queries/utils.d.ts +4 -3
- package/dist/lib/queries/client/store.d.ts +2 -1
- package/dist/lib/queries/client/tests/utils.d.ts +5 -4
- package/dist/lib/queries/client/types.d.ts +4 -3
- package/dist/lib/queries/client/utils/makeObservable.d.ts +2 -1
- package/dist/lib/queries/react/QueryClientProvider.d.ts +5 -4
- package/dist/lib/queries/react/mutations/types.d.ts +4 -3
- package/dist/lib/queries/react/mutations/useIsMutating.d.ts +4 -3
- package/dist/lib/queries/react/mutations/useMutation.d.ts +4 -3
- package/dist/lib/queries/react/mutations/useMutationState.d.ts +5 -4
- package/dist/lib/queries/react/queries/errorBoundaryUtils.d.ts +6 -5
- package/dist/lib/queries/react/queries/queryOptions.d.ts +5 -4
- package/dist/lib/queries/react/queries/types.d.ts +5 -4
- package/dist/lib/queries/react/queries/useBaseQuery.d.ts +6 -5
- package/dist/lib/queries/react/queries/useForeverQuery.d.ts +6 -5
- package/dist/lib/queries/react/queries/useIsFetching.d.ts +3 -2
- package/dist/lib/queries/react/queries/useQuery.d.ts +6 -5
- package/dist/lib/queries/react/useQueryClient.d.ts +2 -1
- package/dist/lib/state/persistance/adapters/createLocalStorageAdapter.d.ts +3 -2
- package/dist/lib/state/persistance/adapters/createLocalforageAdapter.d.ts +3 -4
- package/dist/lib/state/persistance/getNormalizedPersistanceValue.d.ts +2 -1
- package/dist/lib/state/persistance/types.d.ts +4 -1
- package/dist/lib/state/persistance/usePersistSignals.d.ts +11 -10
- package/dist/lib/state/signal.d.ts +26 -20
- package/dist/lib/state/useSignal.d.ts +3 -2
- package/dist/lib/state/useSignalValue.d.ts +6 -3
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/operators/emitToSubject.d.ts +2 -1
- package/dist/lib/utils/operators/retryBackoff.d.ts +2 -1
- package/dist/lib/utils/operators/trackSubscriptions.d.ts +2 -1
- package/dist/lib/utils/useLiveRef.d.ts +1 -1
- package/dist/lib/utils/useUnmountObservable.d.ts +1 -1
- package/dist/tests/utils.d.ts +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This creates an event handler and an observable that represents calls to that handler.
|
|
3
3
|
*/
|
|
4
|
-
export declare const useObserveCallback: <T = void>() => readonly [import(
|
|
4
|
+
export declare const useObserveCallback: <T = void>() => readonly [import('rxjs').Observable<T>, (arg: T) => void];
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Observable, BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { DependencyList } from 'react';
|
|
3
|
+
|
|
3
4
|
interface Option<R = undefined> {
|
|
4
5
|
defaultValue: R;
|
|
5
|
-
key?: string;
|
|
6
6
|
unsubscribeOnUnmount?: boolean;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
* @todo return first value if source is behavior subject
|
|
10
|
-
*/
|
|
11
8
|
export declare function useObserve<T>(source: BehaviorSubject<T>): T;
|
|
12
9
|
export declare function useObserve<T>(source: Observable<T>): T | undefined;
|
|
13
10
|
export declare function useObserve<T>(source: () => Observable<T>, deps: DependencyList): T | undefined;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Subject } from
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* @see
|
|
4
5
|
* useBehaviorSubject
|
|
5
6
|
*/
|
|
6
7
|
export declare const useSubject: <S>({ onBeforeComplete, completeOnUnmount }?: {
|
|
7
|
-
onBeforeComplete?: (
|
|
8
|
-
completeOnUnmount?: boolean
|
|
8
|
+
onBeforeComplete?: () => void;
|
|
9
|
+
completeOnUnmount?: boolean;
|
|
9
10
|
}) => {
|
|
10
11
|
current: Subject<S>;
|
|
11
12
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SubscribeSource } from './types';
|
|
2
|
+
import { DependencyList } from 'react';
|
|
3
|
+
|
|
3
4
|
export declare function useSubscribe<T>(source: SubscribeSource<T>, deps?: DependencyList): void;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import { CancelOptions } from './queries/retryer/types';
|
|
2
|
+
import { QueryState } from './queries/query/types';
|
|
3
|
+
import { NoInfer } from '../../utils/types';
|
|
4
|
+
import { DefaultedQueryObserverOptions, QueryObserverOptions } from './queries/observer/types';
|
|
5
|
+
import { QueryKey } from './keys/types';
|
|
6
|
+
import { RefetchQueryFilters, DefaultError, InvalidateOptions, InvalidateQueryFilters, ResetOptions } from './types';
|
|
7
|
+
import { DataTag, Updater, FetchQueryOptions, QueryFilters, SetDataOptions, RefetchOptions } from './queries/types';
|
|
8
|
+
import { QueryCache } from './queries/cache/QueryCache';
|
|
9
|
+
import { MutationOptions } from './mutations/mutation/types';
|
|
10
|
+
import { MutationObserverOptions } from './mutations/observers/types';
|
|
11
|
+
import { MutationCache } from './mutations/cache/MutationCache';
|
|
12
|
+
import { MutationKey } from './mutations/types';
|
|
13
|
+
|
|
13
14
|
export interface DefaultOptions<TError = DefaultError> {
|
|
14
15
|
queries?: Omit<QueryObserverOptions<unknown, TError>, "suspense">;
|
|
15
16
|
mutations?: MutationObserverOptions<unknown, TError, unknown, unknown>;
|
|
@@ -42,7 +43,7 @@ export declare class QueryClient {
|
|
|
42
43
|
removeQueries(filters?: QueryFilters): void;
|
|
43
44
|
cancelQueries(filters?: QueryFilters, cancelOptions?: CancelOptions): Promise<void>;
|
|
44
45
|
invalidateQueries(filters?: InvalidateQueryFilters, options?: InvalidateOptions): Promise<void>;
|
|
45
|
-
resumePausedMutations(): Promise<import(
|
|
46
|
+
resumePausedMutations(): Promise<import('./mutations/mutation/types').MutationState<any, any, any, any>[]>;
|
|
46
47
|
isFetching(filters?: QueryFilters): number;
|
|
47
48
|
clear(): void;
|
|
48
49
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BehaviorSubject } from
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
|
|
2
3
|
export declare class FocusManager {
|
|
3
4
|
#private;
|
|
4
5
|
readonly focused$: BehaviorSubject<boolean>;
|
|
5
|
-
readonly focusRegained$: import(
|
|
6
|
+
readonly focusRegained$: import('rxjs').Observable<boolean>;
|
|
6
7
|
constructor();
|
|
7
8
|
isFocused(): boolean;
|
|
8
9
|
setFocused(focused?: boolean): void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { DefaultError } from '../../types';
|
|
2
|
+
import { MutationOptions, MutationState } from '../mutation/types';
|
|
3
|
+
import { MutationCacheConfig, MutationCacheNotifyEvent } from './types';
|
|
4
|
+
import { MutationFilters } from '../types';
|
|
5
|
+
import { QueryClient } from '../../QueryClient';
|
|
6
|
+
import { Mutation } from '../mutation/Mutation';
|
|
7
|
+
|
|
7
8
|
export declare class MutationCache {
|
|
8
9
|
#private;
|
|
9
10
|
config: MutationCacheConfig;
|
|
@@ -13,12 +14,12 @@ export declare class MutationCache {
|
|
|
13
14
|
remove(mutationToRemove: Mutation<any, any, any, any>): void;
|
|
14
15
|
find<TData = unknown, TError = DefaultError, TVariables = any, TContext = unknown>(filters: MutationFilters<TData, TError, TVariables, TContext>): Mutation<TData, TError, TVariables, TContext> | undefined;
|
|
15
16
|
findAll<TData = unknown, TError = Error, TVariables = any, TContext = unknown>(filters?: MutationFilters<TData, TError, TVariables, TContext>): Array<Mutation<any, any, any, any>>;
|
|
16
|
-
observe(): import(
|
|
17
|
+
observe(): import('rxjs').Observable<Mutation<any, any, any, any>>;
|
|
17
18
|
/**
|
|
18
19
|
* @important
|
|
19
20
|
* ISO api react-query
|
|
20
21
|
*/
|
|
21
22
|
subscribe(listener: (event: MutationCacheNotifyEvent) => void): () => void;
|
|
22
|
-
resumePausedMutations(): import(
|
|
23
|
+
resumePausedMutations(): import('rxjs').Observable<MutationState<any, any, any, any>[]>;
|
|
23
24
|
clear(): void;
|
|
24
25
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { MutationObserver } from '../observers/MutationObserver';
|
|
2
|
+
import { Mutation } from '../mutation/Mutation';
|
|
3
|
+
import { DefaultError } from '../../types';
|
|
4
|
+
|
|
4
5
|
export interface MutationCacheConfig {
|
|
5
6
|
onError?: <Data = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(error: DefaultError, variables: unknown, context: unknown, mutation: Mutation<Data, TError, TVariables, TContext>) => Promise<unknown> | unknown;
|
|
6
7
|
onSuccess?: (data: unknown, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MutationState } from './mutation/types';
|
|
2
|
+
|
|
2
3
|
export declare const getDefaultMutationState: <TData = unknown, TError = unknown, TVariables = void, TContext = unknown>() => MutationState<TData, TError, TVariables, TContext>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { MutationFilters } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const createPredicateForFilters: <TData = unknown, TError = Error, TVariables = any, TContext = unknown>({ mutationKey, status, predicate, exact }?: MutationFilters<TData, TError, TVariables, TContext>) => (mutation: import('./mutation/Mutation').Mutation<TData, TError, TVariables, TContext>) => boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { MutationState, MutationMeta, MutationOptions } from './types';
|
|
2
|
+
import { MutationCache } from '../cache/MutationCache';
|
|
3
|
+
import { DefaultError } from '../../types';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
5
6
|
interface MutationConfig<TData, TError, TVariables, TContext> {
|
|
6
7
|
mutationCache: MutationCache;
|
|
7
8
|
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MutationOptions, MutationState } from './types';
|
|
2
|
+
|
|
2
3
|
export declare const executeMutation: <TData = unknown, TError = Error, TVariables = void, TContext = unknown>({ variables, state, options }: {
|
|
3
4
|
variables: TVariables;
|
|
4
5
|
state: MutationState<TData, TError, TVariables, TContext>;
|
|
5
6
|
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
6
|
-
}) => import(
|
|
7
|
+
}) => import('rxjs').Observable<MutationState<TData, TError, TVariables, TContext>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MutationState } from './types';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
3
4
|
export declare const observeUntilFinished: <T extends MutationState<any, any, any, any>>(source: Observable<T>) => Observable<T>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { NetworkMode } from '../../queries/types';
|
|
2
|
+
import { MapOperator, MutationFn, MutationKey } from '../types';
|
|
3
|
+
import { DefaultError, DeprecatedQuery, QueryResult, Register } from '../../types';
|
|
4
|
+
import { Observable, MonoTypeOperatorFunction } from 'rxjs';
|
|
5
|
+
|
|
5
6
|
export type MutationStatus = "idle" | "pending" | "success" | "error";
|
|
6
7
|
export interface MutationState<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> {
|
|
7
8
|
context: TContext | undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { MutationState } from '../mutation/types';
|
|
2
|
+
import { MutationRunner } from '../runner/MutationRunner';
|
|
3
|
+
import { MutationObserverOptions, MutationObserverResult } from './types';
|
|
4
|
+
import { DefaultError } from '../../types';
|
|
5
|
+
import { QueryClient } from '../../QueryClient';
|
|
6
|
+
import { MutateOptions } from '../types';
|
|
7
|
+
import { Observable } from 'rxjs';
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Provide API to observe mutations results globally.
|
|
10
11
|
* Observe runners and map their results in a hash map.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { MutateFunction } from '../types';
|
|
2
|
+
import { MutationOptions, MutationState, MutationStatus } from '../mutation/types';
|
|
3
|
+
import { DefaultError } from '../../types';
|
|
4
|
+
|
|
4
5
|
export interface MutationObserverOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> extends MutationOptions<TData, TError, TVariables, TContext> {
|
|
5
6
|
throwOnError?: boolean | ((error: TError) => boolean);
|
|
6
7
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { MutationOptions, MutationState } from '../mutation/types';
|
|
2
|
+
import { Mutation } from '../mutation/Mutation';
|
|
3
|
+
import { MutationObserverOptions } from '../observers/types';
|
|
4
|
+
import { DefaultError } from '../../types';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
|
|
6
7
|
interface TriggerSubject<TData, TError = DefaultError, TVariables = void, TContext = unknown> {
|
|
7
8
|
args: TVariables;
|
|
8
9
|
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { MutationStatus } from './mutation/types';
|
|
2
|
+
import { Mutation } from './mutation/Mutation';
|
|
3
|
+
import { DefaultError } from '../types';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* The default value `merge` is suitable for most use case.
|
|
7
8
|
* You should not have to worry too much about it and only consider changing
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BehaviorSubject } from
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
|
|
2
3
|
export declare class OnlineManager {
|
|
3
4
|
protected isOnlineSubject: BehaviorSubject<boolean>;
|
|
4
|
-
readonly online$: import(
|
|
5
|
-
readonly backToOnline$: import(
|
|
5
|
+
readonly online$: import('rxjs').Observable<boolean>;
|
|
6
|
+
readonly backToOnline$: import('rxjs').Observable<boolean>;
|
|
6
7
|
constructor();
|
|
7
8
|
isOnline(): boolean;
|
|
8
9
|
setOnline(online: boolean): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { QueryCacheConfig, QueryCacheListener } from './types';
|
|
2
|
+
import { WithRequired } from '../../../../utils/types';
|
|
3
|
+
import { QueryState } from '../query/types';
|
|
4
|
+
import { QueryClient } from '../../QueryClient';
|
|
5
|
+
import { QueryOptions, QueryFilters } from '../types';
|
|
6
|
+
import { Query } from '../query/Query';
|
|
7
|
+
import { QueryKey } from '../../keys/types';
|
|
8
|
+
import { DefaultError } from '../../types';
|
|
9
|
+
|
|
9
10
|
export interface QueryStore {
|
|
10
11
|
has: (queryHash: string) => boolean;
|
|
11
12
|
set: (queryHash: string, query: Query) => void;
|
|
@@ -20,7 +21,7 @@ export declare class QueryCache {
|
|
|
20
21
|
mount(): void;
|
|
21
22
|
unmount(): void;
|
|
22
23
|
notify(event: Parameters<QueryCacheListener>[0]): void;
|
|
23
|
-
observeIsFetching(filters?: QueryFilters): import(
|
|
24
|
+
observeIsFetching(filters?: QueryFilters): import('rxjs').Observable<number>;
|
|
24
25
|
getAll(): Query[];
|
|
25
26
|
findAll(filters?: QueryFilters): Query[];
|
|
26
27
|
build<TQueryFnData, TError, TData, TQueryKey extends QueryKey>(client: QueryClient, options: QueryOptions<TQueryFnData, TError, TData, TQueryKey>, state?: QueryState<TData, TError>): Query<TQueryFnData, TError, TData, TQueryKey>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { Action } from '../query/types';
|
|
2
|
+
import { Query } from '../query/Query';
|
|
3
|
+
import { QueryObserver } from '../observer/QueryObserver';
|
|
4
|
+
import { DefaultError } from '../../types';
|
|
5
|
+
import { NotifyEvent } from '../../mutations/cache/types';
|
|
6
|
+
|
|
6
7
|
export interface QueryCacheConfig {
|
|
7
8
|
onError?: (error: DefaultError, query: Query<unknown, unknown, unknown>) => void;
|
|
8
9
|
onSuccess?: (data: unknown, query: Query<unknown, unknown, unknown>) => void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { QueryObserverResult, QueryObserverOptions, DefaultedQueryObserverOptions, QueryObserverListener } from './types';
|
|
2
|
+
import { RefetchOptions } from '../types';
|
|
3
|
+
import { FetchOptions } from '../query/types';
|
|
4
|
+
import { Query } from '../query/Query';
|
|
5
|
+
import { DefaultError } from '../../types';
|
|
6
|
+
import { QueryKey } from '../../keys/types';
|
|
7
|
+
import { QueryClient } from '../../QueryClient';
|
|
8
|
+
import { Observable, Subject } from 'rxjs';
|
|
9
|
+
|
|
9
10
|
export interface ObserverFetchOptions extends FetchOptions {
|
|
10
11
|
throwOnError?: boolean;
|
|
11
12
|
}
|
|
@@ -39,7 +40,7 @@ export declare class QueryObserver<TQueryFnData = unknown, TError = DefaultError
|
|
|
39
40
|
protected getObserverResultFromQuery: ({ options, query, optimisticResult, prevResult: { result: prevResult, options: prevResultOptions, state: prevResultState, select: prevSelect, selectError: prevSelectError, selectResult: prevSelectResult } }: {
|
|
40
41
|
query: Query<TQueryFnData, TError, TQueryData, TQueryKey>;
|
|
41
42
|
options: QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>;
|
|
42
|
-
optimisticResult?: boolean
|
|
43
|
+
optimisticResult?: boolean;
|
|
43
44
|
prevResult: Partial<LastResult<TQueryFnData, TError, TData, TQueryData, TQueryKey>>;
|
|
44
45
|
}) => {
|
|
45
46
|
result: QueryObserverResult<TData, TError>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { QueryObserverOptions } from './types';
|
|
2
|
+
import { NetworkMode } from '../types';
|
|
3
|
+
import { Query } from '../query/Query';
|
|
4
|
+
|
|
4
5
|
export declare function isStale(query: Query<any, any, any, any>, options: QueryObserverOptions<any, any, any, any, any>): boolean;
|
|
5
6
|
export declare function shouldFetchOnMount(query: Query<any, any, any, any>, options: QueryObserverOptions<any, any, any, any, any>): boolean;
|
|
6
7
|
export declare function shouldFetchOptionally(query: Query<any, any, any, any>, prevQuery: Query<any, any, any, any>, options: QueryObserverOptions<any, any, any, any, any>, prevOptions: QueryObserverOptions<any, any, any, any, any>): boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ThrowOnError, QueryOptions, PlaceholderDataFunction, NotifyOnChangeProps, RefetchOptions, QueryStatus, FetchStatus, FetchNextPageOptions, FetchPreviousPageOptions } from '../types';
|
|
2
|
+
import { Query } from '../query/Query';
|
|
3
|
+
import { DefaultError } from '../../types';
|
|
4
|
+
import { QueryKey } from '../../keys/types';
|
|
5
|
+
import { NonFunctionGuard, WithRequired } from '../../../../utils/types';
|
|
6
|
+
|
|
6
7
|
export interface QueryObserverOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = never> extends QueryOptions<TQueryFnData, TError, TQueryData, TQueryKey, TPageParam> {
|
|
7
8
|
/**
|
|
8
9
|
* Set this to `false` to disable automatic refetching when the query mounts or changes query keys.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { QueryObserver } from '../observer/QueryObserver';
|
|
2
|
+
import { CancelOptions } from '../retryer/types';
|
|
3
|
+
import { QueryMeta, FetchOptions, QueryState } from './types';
|
|
4
|
+
import { SetDataOptions, QueryOptions } from '../types';
|
|
5
|
+
import { QueryCache } from '../cache/QueryCache';
|
|
6
|
+
import { DefaultError } from '../../types';
|
|
7
|
+
import { QueryKey } from '../../keys/types';
|
|
8
|
+
import { Observable, Subject, BehaviorSubject } from 'rxjs';
|
|
9
|
+
|
|
9
10
|
interface QueryConfig<TQueryFnData, TError, TData, TQueryKey extends QueryKey = QueryKey> {
|
|
10
11
|
cache: QueryCache;
|
|
11
12
|
queryKey: TQueryKey;
|
|
@@ -42,14 +43,14 @@ export declare class Query<TQueryFnData = unknown, TError = DefaultError, TData
|
|
|
42
43
|
get meta(): QueryMeta | undefined;
|
|
43
44
|
get success$(): Observable<{
|
|
44
45
|
data: TData | undefined;
|
|
45
|
-
status: import(
|
|
46
|
+
status: import('../types').QueryStatus;
|
|
46
47
|
}>;
|
|
47
48
|
get error$(): Observable<{
|
|
48
49
|
error: TError | null;
|
|
49
|
-
status: import(
|
|
50
|
+
status: import('../types').QueryStatus;
|
|
50
51
|
}>;
|
|
51
52
|
get settled$(): Observable<{
|
|
52
|
-
status: import(
|
|
53
|
+
status: import('../types').QueryStatus;
|
|
53
54
|
}>;
|
|
54
55
|
observe(observer: QueryObserver<any, any, any, any, any>): Observable<QueryState<TData, TError>>;
|
|
55
56
|
getObserversCount(): number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { QueryState } from './types';
|
|
2
|
+
import { QueryOptions } from '../types';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
4
5
|
type Result<TData, TError> = Partial<QueryState<TData, TError>>;
|
|
5
|
-
export declare const delayOnNetworkMode: <TData, TError>(options: Pick<QueryOptions, "networkMode">) => (source: Observable<
|
|
6
|
+
export declare const delayOnNetworkMode: <TData, TError>(options: Pick<QueryOptions, "networkMode">) => (source: Observable<Result<TData, TError>>) => Observable<Result<TData, TError>>;
|
|
6
7
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { QueryOptions } from '../../types';
|
|
2
|
+
import { QueryState } from '../types';
|
|
3
|
+
import { QueryKey } from '../../../keys/types';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
export declare const executeQuery: <TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: QueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
6
7
|
queryKey: TQueryKey;
|
|
7
8
|
onSignalConsumed: () => void;
|
|
8
9
|
observers$: Observable<number>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { QueryState } from './types';
|
|
2
|
+
import { QueryOptions } from '../types';
|
|
3
|
+
import { QueryKey } from '../../keys/types';
|
|
4
|
+
|
|
4
5
|
export declare function getDefaultState<TQueryFnData, TError, TData, TQueryKey extends QueryKey>(options: QueryOptions<TQueryFnData, TError, TData, TQueryKey>): QueryState<TData, TError>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { QueryState } from './types';
|
|
2
|
+
import { QueryOptions } from '../types';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
4
5
|
export declare const reduceState: <TQueryFnData = unknown, TError = Error, TData = TQueryFnData>({ getOptions, getState, initialState }: {
|
|
5
6
|
initialState: QueryState<TData, TError>;
|
|
6
7
|
getState: () => QueryState<TData, TError>;
|
|
7
|
-
getOptions: () => QueryOptions<TQueryFnData, TError, TData, any
|
|
8
|
+
getOptions: () => QueryOptions<TQueryFnData, TError, TData, any>;
|
|
8
9
|
}) => (source: Observable<{
|
|
9
10
|
command: "invalidate" | "cancel" | "reset" | "setData" | "execute";
|
|
10
11
|
state: Partial<QueryState<TData, TError>>;
|