()
| 86 | ]; |
| 87 | |
| 88 | function initializeBaseEntityData(): void { |
| 89 | const reducerManager = inject(ReducerManager); |
| 90 | const entityCacheReducerFactory = inject(EntityCacheReducerFactory); |
| 91 | const entityCacheName = inject(ENTITY_CACHE_NAME_TOKEN, { |
| 92 | optional: true, |
| 93 | }); |
| 94 | const initialStateOrFn = inject(INITIAL_ENTITY_CACHE_STATE, { |
| 95 | optional: true, |
| 96 | }); |
| 97 | const metaReducersOrTokens = inject< |
| 98 | Array<MetaReducer<EntityCache> | InjectionToken<MetaReducer<EntityCache>>> |
| 99 | >(ENTITY_CACHE_META_REDUCERS, { |
| 100 | optional: true, |
| 101 | }); |
| 102 | |
| 103 | // Add the @ngrx/data feature to the Store's features |
| 104 | const key = entityCacheName || ENTITY_CACHE_NAME; |
| 105 | const metaReducers = (metaReducersOrTokens || []).map((mr) => { |
| 106 | return mr instanceof InjectionToken ? inject(mr) : mr; |
| 107 | }); |
| 108 | const initialState = |
| 109 | typeof initialStateOrFn === 'function' |
| 110 | ? initialStateOrFn() |
| 111 | : initialStateOrFn; |
| 112 | |
| 113 | const entityCacheFeature = { |
| 114 | key, |
| 115 | reducers: entityCacheReducerFactory.create(), |
| 116 | reducerFactory: combineReducers as ActionReducerFactory<EntityCache>, |
| 117 | initialState: initialState || {}, |
| 118 | metaReducers: metaReducers, |
| 119 | }; |
| 120 | reducerManager.addFeature(entityCacheFeature); |
| 121 | } |
| 122 | |
| 123 | export const ENTITY_DATA_EFFECTS_PROVIDERS: Array< |
| 124 | Provider | EnvironmentProviders |
no test coverage detected