@ngrx/data 15.0.0-beta.0 → 15.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/esm2020/src/actions/entity-action-factory.mjs +4 -4
  2. package/esm2020/src/dataservices/default-data.service.mjs +4 -4
  3. package/esm2020/src/dataservices/entity-cache-data.service.mjs +4 -4
  4. package/esm2020/src/dataservices/entity-data.service.mjs +4 -4
  5. package/esm2020/src/dataservices/http-url-generator.mjs +4 -4
  6. package/esm2020/src/dataservices/persistence-result-handler.service.mjs +4 -4
  7. package/esm2020/src/dispatchers/entity-cache-dispatcher.mjs +4 -4
  8. package/esm2020/src/dispatchers/entity-dispatcher-default-options.mjs +4 -4
  9. package/esm2020/src/dispatchers/entity-dispatcher-factory.mjs +4 -4
  10. package/esm2020/src/effects/entity-cache-effects.mjs +4 -4
  11. package/esm2020/src/effects/entity-effects.mjs +4 -4
  12. package/esm2020/src/entity-data-config.mjs +2 -0
  13. package/esm2020/src/entity-data-without-effects.module.mjs +10 -141
  14. package/esm2020/src/entity-data.module.mjs +11 -102
  15. package/esm2020/src/entity-metadata/entity-definition.service.mjs +4 -4
  16. package/esm2020/src/entity-services/entity-collection-service-elements-factory.mjs +4 -4
  17. package/esm2020/src/entity-services/entity-collection-service-factory.mjs +4 -4
  18. package/esm2020/src/entity-services/entity-services-base.mjs +4 -4
  19. package/esm2020/src/entity-services/entity-services-elements.mjs +4 -4
  20. package/esm2020/src/index.mjs +4 -2
  21. package/esm2020/src/provide-entity-data.mjs +222 -0
  22. package/esm2020/src/reducers/entity-cache-reducer.mjs +4 -4
  23. package/esm2020/src/reducers/entity-collection-creator.mjs +4 -4
  24. package/esm2020/src/reducers/entity-collection-reducer-methods.mjs +4 -4
  25. package/esm2020/src/reducers/entity-collection-reducer-registry.mjs +4 -4
  26. package/esm2020/src/reducers/entity-collection-reducer.mjs +4 -4
  27. package/esm2020/src/selectors/entity-selectors$.mjs +4 -4
  28. package/esm2020/src/selectors/entity-selectors.mjs +4 -4
  29. package/esm2020/src/utils/correlation-id-generator.mjs +4 -4
  30. package/esm2020/src/utils/default-logger.mjs +4 -4
  31. package/esm2020/src/utils/default-pluralizer.mjs +4 -4
  32. package/fesm2015/ngrx-data.mjs +293 -292
  33. package/fesm2015/ngrx-data.mjs.map +1 -1
  34. package/fesm2020/ngrx-data.mjs +293 -290
  35. package/fesm2020/ngrx-data.mjs.map +1 -1
  36. package/package.json +6 -6
  37. package/schematics-core/utility/libs-version.js +1 -1
  38. package/schematics-core/utility/libs-version.js.map +1 -1
  39. package/src/entity-data-config.d.ts +15 -0
  40. package/src/entity-data-without-effects.module.d.ts +5 -28
  41. package/src/entity-data.module.d.ts +2 -14
  42. package/src/index.d.ts +3 -1
  43. package/src/provide-entity-data.d.ts +78 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrx/data",
3
- "version": "15.0.0-beta.0",
3
+ "version": "15.0.0-beta.1",
4
4
  "description": "API management for NgRx",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,11 +20,11 @@
20
20
  },
21
21
  "homepage": "https://github.com/ngrx/platform#readme",
22
22
  "peerDependencies": {
23
- "@angular/common": "^15.0.0-rc.0",
24
- "@angular/core": "^15.0.0-rc.0",
25
- "@ngrx/store": "15.0.0-beta.0",
26
- "@ngrx/effects": "15.0.0-beta.0",
27
- "@ngrx/entity": "15.0.0-beta.0",
23
+ "@angular/common": "^15.0.0",
24
+ "@angular/core": "^15.0.0",
25
+ "@ngrx/store": "15.0.0-beta.1",
26
+ "@ngrx/effects": "15.0.0-beta.1",
27
+ "@ngrx/entity": "15.0.0-beta.1",
28
28
  "rxjs": "^6.5.3 || ^7.5.0"
29
29
  },
30
30
  "schematics": "./schematics/collection.json",
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
3
  exports.platformVersion = void 0;
4
- exports.platformVersion = '^15.0.0-beta.0';
4
+ exports.platformVersion = '^15.0.0-beta.1';
5
5
  //# sourceMappingURL=libs-version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAC","sourcesContent":["export const platformVersion = '^15.0.0-beta.0';\n"]}
