@@ -80,7 +80,7 @@ export type CaseReducerWithPrepare<State, Action extends PayloadAction> = {
8080 prepare: PrepareAction <Action [' payload' ]>;
8181};
8282
83- // @alpha (undocumented)
83+ // @public (undocumented)
8484export type Comparer <T > = (a : T , b : T ) => number ;
8585
8686// @public
@@ -104,7 +104,7 @@ export function createAction<P = void, T extends string = string>(type: T): Payl
104104// @public
105105export function createAction<PA extends PrepareAction <any >, T extends string = string >(type : T , prepareAction : PA ): PayloadActionCreator <ReturnType <PA >[' payload' ], T , PA >;
106106
107- // @alpha (undocumented)
107+ // @public (undocumented)
108108export function createAsyncThunk<Returned , ThunkArg = void , ThunkApiConfig extends AsyncThunkConfig = {}>(type : string , payloadCreator : (arg : ThunkArg , thunkAPI : GetThunkAPI <ThunkApiConfig >) => Promise <Returned | RejectWithValue <GetRejectValue <ThunkApiConfig >>> | Returned | RejectWithValue <GetRejectValue <ThunkApiConfig >>): ((arg : ThunkArg ) => (dispatch : GetDispatch <ThunkApiConfig >, getState : () => GetState <ThunkApiConfig >, extra : GetExtra <ThunkApiConfig >) => Promise <PayloadAction <Returned , string , {
109109 arg: ThunkArg ;
110110 requestId: string ;
@@ -130,7 +130,7 @@ export function createAsyncThunk<Returned, ThunkArg = void, ThunkApiConfig exten
130130 }>;
131131};
132132
133- // @alpha (undocumented)
133+ // @public (undocumented)
134134export function createEntityAdapter<T >(options ? : {
135135 selectId? : IdSelector <T >;
136136 sortComparer? : false | Comparer <T >;
@@ -163,7 +163,7 @@ export interface CreateSliceOptions<State = any, CR extends SliceCaseReducers<St
163163 reducers: ValidateSliceCaseReducers <State , CR >;
164164}
165165
166- // @alpha (undocumented)
166+ // @public (undocumented)
167167export interface Dictionary <T > extends DictionaryNum <T > {
168168 // (undocumented)
169169 [id : string ]: T | undefined ;
@@ -176,7 +176,7 @@ export interface EnhancedStore<S = any, A extends Action = AnyAction, M extends
176176 dispatch: DispatchForMiddlewares <M > & Dispatch <A >;
177177}
178178
179- // @alpha (undocumented)
179+ // @public (undocumented)
180180export interface EntityAdapter <T > extends EntityStateAdapter <T > {
181181 // (undocumented)
182182 getInitialState(): EntityState <T >;
@@ -192,14 +192,73 @@ export interface EntityAdapter<T> extends EntityStateAdapter<T> {
192192 sortComparer: false | Comparer <T >;
193193}
194194
195- // @alpha (undocumented)
195+ // @public (undocumented)
196+ export type EntityId = number | string ;
197+
198+ // @public (undocumented)
199+ export interface EntitySelectors <T , V > {
200+ // (undocumented)
201+ selectAll: (state : V ) => T [];
202+ // (undocumented)
203+ selectById: (state : V , id : EntityId ) => T | undefined ;
204+ // (undocumented)
205+ selectEntities: (state : V ) => Dictionary <T >;
206+ // (undocumented)
207+ selectIds: (state : V ) => EntityId [];
208+ // (undocumented)
209+ selectTotal: (state : V ) => number ;
210+ }
211+
212+ // @public (undocumented)
196213export interface EntityState <T > {
197214 // (undocumented)
198215 entities: Dictionary <T >;
199216 // (undocumented)
200217 ids: EntityId [];
201218}
202219
220+ // @public (undocumented)
221+ export interface EntityStateAdapter <T > {
222+ // (undocumented)
223+ addMany<S extends EntityState <T >>(state : PreventAny <S , T >, entities : T [] | Record <EntityId , T >): S ;
224+ // (undocumented)
225+ addMany<S extends EntityState <T >>(state : PreventAny <S , T >, entities : PayloadAction <T [] | Record <EntityId , T >>): S ;
226+ // (undocumented)
227+ addOne<S extends EntityState <T >>(state : PreventAny <S , T >, entity : T ): S ;
228+ // (undocumented)
229+ addOne<S extends EntityState <T >>(state : PreventAny <S , T >, action : PayloadAction <T >): S ;
230+ // (undocumented)
231+ removeAll<S extends EntityState <T >>(state : PreventAny <S , T >): S ;
232+ // (undocumented)
233+ removeMany<S extends EntityState <T >>(state : PreventAny <S , T >, keys : EntityId []): S ;
234+ // (undocumented)
235+ removeMany<S extends EntityState <T >>(state : PreventAny <S , T >, keys : PayloadAction <EntityId []>): S ;
236+ // (undocumented)
237+ removeOne<S extends EntityState <T >>(state : PreventAny <S , T >, key : EntityId ): S ;
238+ // (undocumented)
239+ removeOne<S extends EntityState <T >>(state : PreventAny <S , T >, key : PayloadAction <EntityId >): S ;
240+ // (undocumented)
241+ setAll<S extends EntityState <T >>(state : PreventAny <S , T >, entities : T [] | Record <EntityId , T >): S ;
242+ // (undocumented)
243+ setAll<S extends EntityState <T >>(state : PreventAny <S , T >, entities : PayloadAction <T [] | Record <EntityId , T >>): S ;
244+ // (undocumented)
245+ updateMany<S extends EntityState <T >>(state : PreventAny <S , T >, updates : Update <T >[]): S ;
246+ // (undocumented)
247+ updateMany<S extends EntityState <T >>(state : PreventAny <S , T >, updates : PayloadAction <Update <T >[]>): S ;
248+ // (undocumented)
249+ updateOne<S extends EntityState <T >>(state : PreventAny <S , T >, update : Update <T >): S ;
250+ // (undocumented)
251+ updateOne<S extends EntityState <T >>(state : PreventAny <S , T >, update : PayloadAction <Update <T >>): S ;
252+ // (undocumented)
253+ upsertMany<S extends EntityState <T >>(state : PreventAny <S , T >, entities : T [] | Record <EntityId , T >): S ;
254+ // (undocumented)
255+ upsertMany<S extends EntityState <T >>(state : PreventAny <S , T >, entities : PayloadAction <T [] | Record <EntityId , T >>): S ;
256+ // (undocumented)
257+ upsertOne<S extends EntityState <T >>(state : PreventAny <S , T >, entity : T ): S ;
258+ // (undocumented)
259+ upsertOne<S extends EntityState <T >>(state : PreventAny <S , T >, entity : PayloadAction <T >): S ;
260+ }
261+
203262// @public (undocumented)
204263export function findNonSerializableValue(value : unknown , path ? : ReadonlyArray <string >, isSerializable ? : (value : unknown ) => boolean , getEntries ? : (value : unknown ) => [string , any ][], ignoredPaths ? : string []): NonSerializableValue | false ;
205264
@@ -213,7 +272,7 @@ export function getDefaultMiddleware<S = any, O extends Partial<GetDefaultMiddle
213272// @public
214273export function getType<T extends string >(actionCreator : PayloadActionCreator <any , T >): T ;
215274
216- // @alpha (undocumented)
275+ // @public (undocumented)
217276export type IdSelector <T > = (model : T ) => EntityId ;
218277
219278// @public
@@ -278,7 +337,7 @@ export interface SerializableStateInvariantMiddlewareOptions {
278337 warnAfter? : number ;
279338}
280339
281- // @alpha (undocumented)
340+ // @public (undocumented)
282341export interface SerializedError {
283342 // (undocumented)
284343 code? : string ;
@@ -310,10 +369,10 @@ export { ThunkAction }
310369
311370export { ThunkDispatch }
312371
313- // @alpha (undocumented)
372+ // @public (undocumented)
314373export function unwrapResult<R extends ActionTypesWithOptionalErrorAction >(returned : R ): PayloadForActionTypesExcludingErrorActions <R >;
315374
316- // @alpha (undocumented)
375+ // @public (undocumented)
317376export type Update <T > = {
318377 id: EntityId ;
319378 changes: Partial <T >;
0 commit comments