UNPKG

1.96 kBTypeScriptView Raw
1import { AnyAction, CombinedState, Reducer, ActionCreatorWithPayload, ActionCreatorWithoutPayload } from '@reduxjs/toolkit';
2import type { CombinedState as CombinedQueryState, QuerySubstateIdentifier, MutationSubstateIdentifier, Subscribers, ConfigState } from './apiState';
3import type { MutationThunk, QueryThunk } from './buildThunks';
4import type { AssertTagTypes, EndpointDefinitions } from '../endpointDefinitions';
5import type { Patch } from 'immer';
6import type { ApiContext } from '../apiTypes';
7export declare function buildSlice({ reducerPath, queryThunk, mutationThunk, context: { endpointDefinitions: definitions, apiUid }, assertTagType, config, }: {
8 reducerPath: string;
9 queryThunk: QueryThunk;
10 mutationThunk: MutationThunk;
11 context: ApiContext<EndpointDefinitions>;
12 assertTagType: AssertTagTypes;
13 config: Omit<ConfigState<string>, 'online' | 'focused' | 'middlewareRegistered'>;
14}): {
15 reducer: Reducer<CombinedState<CombinedQueryState<any, string, string>>, AnyAction>;
16 actions: {
17 resetApiState: ActionCreatorWithoutPayload<string>;
18 unsubscribeMutationResult: ActionCreatorWithPayload<MutationSubstateIdentifier, string>;
19 updateSubscriptionOptions: ActionCreatorWithPayload<{
20 endpointName: string;
21 requestId: string;
22 options: Subscribers[number];
23 } & QuerySubstateIdentifier, string>;
24 unsubscribeQueryResult: ActionCreatorWithPayload<{
25 requestId: string;
26 } & QuerySubstateIdentifier, string>;
27 removeQueryResult: ActionCreatorWithPayload<QuerySubstateIdentifier, string>;
28 queryResultPatched: ActionCreatorWithPayload<QuerySubstateIdentifier & {
29 patches: readonly Patch[];
30 }, string>;
31 middlewareRegistered: ActionCreatorWithPayload<string, string>;
32 };
33};
34export declare type SliceActions = ReturnType<typeof buildSlice>['actions'];