import { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs'; import { Api, ApiContext } from '../apiTypes'; import { BaseQueryFn, BaseQueryArg, BaseQueryError } from '../baseQueryTypes'; import { RootState, QueryKeys, QuerySubstateIdentifier } from './apiState'; import { StartQueryActionCreatorOptions } from './buildInitiate'; import { AssertTagTypes, EndpointDefinition, EndpointDefinitions, MutationDefinition, QueryArgFrom, QueryDefinition, ResultTypeFrom } from '../endpointDefinitions'; import { Draft } from '@reduxjs/toolkit'; import { Patch } from 'immer'; import { AnyAction, ThunkAction, AsyncThunk } from '@reduxjs/toolkit'; import { PrefetchOptions } from './module'; import { UnwrapPromise } from '../tsHelpers'; declare module './module' { interface ApiEndpointQuery, Definitions extends EndpointDefinitions> extends Matchers { } interface ApiEndpointMutation, Definitions extends EndpointDefinitions> extends Matchers { } } declare type EndpointThunk, Definition extends EndpointDefinition> = Definition extends EndpointDefinition ? Thunk extends AsyncThunk ? AsyncThunk; }> : never : never; export declare type PendingAction, Definition extends EndpointDefinition> = ReturnType['pending']>; export declare type FulfilledAction, Definition extends EndpointDefinition> = ReturnType['fulfilled']>; export declare type RejectedAction, Definition extends EndpointDefinition> = ReturnType['rejected']>; export declare type Matcher = (value: any) => value is M; export interface Matchers, Definition extends EndpointDefinition> { matchPending: Matcher>; matchFulfilled: Matcher>; matchRejected: Matcher>; } export interface QueryThunkArg<_InternalQueryArgs> extends QuerySubstateIdentifier, StartQueryActionCreatorOptions { originalArgs: unknown; endpointName: string; startedTimeStamp: number; } export interface MutationThunkArg<_InternalQueryArgs> { originalArgs: unknown; endpointName: string; track?: boolean; startedTimeStamp: number; } export interface ThunkResult { fulfilledTimeStamp: number; result: unknown; } export declare type QueryThunk = AsyncThunk, {}>; export declare type MutationThunk = AsyncThunk, {}>; declare type MaybeDrafted = T | Draft; declare type Recipe = (data: MaybeDrafted) => void | MaybeDrafted; export declare type PatchQueryResultThunk = >(endpointName: EndpointName, args: QueryArgFrom, patches: Patch[]) => ThunkAction; export declare type UpdateQueryResultThunk = >(endpointName: EndpointName, args: QueryArgFrom, updateRecipe: Recipe>) => ThunkAction; declare type PatchCollection = { patches: Patch[]; inversePatches: Patch[]; }; export declare function buildThunks({ reducerPath, baseQuery, context: { endpointDefinitions }, serializeQueryArgs, api, }: { baseQuery: BaseQuery; reducerPath: ReducerPath; context: ApiContext; serializeQueryArgs: InternalSerializeQueryArgs>; api: Api; }): { queryThunk: AsyncThunk any ? A : any>, { state: RootState; }>; mutationThunk: AsyncThunk any ? A : any>, { state: RootState; }>; prefetch: (endpointName: EndpointName, arg: any, options: PrefetchOptions) => ThunkAction; updateQueryResult: UpdateQueryResultThunk; }>; patchQueryResult: PatchQueryResultThunk; }>; buildMatchThunkActions: , any> | AsyncThunk, any>>(thunk: Thunk, endpointName: string) => Matchers; }; export declare function calculateProvidedByThunk(action: UnwrapPromise> | ReturnType>>, type: 'providesTags' | 'invalidatesTags', endpointDefinitions: EndpointDefinitions, assertTagType: AssertTagTypes): readonly import("../endpointDefinitions").FullTagDescription[]; export {}; //# sourceMappingURL=buildThunks.d.ts.map