1
+ {"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAC","sourcesContent":["export const platformVersion = '^15.0.0-beta.1';\n"]}
@@ -0,0 +1,15 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { MetaReducer } from '@ngrx/store';
3
+ import { EntityCache } from './reducers/entity-cache';
4
+ import { EntityAction } from './actions/entity-action';
5
+ import { EntityMetadataMap } from './entity-metadata/entity-metadata';
6
+ import { EntityCollection } from './reducers/entity-collection';
7
+ export interface EntityDataModuleConfig {
8
+ entityMetadata?: EntityMetadataMap;
9
+ entityCacheMetaReducers?: (MetaReducer<EntityCache> | InjectionToken<MetaReducer<EntityCache>>)[];
10
+ entityCollectionMetaReducers?: MetaReducer<EntityCollection, EntityAction>[];
11
+ initialEntityCacheState?: EntityCache | (() => EntityCache);
12
+ pluralNames?: {
13
+ [name: string]: string;
14
+ };
15
+ }
@@ -1,38 +1,15 @@
1
- import { ModuleWithProviders, Injector, InjectionToken, OnDestroy } from '@angular/core';
2
- import { Action, MetaReducer, ReducerManager } from '@ngrx/store';
3
- import { EntityAction } from './actions/entity-action';
4
- import { EntityCache } from './reducers/entity-cache';
5
- import { EntityCollection } from './reducers/entity-collection';
6
- import { EntityMetadataMap } from './entity-metadata/entity-metadata';
7
- import { EntityCacheReducerFactory } from './reducers/entity-cache-reducer';
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { EntityDataModuleConfig } from './entity-data-config';
8
3
  import * as i0 from "@angular/core";
9
- import * as i1 from "@ngrx/store";
10
- export interface EntityDataModuleConfig {
11
- entityMetadata?: EntityMetadataMap;
12
- entityCacheMetaReducers?: (MetaReducer<EntityCache, Action> | InjectionToken<MetaReducer<EntityCache, Action>>)[];
13
- entityCollectionMetaReducers?: MetaReducer<EntityCollection, EntityAction>[];
14
- initialEntityCacheState?: EntityCache | (() => EntityCache);
15
- pluralNames?: {
16
- [name: string]: string;
17
- };
18
- }
19
4
  /**
20
5
  * Module without effects or dataservices which means no HTTP calls
21
6
  * This module helpful for internal testing.
22
7
  * Also helpful for apps that handle server access on their own and
23
8
  * therefore opt-out of @ngrx/effects for entities
24
9
  */
