@ngrx/data 20.0.1 → 21.0.0-beta.0

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 (102) hide show
  1. package/fesm2022/ngrx-data.mjs +87 -87
  2. package/fesm2022/ngrx-data.mjs.map +1 -1
  3. package/package.json +8 -8
  4. package/schematics/ng-add/index.js +39 -42
  5. package/schematics/ng-add/index.js.map +1 -1
  6. package/schematics/ng-add/schema.js +0 -2
  7. package/schematics-core/index.js +24 -75
  8. package/schematics-core/index.js.map +1 -1
  9. package/schematics-core/utility/ast-utils.js +28 -44
  10. package/schematics-core/utility/ast-utils.js.map +1 -1
  11. package/schematics-core/utility/change.js +8 -15
  12. package/schematics-core/utility/change.js.map +1 -1
  13. package/schematics-core/utility/config.js +4 -8
  14. package/schematics-core/utility/config.js.map +1 -1
  15. package/schematics-core/utility/find-component.js +17 -22
  16. package/schematics-core/utility/find-component.js.map +1 -1
  17. package/schematics-core/utility/find-module.js +19 -24
  18. package/schematics-core/utility/find-module.js.map +1 -1
  19. package/schematics-core/utility/json-utilts.js +1 -4
  20. package/schematics-core/utility/json-utilts.js.map +1 -1
  21. package/schematics-core/utility/libs-version.js +1 -4
  22. package/schematics-core/utility/libs-version.js.map +1 -1
  23. package/schematics-core/utility/ngrx-utils.js +28 -36
  24. package/schematics-core/utility/ngrx-utils.js.map +1 -1
  25. package/schematics-core/utility/package.js +1 -4
  26. package/schematics-core/utility/package.js.map +1 -1
  27. package/schematics-core/utility/parse-name.js +5 -8
  28. package/schematics-core/utility/parse-name.js.map +1 -1
  29. package/schematics-core/utility/project.js +9 -15
  30. package/schematics-core/utility/project.js.map +1 -1
  31. package/schematics-core/utility/standalone.js +13 -18
  32. package/schematics-core/utility/standalone.js.map +1 -1
  33. package/schematics-core/utility/strings.js +9 -20
  34. package/schematics-core/utility/strings.js.map +1 -1
  35. package/schematics-core/utility/update.js +4 -7
  36. package/schematics-core/utility/update.js.map +1 -1
  37. package/schematics-core/utility/visitors.js +16 -30
  38. package/schematics-core/utility/visitors.js.map +1 -1
  39. package/types/ngrx-data.d.ts +3465 -0
  40. package/index.d.ts +0 -6
  41. package/public_api.d.ts +0 -1
  42. package/src/actions/entity-action-factory.d.ts +0 -38
  43. package/src/actions/entity-action-guard.d.ts +0 -33
  44. package/src/actions/entity-action-operators.d.ts +0 -30
  45. package/src/actions/entity-action.d.ts +0 -37
  46. package/src/actions/entity-cache-action.d.ts +0 -147
  47. package/src/actions/entity-cache-change-set.d.ts +0 -66
  48. package/src/actions/entity-op.d.ts +0 -70
  49. package/src/actions/merge-strategy.d.ts +0 -20
  50. package/src/actions/update-response-data.d.ts +0 -20
  51. package/src/dataservices/data-service-error.d.ts +0 -18
  52. package/src/dataservices/default-data-service-config.d.ts +0 -27
  53. package/src/dataservices/default-data.service.d.ts +0 -57
  54. package/src/dataservices/entity-cache-data.service.d.ts +0 -58
  55. package/src/dataservices/entity-data.service.d.ts +0 -48
  56. package/src/dataservices/http-url-generator.d.ts +0 -94
  57. package/src/dataservices/interfaces.d.ts +0 -61
  58. package/src/dataservices/persistence-result-handler.service.d.ts +0 -30
  59. package/src/dispatchers/entity-cache-dispatcher.d.ts +0 -114
  60. package/src/dispatchers/entity-commands.d.ts +0 -217
  61. package/src/dispatchers/entity-dispatcher-base.d.ts +0 -269
  62. package/src/dispatchers/entity-dispatcher-default-options.d.ts +0 -23
  63. package/src/dispatchers/entity-dispatcher-factory.d.ts +0 -46
  64. package/src/dispatchers/entity-dispatcher.d.ts +0 -58
  65. package/src/effects/entity-cache-effects.d.ts +0 -46
  66. package/src/effects/entity-effects-scheduler.d.ts +0 -4
  67. package/src/effects/entity-effects.d.ts +0 -55
  68. package/src/entity-data-config.d.ts +0 -15
  69. package/src/entity-data-without-effects.module.d.ts +0 -15
  70. package/src/entity-data.module.d.ts +0 -15
  71. package/src/entity-metadata/entity-definition.d.ts +0 -16
  72. package/src/entity-metadata/entity-definition.service.d.ts +0 -62
  73. package/src/entity-metadata/entity-filters.d.ts +0 -12
  74. package/src/entity-metadata/entity-metadata.d.ts +0 -19
  75. package/src/entity-services/entity-collection-service-base.d.ts +0 -299
  76. package/src/entity-services/entity-collection-service-elements-factory.d.ts +0 -28
  77. package/src/entity-services/entity-collection-service-factory.d.ts +0 -22
  78. package/src/entity-services/entity-collection-service.d.ts +0 -37
  79. package/src/entity-services/entity-services-base.d.ts +0 -79
  80. package/src/entity-services/entity-services-elements.d.ts +0 -41
  81. package/src/entity-services/entity-services.d.ts +0 -50
  82. package/src/index.d.ts +0 -65
  83. package/src/provide-entity-data.d.ts +0 -78
  84. package/src/reducers/constants.d.ts +0 -8
  85. package/src/reducers/entity-cache-reducer.d.ts +0 -50
  86. package/src/reducers/entity-cache.d.ts +0 -4
  87. package/src/reducers/entity-change-tracker-base.d.ts +0 -181
  88. package/src/reducers/entity-change-tracker.d.ts +0 -169
  89. package/src/reducers/entity-collection-creator.d.ts +0 -15
  90. package/src/reducers/entity-collection-reducer-methods.d.ts +0 -365
  91. package/src/reducers/entity-collection-reducer-registry.d.ts +0 -47
  92. package/src/reducers/entity-collection-reducer.d.ts +0 -14
  93. package/src/reducers/entity-collection.d.ts +0 -41
  94. package/src/selectors/entity-cache-selector.d.ts +0 -7
  95. package/src/selectors/entity-selectors$.d.ts +0 -63
  96. package/src/selectors/entity-selectors.d.ts +0 -117
  97. package/src/utils/correlation-id-generator.d.ts +0 -20
  98. package/src/utils/default-logger.d.ts +0 -9
  99. package/src/utils/default-pluralizer.d.ts +0 -18
  100. package/src/utils/guid-fns.d.ts +0 -24
  101. package/src/utils/interfaces.d.ts +0 -16
  102. package/src/utils/utilities.d.ts +0 -26
