From 4c850b55bd624377c9c8d101a03de8f20b8b8f1d Mon Sep 17 00:00:00 2001 From: John Crowson Date: Mon, 22 Apr 2019 16:32:33 -0400 Subject: [PATCH] refactor(data): rename NgRxDataModule to EntityDataModule (#1780) Closes #1777 --- ...ule.spec.ts => entity-data.module.spec.ts} | 8 ++++---- .../entity-collection-service.spec.ts | 4 ++-- .../entity-services/entity-services.spec.ts | 4 ++-- .../related-entity-selectors.spec.ts | 6 +++--- ... => entity-data-without-effects.module.ts} | 8 ++++---- ...x-data.module.ts => entity-data.module.ts} | 20 +++++++++---------- modules/data/src/index.ts | 10 +++++----- projects/ngrx.io/content/guide/data/index.md | 6 +++--- 8 files changed, 33 insertions(+), 33 deletions(-) rename modules/data/spec/{ngrx-data.module.spec.ts => entity-data.module.spec.ts} (98%) rename modules/data/src/{ngrx-data-without-effects.module.ts => entity-data-without-effects.module.ts} (96%) rename modules/data/src/{ngrx-data.module.ts => entity-data.module.ts} (87%) diff --git a/modules/data/spec/ngrx-data.module.spec.ts b/modules/data/spec/entity-data.module.spec.ts similarity index 98% rename from modules/data/spec/ngrx-data.module.spec.ts rename to modules/data/spec/entity-data.module.spec.ts index 7aeda6f2c4..93f401fd30 100644 --- a/modules/data/spec/ngrx-data.module.spec.ts +++ b/modules/data/spec/entity-data.module.spec.ts @@ -20,7 +20,7 @@ import { persistOps, EntityAction, EntityActionFactory, - NgrxDataModule, + EntityDataModule, EntityCacheEffects, EntityEffects, EntityOp, @@ -71,7 +71,7 @@ const entityMetadata = { //////// Tests begin //////// -describe('NgrxDataModule', () => { +describe('EntityDataModule', () => { describe('with replaced EntityEffects', () => { // factory never changes in these tests const entityActionFactory = new EntityActionFactory(); @@ -85,7 +85,7 @@ describe('NgrxDataModule', () => { imports: [ StoreModule.forRoot({}), EffectsModule.forRoot([]), - NgrxDataModule.forRoot({ + EntityDataModule.forRoot({ entityMetadata: entityMetadata, }), ], @@ -152,7 +152,7 @@ describe('NgrxDataModule', () => { imports: [ StoreModule.forRoot({}), EffectsModule.forRoot([]), - NgrxDataModule.forRoot({ + EntityDataModule.forRoot({ entityMetadata: entityMetadata, entityCacheMetaReducers: [ loggingEntityCacheMetaReducer, diff --git a/modules/data/spec/entity-services/entity-collection-service.spec.ts b/modules/data/spec/entity-services/entity-collection-service.spec.ts index ecce6dfd06..06e10d1334 100644 --- a/modules/data/spec/entity-services/entity-collection-service.spec.ts +++ b/modules/data/spec/entity-services/entity-collection-service.spec.ts @@ -27,7 +27,7 @@ import { EntityCollection, EntityOp, EntityMetadataMap, - NgrxDataModule, + EntityDataModule, EntityCacheEffects, EntityDataService, EntityDispatcherFactory, @@ -471,7 +471,7 @@ function entityServicesSetup() { imports: [ StoreModule.forRoot({}), EffectsModule.forRoot([]), - NgrxDataModule.forRoot({ + EntityDataModule.forRoot({ entityMetadata: entityMetadata, }), ], diff --git a/modules/data/spec/entity-services/entity-services.spec.ts b/modules/data/spec/entity-services/entity-services.spec.ts index 274c4bbf18..a2f8d3f36e 100644 --- a/modules/data/spec/entity-services/entity-services.spec.ts +++ b/modules/data/spec/entity-services/entity-services.spec.ts @@ -21,7 +21,7 @@ import { EntityCacheQuerySet, MergeQuerySet, EntityMetadataMap, - NgrxDataModule, + EntityDataModule, EntityCacheEffects, EntityDataService, EntityActionFactory, @@ -202,7 +202,7 @@ function entityServicesSetup() { imports: [ StoreModule.forRoot({}), EffectsModule.forRoot([]), - NgrxDataModule.forRoot({ + EntityDataModule.forRoot({ entityMetadata: entityMetadata, }), ], diff --git a/modules/data/spec/selectors/related-entity-selectors.spec.ts b/modules/data/spec/selectors/related-entity-selectors.spec.ts index feec4ca931..0d56cd407f 100644 --- a/modules/data/spec/selectors/related-entity-selectors.spec.ts +++ b/modules/data/spec/selectors/related-entity-selectors.spec.ts @@ -17,7 +17,7 @@ import { EntityActionFactory, EntitySelectorsFactory, EntityCache, - NgrxDataModuleWithoutEffects, + EntityDataModuleWithoutEffects, ENTITY_METADATA_TOKEN, EntityOp, EntityAction, @@ -41,9 +41,9 @@ describe('Related-entity Selectors', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [StoreModule.forRoot({}), NgrxDataModuleWithoutEffects], + imports: [StoreModule.forRoot({}), EntityDataModuleWithoutEffects], providers: [ - // required by NgrxData but not used in these tests + // required by EntityData but not used in these tests { provide: Actions, useValue: null }, { provide: ENTITY_METADATA_TOKEN, diff --git a/modules/data/src/ngrx-data-without-effects.module.ts b/modules/data/src/entity-data-without-effects.module.ts similarity index 96% rename from modules/data/src/ngrx-data-without-effects.module.ts rename to modules/data/src/entity-data-without-effects.module.ts index 871d9ffdbe..4acb6f090b 100644 --- a/modules/data/src/ngrx-data-without-effects.module.ts +++ b/modules/data/src/entity-data-without-effects.module.ts @@ -62,7 +62,7 @@ import { EntityServicesBase } from './entity-services/entity-services-base'; import { EntityServicesElements } from './entity-services/entity-services-elements'; import { Logger, Pluralizer, PLURAL_NAMES_TOKEN } from './utils/interfaces'; -export interface NgrxDataModuleConfig { +export interface EntityDataModuleConfig { entityMetadata?: EntityMetadataMap; entityCacheMetaReducers?: ( | MetaReducer @@ -106,12 +106,12 @@ export interface NgrxDataModuleConfig { { provide: Logger, useClass: DefaultLogger }, ], }) -export class NgrxDataModuleWithoutEffects implements OnDestroy { +export class EntityDataModuleWithoutEffects implements OnDestroy { private entityCacheFeature: any; - static forRoot(config: NgrxDataModuleConfig): ModuleWithProviders { + static forRoot(config: EntityDataModuleConfig): ModuleWithProviders { return { - ngModule: NgrxDataModuleWithoutEffects, + ngModule: EntityDataModuleWithoutEffects, providers: [ { provide: ENTITY_CACHE_META_REDUCERS, diff --git a/modules/data/src/ngrx-data.module.ts b/modules/data/src/entity-data.module.ts similarity index 87% rename from modules/data/src/ngrx-data.module.ts rename to modules/data/src/entity-data.module.ts index 5444ff6ac2..2410a98b53 100644 --- a/modules/data/src/ngrx-data.module.ts +++ b/modules/data/src/entity-data.module.ts @@ -29,18 +29,18 @@ import { Pluralizer, PLURAL_NAMES_TOKEN } from './utils/interfaces'; import { DefaultPluralizer } from './utils/default-pluralizer'; import { - NgrxDataModuleConfig, - NgrxDataModuleWithoutEffects, -} from './ngrx-data-without-effects.module'; + EntityDataModuleConfig, + EntityDataModuleWithoutEffects, +} from './entity-data-without-effects.module'; /** - * Ngrx-data main module includes effects and HTTP data services + * entity-data main module includes effects and HTTP data services * Configure with `forRoot`. * No `forFeature` yet. */ @NgModule({ imports: [ - NgrxDataModuleWithoutEffects, + EntityDataModuleWithoutEffects, EffectsModule, // do not supply effects because can't replace later ], providers: [ @@ -57,12 +57,12 @@ import { { provide: Pluralizer, useClass: DefaultPluralizer }, ], }) -export class NgrxDataModule { - static forRoot(config: NgrxDataModuleConfig): ModuleWithProviders { +export class EntityDataModule { + static forRoot(config: EntityDataModuleConfig): ModuleWithProviders { return { - ngModule: NgrxDataModule, + ngModule: EntityDataModule, providers: [ - // TODO: Moved these effects classes up to NgrxDataModule itself + // TODO: Moved these effects classes up to EntityDataModule itself // Remove this comment if that was a mistake. // EntityCacheEffects, // EntityEffects, @@ -98,7 +98,7 @@ export class NgrxDataModule { entityEffects: EntityEffects ) { // We can't use `forFeature()` because, if we did, the developer could not - // replace the ngrx-data `EntityEffects` with a custom alternative. + // replace the entity-data `EntityEffects` with a custom alternative. // Replacing that class is an extensibility point we need. // // The FEATURE_EFFECTS token is not exposed, so can't use that technique. diff --git a/modules/data/src/index.ts b/modules/data/src/index.ts index dac87e8e00..c561cd12c2 100644 --- a/modules/data/src/index.ts +++ b/modules/data/src/index.ts @@ -73,9 +73,9 @@ export * from './utils/guid-fns'; export * from './utils/interfaces'; export * from './utils/utilities'; -// NgrxDataModule -export { NgrxDataModule } from './ngrx-data.module'; +// EntityDataModule +export { EntityDataModule } from './entity-data.module'; export { - NgrxDataModuleWithoutEffects, - NgrxDataModuleConfig, -} from './ngrx-data-without-effects.module'; + EntityDataModuleWithoutEffects, + EntityDataModuleConfig, +} from './entity-data-without-effects.module'; diff --git a/projects/ngrx.io/content/guide/data/index.md b/projects/ngrx.io/content/guide/data/index.md index 51823aa7d6..1670bd5ecb 100644 --- a/projects/ngrx.io/content/guide/data/index.md +++ b/projects/ngrx.io/content/guide/data/index.md @@ -52,20 +52,20 @@ Export the entity configuration to be used when registering it in your `AppModul ## Registering the entity store -Once the entity configuration is created, you need to put it into the root store for NgRx. This is done by importing the `entityConfig` and then passing it to the `NgrxDataModule.forRoot()` function. +Once the entity configuration is created, you need to put it into the root store for NgRx. This is done by importing the `entityConfig` and then passing it to the `EntityDataModule.forRoot()` function. import { NgModule } from '@angular/core'; import { EffectsModule } from '@ngrx/effects'; import { StoreModule } from '@ngrx/store'; -import { DefaultDataServiceConfig, NgrxDataModule } from '@ngrx/data'; +import { DefaultDataServiceConfig, EntityDataModule } from '@ngrx/data'; import { entityConfig } from './entity-metadata'; @NgModule({ imports: [ StoreModule.forRoot({}), EffectsModule.forRoot([]), - NgrxDataModule.forRoot(entityConfig) + EntityDataModule.forRoot(entityConfig) ] }) export class AppModule {}