25
- export declare class EntityDataModuleWithoutEffects implements OnDestroy {
26
- private reducerManager;
27
- private injector;
28
- private entityCacheName;
29
- private initialState;
30
- private metaReducers;
31
- private entityCacheFeature;
10
+ export declare class EntityDataModuleWithoutEffects {
32
11
  static forRoot(config: EntityDataModuleConfig): ModuleWithProviders<EntityDataModuleWithoutEffects>;
33
- constructor(reducerManager: ReducerManager, entityCacheReducerFactory: EntityCacheReducerFactory, injector: Injector, entityCacheName: string, initialState: any, metaReducers: (MetaReducer<EntityCache, Action> | InjectionToken<MetaReducer<EntityCache, Action>>)[]);
34
- ngOnDestroy(): void;
35
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataModuleWithoutEffects, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
36
- static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModuleWithoutEffects, never, [typeof i1.StoreModule], never>;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataModuleWithoutEffects, never>;
13
+ static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModuleWithoutEffects, never, never, never>;
37
14
  static ɵinj: i0.ɵɵInjectorDeclaration<EntityDataModuleWithoutEffects>;
38
15
  }
@@ -1,27 +1,15 @@
1
1
  import { ModuleWithProviders } from '@angular/core';
2
- import { EffectSources } from '@ngrx/effects';
3
- import { EntityCacheEffects } from './effects/entity-cache-effects';
4
- import { EntityEffects } from './effects/entity-effects';
5
- import { EntityDataModuleConfig } from './entity-data-without-effects.module';
2
+ import { EntityDataModuleConfig } from './entity-data-config';
6
3
  import * as i0 from "@angular/core";
7
4
  import * as i1 from "./entity-data-without-effects.module";
8
- import * as i2 from "@ngrx/effects";
9
5
  /**
10
6
  * entity-data main module includes effects and HTTP data services
11
7
  * Configure with `forRoot`.
12
8
  * No `forFeature` yet.
13
9
  */
14
10
  export declare class EntityDataModule {
15
- private effectSources;
16
11
  static forRoot(config: EntityDataModuleConfig): ModuleWithProviders<EntityDataModule>;
17
- constructor(effectSources: EffectSources, entityCacheEffects: EntityCacheEffects, entityEffects: EntityEffects);
18
- /**
19
- * Add another class instance that contains effects.
20
- * @param effectSourceInstance a class instance that implements effects.
21
- * Warning: undocumented @ngrx/effects API
22
- */
23
- addEffects(effectSourceInstance: any): void;
24
12
  static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataModule, never>;
25
- static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModule, never, [typeof i1.EntityDataModuleWithoutEffects, typeof i2.EffectsModule], never>;
13
+ static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModule, never, [typeof i1.EntityDataModuleWithoutEffects], never>;
26
14
  static ɵinj: i0.ɵɵInjectorDeclaration<EntityDataModule>;
27
15
  }
package/src/index.d.ts CHANGED
@@ -59,5 +59,7 @@ export { DefaultPluralizer } from './utils/default-pluralizer';
59
59
  export { getGuid, getGuidComb, guidComparer } from './utils/guid-fns';
60
60
  export { Logger, EntityPluralNames, PLURAL_NAMES_TOKEN, Pluralizer, } from './utils/interfaces';
61
61
  export { defaultSelectId, flattenArgs, toUpdateFactory, } from './utils/utilities';
62
- export { EntityDataModuleConfig, EntityDataModuleWithoutEffects, } from './entity-data-without-effects.module';
62
+ export { EntityDataModuleConfig } from './entity-data-config';
63
+ export { EntityDataModuleWithoutEffects } from './entity-data-without-effects.module';
63
64
  export { EntityDataModule } from './entity-data.module';
65
+ export { provideEntityData, withEffects } from './provide-entity-data';
@@ -0,0 +1,78 @@
1
+ import { EnvironmentProviders, Provider } from '@angular/core';
2
+ import { EntityDataModuleConfig } from './entity-data-config';
3
+ export declare const BASE_ENTITY_DATA_PROVIDERS: Provider[];
4
+ export declare const ENTITY_DATA_EFFECTS_PROVIDERS: Provider[];
5
+ export declare function provideEntityDataConfig(config: EntityDataModuleConfig): Provider[];
6
+ /**
7
+ * Sets up base entity data providers with entity config.
8
+ * This function should to be used at the root level.
9
+ *
10
+ * @usageNotes
11
+ *
12
+ * ### Providing entity data with effects
13
+ *
14
+ * When used with `withEffects` feature, the `provideEntityData` function is
15
+ * an alternative to `EntityDataModule.forRoot`
16
+ *
17
+ * ```ts
18
+ * import { provideStore } from '@ngrx/store';
19
+ * import { provideEffects } from '@ngrx/effects';
20
+ * import {
21
+ * EntityMetadataMap,
22
+ * provideEntityData,
23
+ * withEffects,
24
+ * } from '@ngrx/data';
25
+ *
26
+ * const entityMetadata: EntityMetadataMap = {
27
+ * Hero: {},
28
+ * Villain: {},
29
+ * };
30
+ * const pluralNames = { Hero: 'Heroes' };
31
+ *
32
+ * bootstrapApplication(AppComponent, {
33
+ * providers: [
34
+ * provideStore(),
35
+ * provideEffects(),
36
+ * provideEntityData({ entityMetadata, pluralNames }, withEffects()),
37
+ * ],
38
+ * });
39
+ * ```
40
+ *
41
+ * ### Providing entity data without effects
42
+ *
43
+ * When used without `withEffects` feature, the `provideEntityData` function is
44
+ * an alternative to `EntityDataModuleWithoutEffects.forRoot`.
45
+ *
46
+ * ```ts
47
+ * import { provideStore } from '@ngrx/store';
48
+ * import { EntityMetadataMap, provideEntityData } from '@ngrx/data';
49
+ *
50
+ * const entityMetadata: EntityMetadataMap = {
51
+ * Musician: {},
52
+ * Song: {},
53
+ * };
54
+ *
55
+ * bootstrapApplication(AppComponent, {
56
+ * providers: [
57
+ * provideStore(),
58
+ * provideEntityData({ entityMetadata }),
59
+ * ],
60
+ * });
61
+ * ```
62
+ *
63
+ */
64
+ export declare function provideEntityData(config: EntityDataModuleConfig, ...features: EntityDataFeature[]): EnvironmentProviders;
65
+ declare enum EntityDataFeatureKind {
66
+ WithEffects = 0
67
+ }
68
+ interface EntityDataFeature {
69
+ ɵkind: EntityDataFeatureKind;
70
+ ɵproviders: Provider[];
71
+ }
72
+ /**
73
+ * Registers entity data effects and provides HTTP data services.
74
+ *
75
+ * @see `provideEntityData`
76
+ */
77
+ export declare function withEffects(): EntityDataFeature;
78
+ export {};