@@ -1,117 +0,0 @@
1
- import { MemoizedSelector } from '@ngrx/store';
2
- import { Selector } from '@ngrx/store';
3
- import { Dictionary } from '@ngrx/entity';
4
- import { EntityCache } from '../reducers/entity-cache';
5
- import { EntityCacheSelector } from './entity-cache-selector';
6
- import { EntityCollection, ChangeStateMap } from '../reducers/entity-collection';
7
- import { EntityCollectionCreator } from '../reducers/entity-collection-creator';
8
- import { EntityMetadata } from '../entity-metadata/entity-metadata';
9
- import * as i0 from "@angular/core";
10
- /**
11
- * The selector functions for entity collection members,
12
- * Selects from the entity collection to the collection member
13
- * Contrast with {EntitySelectors}.
14
- */
15
- export interface CollectionSelectors<T> {
16
- readonly [selector: string]: any;
17
- /** Count of entities in the cached collection. */
18
- readonly selectCount: Selector<EntityCollection<T>, number>;
19
- /** All entities in the cached collection. */
20
- readonly selectEntities: Selector<EntityCollection<T>, T[]>;
21
- /** Map of entity keys to entities */
22
- readonly selectEntityMap: Selector<EntityCollection<T>, Dictionary<T>>;
23
- /** Filter pattern applied by the entity collection's filter function */
24
- readonly selectFilter: Selector<EntityCollection<T>, string>;
25
- /** Entities in the cached collection that pass the filter function */
26
- readonly selectFilteredEntities: Selector<EntityCollection<T>, T[]>;
27
- /** Keys of the cached collection, in the collection's native sort order */
28
- readonly selectKeys: Selector<EntityCollection<T>, string[] | number[]>;
29
- /** True when the collection has been fully loaded. */
30
- readonly selectLoaded: Selector<EntityCollection<T>, boolean>;
31
- /** True when a multi-entity query command is in progress. */
32
- readonly selectLoading: Selector<EntityCollection<T>, boolean>;
33
- /** ChangeState (including original values) of entities with unsaved changes */
34
- readonly selectChangeState: Selector<EntityCollection<T>, ChangeStateMap<T>>;
35
- }
36
- /**
37
- * The selector functions for entity collection members,
38
- * Selects from store root, through EntityCache, to the entity collection member
39
- * Contrast with {CollectionSelectors}.
40
- */
41
- export interface EntitySelectors<T> {
42
- /** Name of the entity collection for these selectors */
43
- readonly entityName: string;
44
- readonly [name: string]: MemoizedSelector<EntityCollection<T>, any> | string;
45
- /** The cached EntityCollection itself */
46
- readonly selectCollection: MemoizedSelector<Object, EntityCollection<T>>;
47
- /** Count of entities in the cached collection. */
48
- readonly selectCount: MemoizedSelector<Object, number>;
49
- /** All entities in the cached collection. */
50
- readonly selectEntities: MemoizedSelector<Object, T[]>;
51
- /** The EntityCache */
52
- readonly selectEntityCache: MemoizedSelector<Object, EntityCache>;
53
- /** Map of entity keys to entities */
54
- readonly selectEntityMap: MemoizedSelector<Object, Dictionary<T>>;
55
- /** Filter pattern applied by the entity collection's filter function */
56
- readonly selectFilter: MemoizedSelector<Object, string>;
57
- /** Entities in the cached collection that pass the filter function */
58
- readonly selectFilteredEntities: MemoizedSelector<Object, T[]>;
59
- /** Keys of the cached collection, in the collection's native sort order */
60
- readonly selectKeys: MemoizedSelector<Object, string[] | number[]>;
61
- /** True when the collection has been fully loaded. */
62
- readonly selectLoaded: MemoizedSelector<Object, boolean>;
63
- /** True when a multi-entity query command is in progress. */
64
- readonly selectLoading: MemoizedSelector<Object, boolean>;
65
- /** ChangeState (including original values) of entities with unsaved changes */
66
- readonly selectChangeState: MemoizedSelector<Object, ChangeStateMap<T>>;
67
- }
68
- /** Creates EntitySelector functions for entity collections. */
69
- export declare class EntitySelectorsFactory {
70
- private entityCollectionCreator;
71
- private selectEntityCache;
72
- constructor(entityCollectionCreator?: EntityCollectionCreator, selectEntityCache?: EntityCacheSelector);
73
- /**
74
- * Create the NgRx selector from the store root to the named collection,
75
- * e.g. from Object to Heroes.
76
- * @param entityName the name of the collection
77
- */
78
- createCollectionSelector<T = any, C extends EntityCollection<T> = EntityCollection<T>>(entityName: string): MemoizedSelector<Object, C, (s1: EntityCache) => C>;
79
- /**
80
- * Creates entity collection selectors from metadata.
81
- * @param metadata - EntityMetadata for the collection.
82
- * May be partial but much have `entityName`.
83
- */
84
- createCollectionSelectors<T, S extends CollectionSelectors<T> = CollectionSelectors<T>>(metadata: EntityMetadata<T>): S;
85
- /**
86
- * Creates default entity collection selectors for an entity type.
87
- * Use the metadata overload for additional collection selectors.
88
- * @param entityName - name of the entity type
89
- */
90
- createCollectionSelectors<T, S extends CollectionSelectors<T> = CollectionSelectors<T>>(entityName: string): S;
91
- /**
92
- * Creates the store-rooted selectors for an entity collection.
93
- * {EntitySelectors$Factory} turns them into selectors$.
94
- *
95
- * @param metadata - EntityMetadata for the collection.
96
- * May be partial but much have `entityName`.
97
- *
98
- * Based on ngrx/entity/state_selectors.ts
99
- * Differs in that these selectors select from the NgRx store root,
100
- * through the collection, to the collection members.
101
- */
102
- create<T, S extends EntitySelectors<T> = EntitySelectors<T>>(metadata: EntityMetadata<T>): S;
103
- /**
104
- * Creates the default store-rooted selectors for an entity collection.
105
- * {EntitySelectors$Factory} turns them into selectors$.
106
- * Use the metadata overload for additional collection selectors.
107
- *
108
- * @param entityName - name of the entity type.
109
- *
110
- * Based on ngrx/entity/state_selectors.ts
111
- * Differs in that these selectors select from the NgRx store root,
112
- * through the collection, to the collection members.
113
- */
114
- create<T, S extends EntitySelectors<T> = EntitySelectors<T>>(entityName: string): S;
115
- static ɵfac: i0.ɵɵFactoryDeclaration<EntitySelectorsFactory, [{ optional: true; }, { optional: true; }]>;
116
- static ɵprov: i0.ɵɵInjectableDeclaration<EntitySelectorsFactory>;
117
- }
@@ -1,20 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- /**
3
- * Generates a string id beginning 'CRID',
4
- * followed by a monotonically increasing integer for use as a correlation id.
5
- * As they are produced locally by a singleton service,
6
- * these ids are guaranteed to be unique only
7
- * for the duration of a single client browser instance.
8
- * Ngrx entity dispatcher query and save methods call this service to generate default correlation ids.
9
- * Do NOT use for entity keys.
10
- */
11
- export declare class CorrelationIdGenerator {
12
- /** Seed for the ids */
13
- protected seed: number;
14
- /** Prefix of the id, 'CRID; */
15
- protected prefix: string;
16
- /** Return the next correlation id */
17
- next(): string;
18
- static ɵfac: i0.ɵɵFactoryDeclaration<CorrelationIdGenerator, never>;
19
- static ɵprov: i0.ɵɵInjectableDeclaration<CorrelationIdGenerator>;
20
- }
@@ -1,9 +0,0 @@
1
- import { Logger } from './interfaces';
2
- import * as i0 from "@angular/core";
3
- export declare class DefaultLogger implements Logger {
4
- error(message?: any, extra?: any): void;
5
- log(message?: any, extra?: any): void;
6
- warn(message?: any, extra?: any): void;
7
- static ɵfac: i0.ɵɵFactoryDeclaration<DefaultLogger, never>;
8
- static ɵprov: i0.ɵɵInjectableDeclaration<DefaultLogger>;
9
- }
@@ -1,18 +0,0 @@
1
- import { EntityPluralNames } from './interfaces';
2
- import * as i0 from "@angular/core";
3
- export declare class DefaultPluralizer {
4
- pluralNames: EntityPluralNames;
5
- constructor(pluralNames: EntityPluralNames[]);
6
- /**
7
- * Pluralize a singular name using common English language pluralization rules
8
- * Examples: "company" -> "companies", "employee" -> "employees", "tax" -> "taxes"
9
- */
10
- pluralize(name: string): string;
11
- /**
12
- * Register a mapping of entity type name to the entity name's plural
13
- * @param pluralNames {EntityPluralNames} plural names for entity types
14
- */
15
- registerPluralNames(pluralNames: EntityPluralNames): void;
16
- static ɵfac: i0.ɵɵFactoryDeclaration<DefaultPluralizer, [{ optional: true; }]>;
17
- static ɵprov: i0.ɵɵInjectableDeclaration<DefaultPluralizer>;
18
- }
@@ -1,24 +0,0 @@
1
- /**
2
- Client-side id-generators
3
-
4
- These GUID utility functions are not used by @ngrx/data itself at this time.
5
- They are included as candidates for generating persistable correlation ids if that becomes desirable.
6
- They are also safe for generating unique entity ids on the client.
7
-
8
- Note they produce 32-character hexadecimal UUID strings,
9
- not the 128-bit representation found in server-side languages and databases.
10
-
11
- These utilities are experimental and may be withdrawn or replaced in future.
12
- */
13
- /** Alias for getUuid(). Compare with getGuidComb(). */
14
- export declare function getGuid(): string;
15
- /**
16
- * Creates a sortable, pseudo-GUID (globally unique identifier)
17
- * whose trailing 6 bytes (12 hex digits) are time-based
18
- * Start either with the given getTime() value, seedTime,
19
- * or get the current time in ms.
20
- *
21
- * @param seed {number} - optional seed for reproducible time-part
22
- */
23
- export declare function getGuidComb(seed?: number): string;
24
- export declare function guidComparer(l: string, r: string): number;
@@ -1,16 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- export declare abstract class Logger {
3
- abstract error(message?: any, ...optionalParams: any[]): void;
4
- abstract log(message?: any, ...optionalParams: any[]): void;
5
- abstract warn(message?: any, ...optionalParams: any[]): void;
6
- }
7
- /**
8
- * Mapping of entity type name to its plural
9
- */
10
- export interface EntityPluralNames {
11
- [entityName: string]: string;
12
- }
13
- export declare const PLURAL_NAMES_TOKEN: InjectionToken<EntityPluralNames>;
14
- export declare abstract class Pluralizer {
15
- abstract pluralize(name: string): string;
16
- }
@@ -1,26 +0,0 @@
1
- import { IdSelector, Update } from '@ngrx/entity';
2
- /**
3
- * Default function that returns the entity's primary key (pkey).
4
- * Assumes that the entity has an `id` pkey property.
5
- * Returns `undefined` if no entity or `id`.
6
- * Every selectId fn must return `undefined` when it cannot produce a full pkey.
7
- */
8
- export declare function defaultSelectId(entity: any): any;
9
- /**
10
- * Flatten first arg if it is an array
11
- * Allows fn with ...rest signature to be called with an array instead of spread
12
- * Example:
13
- * ```
14
- * // See entity-action-operators.ts
15
- * const persistOps = [EntityOp.QUERY_ALL, EntityOp.ADD, ...];
16
- * actions.pipe(ofEntityOp(...persistOps)) // works
17
- * actions.pipe(ofEntityOp(persistOps)) // also works
18
- * ```
19
- * */
20
- export declare function flattenArgs<T>(args?: any[]): T[];
21
- /**
22
- * Return a function that converts an entity (or partial entity) into the `Update<T>`
23
- * whose `id` is the primary key and
24
- * `changes` is the entity (or partial entity of changes).
25
- */
26
- export declare function toUpdateFactory<T>(selectId?: IdSelector<T>): (entity: Partial<T>) => Update<T>;