@ngrx/data 20.1.0 → 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 (101) hide show
  1. package/fesm2022/ngrx-data.mjs +86 -86
  2. package/package.json +8 -8
  3. package/schematics/ng-add/index.js +39 -42
  4. package/schematics/ng-add/index.js.map +1 -1
  5. package/schematics/ng-add/schema.js +0 -2
  6. package/schematics-core/index.js +24 -75
  7. package/schematics-core/index.js.map +1 -1
  8. package/schematics-core/utility/ast-utils.js +28 -44
  9. package/schematics-core/utility/ast-utils.js.map +1 -1
  10. package/schematics-core/utility/change.js +8 -15
  11. package/schematics-core/utility/change.js.map +1 -1
  12. package/schematics-core/utility/config.js +4 -8
  13. package/schematics-core/utility/config.js.map +1 -1
  14. package/schematics-core/utility/find-component.js +17 -22
  15. package/schematics-core/utility/find-component.js.map +1 -1
  16. package/schematics-core/utility/find-module.js +19 -24
  17. package/schematics-core/utility/find-module.js.map +1 -1
  18. package/schematics-core/utility/json-utilts.js +1 -4
  19. package/schematics-core/utility/json-utilts.js.map +1 -1
  20. package/schematics-core/utility/libs-version.js +1 -4
  21. package/schematics-core/utility/libs-version.js.map +1 -1
  22. package/schematics-core/utility/ngrx-utils.js +28 -36
  23. package/schematics-core/utility/ngrx-utils.js.map +1 -1
  24. package/schematics-core/utility/package.js +1 -4
  25. package/schematics-core/utility/package.js.map +1 -1
  26. package/schematics-core/utility/parse-name.js +5 -8
  27. package/schematics-core/utility/parse-name.js.map +1 -1
  28. package/schematics-core/utility/project.js +9 -15
  29. package/schematics-core/utility/project.js.map +1 -1
  30. package/schematics-core/utility/standalone.js +13 -18
  31. package/schematics-core/utility/standalone.js.map +1 -1
  32. package/schematics-core/utility/strings.js +9 -20
  33. package/schematics-core/utility/strings.js.map +1 -1
  34. package/schematics-core/utility/update.js +4 -7
  35. package/schematics-core/utility/update.js.map +1 -1
  36. package/schematics-core/utility/visitors.js +16 -30
  37. package/schematics-core/utility/visitors.js.map +1 -1
  38. package/types/ngrx-data.d.ts +3465 -0
  39. package/index.d.ts +0 -6
  40. package/public_api.d.ts +0 -1
  41. package/src/actions/entity-action-factory.d.ts +0 -38
  42. package/src/actions/entity-action-guard.d.ts +0 -33
  43. package/src/actions/entity-action-operators.d.ts +0 -30
  44. package/src/actions/entity-action.d.ts +0 -37
  45. package/src/actions/entity-cache-action.d.ts +0 -147
  46. package/src/actions/entity-cache-change-set.d.ts +0 -66
  47. package/src/actions/entity-op.d.ts +0 -70
  48. package/src/actions/merge-strategy.d.ts +0 -20
  49. package/src/actions/update-response-data.d.ts +0 -20
  50. package/src/dataservices/data-service-error.d.ts +0 -18
  51. package/src/dataservices/default-data-service-config.d.ts +0 -27
  52. package/src/dataservices/default-data.service.d.ts +0 -57
  53. package/src/dataservices/entity-cache-data.service.d.ts +0 -58
  54. package/src/dataservices/entity-data.service.d.ts +0 -48
  55. package/src/dataservices/http-url-generator.d.ts +0 -94
  56. package/src/dataservices/interfaces.d.ts +0 -61
  57. package/src/dataservices/persistence-result-handler.service.d.ts +0 -30
  58. package/src/dispatchers/entity-cache-dispatcher.d.ts +0 -114
  59. package/src/dispatchers/entity-commands.d.ts +0 -217
  60. package/src/dispatchers/entity-dispatcher-base.d.ts +0 -269
  61. package/src/dispatchers/entity-dispatcher-default-options.d.ts +0 -23
  62. package/src/dispatchers/entity-dispatcher-factory.d.ts +0 -46
  63. package/src/dispatchers/entity-dispatcher.d.ts +0 -58
  64. package/src/effects/entity-cache-effects.d.ts +0 -46
  65. package/src/effects/entity-effects-scheduler.d.ts +0 -4
  66. package/src/effects/entity-effects.d.ts +0 -55
  67. package/src/entity-data-config.d.ts +0 -15
  68. package/src/entity-data-without-effects.module.d.ts +0 -15
  69. package/src/entity-data.module.d.ts +0 -15
  70. package/src/entity-metadata/entity-definition.d.ts +0 -16
  71. package/src/entity-metadata/entity-definition.service.d.ts +0 -62
  72. package/src/entity-metadata/entity-filters.d.ts +0 -12
  73. package/src/entity-metadata/entity-metadata.d.ts +0 -19
  74. package/src/entity-services/entity-collection-service-base.d.ts +0 -299
  75. package/src/entity-services/entity-collection-service-elements-factory.d.ts +0 -28
  76. package/src/entity-services/entity-collection-service-factory.d.ts +0 -22
  77. package/src/entity-services/entity-collection-service.d.ts +0 -37
  78. package/src/entity-services/entity-services-base.d.ts +0 -79
  79. package/src/entity-services/entity-services-elements.d.ts +0 -41
  80. package/src/entity-services/entity-services.d.ts +0 -50
  81. package/src/index.d.ts +0 -65
  82. package/src/provide-entity-data.d.ts +0 -78
  83. package/src/reducers/constants.d.ts +0 -8
  84. package/src/reducers/entity-cache-reducer.d.ts +0 -50
  85. package/src/reducers/entity-cache.d.ts +0 -4
  86. package/src/reducers/entity-change-tracker-base.d.ts +0 -181
  87. package/src/reducers/entity-change-tracker.d.ts +0 -169
  88. package/src/reducers/entity-collection-creator.d.ts +0 -15
  89. package/src/reducers/entity-collection-reducer-methods.d.ts +0 -365
  90. package/src/reducers/entity-collection-reducer-registry.d.ts +0 -47
  91. package/src/reducers/entity-collection-reducer.d.ts +0 -14
  92. package/src/reducers/entity-collection.d.ts +0 -41
  93. package/src/selectors/entity-cache-selector.d.ts +0 -7
  94. package/src/selectors/entity-selectors$.d.ts +0 -63
  95. package/src/selectors/entity-selectors.d.ts +0 -117
  96. package/src/utils/correlation-id-generator.d.ts +0 -20
  97. package/src/utils/default-logger.d.ts +0 -9
  98. package/src/utils/default-pluralizer.d.ts +0 -18
  99. package/src/utils/guid-fns.d.ts +0 -24
  100. package/src/utils/interfaces.d.ts +0 -16
  101. package/src/utils/utilities.d.ts +0 -26
@@ -1,269 +0,0 @@
1
- import { Action, Store } from '@ngrx/store';
2
- import { IdSelector, Update } from '@ngrx/entity';
3
- import { Observable } from 'rxjs';
4
- import { CorrelationIdGenerator } from '../utils/correlation-id-generator';
5
- import { EntityAction, EntityActionOptions } from '../actions/entity-action';
6
- import { EntityActionFactory } from '../actions/entity-action-factory';
7
- import { EntityActionGuard } from '../actions/entity-action-guard';
8
- import { EntityCache } from '../reducers/entity-cache';
9
- import { EntityCacheSelector } from '../selectors/entity-cache-selector';
10
- import { EntityDispatcher } from './entity-dispatcher';
11
- import { EntityDispatcherDefaultOptions } from './entity-dispatcher-default-options';
12
- import { EntityOp } from '../actions/entity-op';
13
- import { QueryParams } from '../dataservices/interfaces';
14
- /**
15
- * Dispatches EntityCollection actions to their reducers and effects (default implementation).
16
- * All save commands rely on an Ngrx Effect such as `EntityEffects.persist$`.
17
- */
18
- export declare class EntityDispatcherBase<T> implements EntityDispatcher<T> {
19
- /** Name of the entity type for which entities are dispatched */
20
- entityName: string;
21
- /** Creates an {EntityAction} */
22
- entityActionFactory: EntityActionFactory;
23
- /** The store, scoped to the EntityCache */
24
- store: Store<EntityCache>;
25
- /** Returns the primary key (id) of this entity */
26
- selectId: IdSelector<T>;
27
- /**
28
- * Dispatcher options configure dispatcher behavior such as
29
- * whether add is optimistic or pessimistic by default.
30
- */
31
- private defaultDispatcherOptions;
32
- /** Actions scanned by the store after it processed them with reducers. */
33
- private reducedActions$;
34
- /** Generates correlation ids for query and save methods */
35
- private correlationIdGenerator;
36
- /** Utility class with methods to validate EntityAction payloads.*/
37
- guard: EntityActionGuard<T>;
38
- private entityCollection$;
39
- /**
40
- * Convert an entity (or partial entity) into the `Update<T>` object
41
- * `update...` and `upsert...` methods take `Update<T>` args
42
- */
43
- toUpdate: (entity: Partial<T>) => Update<T>;
44
- constructor(
45
- /** Name of the entity type for which entities are dispatched */
46
- entityName: string,
47
- /** Creates an {EntityAction} */
48
- entityActionFactory: EntityActionFactory,
49
- /** The store, scoped to the EntityCache */
50
- store: Store<EntityCache>,
51
- /** Returns the primary key (id) of this entity */
52
- selectId: IdSelector<T>,
53
- /**
54
- * Dispatcher options configure dispatcher behavior such as
55
- * whether add is optimistic or pessimistic by default.
56
- */
57
- defaultDispatcherOptions: EntityDispatcherDefaultOptions,
58
- /** Actions scanned by the store after it processed them with reducers. */
59
- reducedActions$: Observable<Action>,
60
- /** Store selector for the EntityCache */
61
- entityCacheSelector: EntityCacheSelector,
62
- /** Generates correlation ids for query and save methods */
63
- correlationIdGenerator: CorrelationIdGenerator);
64
- /**
65
- * Create an {EntityAction} for this entity type.
66
- * @param entityOp {EntityOp} the entity operation
67
- * @param [data] the action data
68
- * @param [options] additional options
69
- * @returns the EntityAction
70
- */
71
- createEntityAction<P = any>(entityOp: EntityOp, data?: P, options?: EntityActionOptions): EntityAction<P>;
72
- /**
73
- * Create an {EntityAction} for this entity type and
74
- * dispatch it immediately to the store.
75
- * @param op {EntityOp} the entity operation
76
- * @param [data] the action data
77
- * @param [options] additional options
78
- * @returns the dispatched EntityAction
79
- */
80
- createAndDispatch<P = any>(op: EntityOp, data?: P, options?: EntityActionOptions): EntityAction<P>;
81
- /**
82
- * Dispatch an Action to the store.
83
- * @param action the Action
84
- * @returns the dispatched Action
85
- */
86
- dispatch(action: Action): Action;
87
- /**
88
- * Dispatch action to save a new entity to remote storage.
89
- * @param entity entity to add, which may omit its key if pessimistic and the server creates the key;
90
- * must have a key if optimistic save.
91
- * @returns A terminating Observable of the entity
92
- * after server reports successful save or the save error.
93
- */
94
- add(entity: T, options?: EntityActionOptions): Observable<T>;
95
- /**
96
- * Dispatch action to cancel the persistence operation (query or save).
97
- * Will cause save observable to error with a PersistenceCancel error.
98
- * Caller is responsible for undoing changes in cache from pending optimistic save
99
- * @param correlationId The correlation id for the corresponding EntityAction
100
- * @param [reason] explains why canceled and by whom.
101
- */
102
- cancel(correlationId: any, reason?: string, options?: EntityActionOptions): void;
103
- /**
104
- * Dispatch action to delete entity from remote storage by key.
105
- * @param key The primary key of the entity to remove
106
- * @returns A terminating Observable of the deleted key
107
- * after server reports successful save or the save error.
108
- */
109
- delete(entity: T, options?: EntityActionOptions): Observable<number | string>;
110
- /**
111
- * Dispatch action to delete entity from remote storage by key.
112
- * @param key The entity to delete
113
- * @returns A terminating Observable of the deleted key
114
- * after server reports successful save or the save error.
115
- */
116
- delete(key: number | string, options?: EntityActionOptions): Observable<number | string>;
117
- /**
118
- * Dispatch action to query remote storage for all entities and
119
- * merge the queried entities into the cached collection.
120
- * @returns A terminating Observable of the queried entities that are in the collection
121
- * after server reports success query or the query error.
122
- * @see load()
123
- */
124
- getAll(options?: EntityActionOptions): Observable<T[]>;
125
- /**
126
- * Dispatch action to query remote storage for the entity with this primary key.
127
- * If the server returns an entity,
128
- * merge it into the cached collection.
129
- * @returns A terminating Observable of the collection
130
- * after server reports successful query or the query error.
131
- */
132
- getByKey(key: any, options?: EntityActionOptions): Observable<T>;
133
- /**
134
- * Dispatch action to query remote storage for the entities that satisfy a query expressed
135
- * with either a query parameter map or an HTTP URL query string,
136
- * and merge the results into the cached collection.
137
- * @param queryParams the query in a form understood by the server
138
- * @returns A terminating Observable of the queried entities
139
- * after server reports successful query or the query error.
140
- */
141
- getWithQuery(queryParams: QueryParams | string, options?: EntityActionOptions): Observable<T[]>;
142
- /**
143
- * Dispatch action to query remote storage for all entities and
144
- * completely replace the cached collection with the queried entities.
145
- * @returns A terminating Observable of the entities in the collection
146
- * after server reports successful query or the query error.
147
- * @see getAll
148
- */
149
- load(options?: EntityActionOptions): Observable<T[]>;
150
- /**
151
- * Dispatch action to query remote storage for the entities that satisfy a query expressed
152
- * with either a query parameter map or an HTTP URL query string,
153
- * and completely replace the cached collection with the queried entities.
154
- * @param queryParams the query in a form understood by the server
155
- * @param [options] options that influence load behavior
156
- * @returns A terminating Observable of the queried entities
157
- * after server reports successful query or the query error.
158
- */
159
- loadWithQuery(queryParams: QueryParams | string, options?: EntityActionOptions): Observable<T[]>;
160
- /**
161
- * Dispatch action to save the updated entity (or partial entity) in remote storage.
162
- * The update entity may be partial (but must have its key)
163
- * in which case it patches the existing entity.
164
- * @param entity update entity, which might be a partial of T but must at least have its key.
165
- * @returns A terminating Observable of the updated entity
166
- * after server reports successful save or the save error.
167
- */
168
- update(entity: Partial<T>, options?: EntityActionOptions): Observable<T>;
169
- /**
170
- * Dispatch action to save a new or existing entity to remote storage.
171
- * Only dispatch this action if your server supports upsert.
172
- * @param entity entity to add, which may omit its key if pessimistic and the server creates the key;
173
- * must have a key if optimistic save.
174
- * @returns A terminating Observable of the entity
175
- * after server reports successful save or the save error.
176
- */
177
- upsert(entity: T, options?: EntityActionOptions): Observable<T>;
178
- /**
179
- * Replace all entities in the cached collection.
180
- * Does not save to remote storage.
181
- */
182
- addAllToCache(entities: T[], options?: EntityActionOptions): void;
183
- /**
184
- * Add a new entity directly to the cache.
185
- * Does not save to remote storage.
186
- * Ignored if an entity with the same primary key is already in cache.
187
- */
188
- addOneToCache(entity: T, options?: EntityActionOptions): void;
189
- /**
190
- * Add multiple new entities directly to the cache.
191
- * Does not save to remote storage.
192
- * Entities with primary keys already in cache are ignored.
193
- */
194
- addManyToCache(entities: T[], options?: EntityActionOptions): void;
195
- /** Clear the cached entity collection */
196
- clearCache(options?: EntityActionOptions): void;
197
- /**
198
- * Remove an entity directly from the cache.
199
- * Does not delete that entity from remote storage.
200
- * @param entity The entity to remove
201
- */
202
- removeOneFromCache(entity: T, options?: EntityActionOptions): void;
203
- /**
204
- * Remove an entity directly from the cache.
205
- * Does not delete that entity from remote storage.
206
- * @param key The primary key of the entity to remove
207
- */
208
- removeOneFromCache(key: number | string, options?: EntityActionOptions): void;
209
- /**
210
- * Remove multiple entities directly from the cache.
211
- * Does not delete these entities from remote storage.
212
- * @param entity The entities to remove
213
- */
214
- removeManyFromCache(entities: T[], options?: EntityActionOptions): void;
215
- /**
216
- * Remove multiple entities directly from the cache.
217
- * Does not delete these entities from remote storage.
218
- * @param keys The primary keys of the entities to remove
219
- */
220
- removeManyFromCache(keys: (number | string)[], options?: EntityActionOptions): void;
221
- /**
222
- * Update a cached entity directly.
223
- * Does not update that entity in remote storage.
224
- * Ignored if an entity with matching primary key is not in cache.
225
- * The update entity may be partial (but must have its key)
226
- * in which case it patches the existing entity.
227
- */
228
- updateOneInCache(entity: Partial<T>, options?: EntityActionOptions): void;
229
- /**
230
- * Update multiple cached entities directly.
231
- * Does not update these entities in remote storage.
232
- * Entities whose primary keys are not in cache are ignored.
233
- * Update entities may be partial but must at least have their keys.
234
- * such partial entities patch their cached counterparts.
235
- */
236
- updateManyInCache(entities: Partial<T>[], options?: EntityActionOptions): void;
237
- /**
238
- * Add or update a new entity directly to the cache.
239
- * Does not save to remote storage.
240
- * Upsert entity might be a partial of T but must at least have its key.
241
- * Pass the Update<T> structure as the payload
242
- */
243
- upsertOneInCache(entity: Partial<T>, options?: EntityActionOptions): void;
244
- /**
245
- * Add or update multiple cached entities directly.
246
- * Does not save to remote storage.
247
- */
248
- upsertManyInCache(entities: Partial<T>[], options?: EntityActionOptions): void;
249
- /**
250
- * Set the pattern that the collection's filter applies
251
- * when using the `filteredEntities` selector.
252
- */
253
- setFilter(pattern: any): void;
254
- /** Set the loaded flag */
255
- setLoaded(isLoaded: boolean): void;
256
- /** Set the loading flag */
257
- setLoading(isLoading: boolean): void;
258
- /** Get key from entity (unless arg is already a key) */
259
- private getKey;
260
- /**
261
- * Return Observable of data from the server-success EntityAction with
262
- * the given Correlation Id, after that action was processed by the ngrx store.
263
- * or else put the server error on the Observable error channel.
264
- * @param crid The correlationId for both the save and response actions.
265
- */
266
- private getResponseData$;
267
- private setQueryEntityActionOptions;
268
- private setSaveEntityActionOptions;
269
- }
@@ -1,23 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- /**
3
- * Default options for EntityDispatcher behavior
4
- * such as whether `add()` is optimistic or pessimistic by default.
5
- * An optimistic save modifies the collection immediately and before saving to the server.
6
- * A pessimistic save modifies the collection after the server confirms the save was successful.
7
- * This class initializes the defaults to the safest values.
8
- * Provide an alternative to change the defaults for all entity collections.
9
- */
10
- export declare class EntityDispatcherDefaultOptions {
11
- /** True if added entities are saved optimistically; false if saved pessimistically. */
12
- optimisticAdd: boolean;
13
- /** True if deleted entities are saved optimistically; false if saved pessimistically. */
14
- optimisticDelete: boolean;
15
- /** True if updated entities are saved optimistically; false if saved pessimistically. */
16
- optimisticUpdate: boolean;
17
- /** True if upsert entities are saved optimistically; false if saved pessimistically. */
18
- optimisticUpsert: boolean;
19
- /** True if entities in a cache saveEntities request are saved optimistically; false if saved pessimistically. */
20
- optimisticSaveEntities: boolean;
21
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityDispatcherDefaultOptions, never>;
22
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityDispatcherDefaultOptions>;
23
- }
@@ -1,46 +0,0 @@
1
- import { OnDestroy } from '@angular/core';
2
- import { Action, Store } from '@ngrx/store';
3
- import { IdSelector } from '@ngrx/entity';
4
- import { Observable } from 'rxjs';
5
- import { CorrelationIdGenerator } from '../utils/correlation-id-generator';
6
- import { EntityDispatcherDefaultOptions } from './entity-dispatcher-default-options';
7
- import { EntityActionFactory } from '../actions/entity-action-factory';
8
- import { EntityCache } from '../reducers/entity-cache';
9
- import { EntityCacheSelector } from '../selectors/entity-cache-selector';
10
- import { EntityDispatcher } from './entity-dispatcher';
11
- import * as i0 from "@angular/core";
12
- /** Creates EntityDispatchers for entity collections */
13
- export declare class EntityDispatcherFactory implements OnDestroy {
14
- private entityActionFactory;
15
- private store;
16
- private entityDispatcherDefaultOptions;
17
- private entityCacheSelector;
18
- private correlationIdGenerator;
19
- /**
20
- * Actions scanned by the store after it processed them with reducers.
21
- * A replay observable of the most recent action reduced by the store.
22
- */
23
- reducedActions$: Observable<Action>;
24
- private raSubscription;
25
- constructor(entityActionFactory: EntityActionFactory, store: Store<EntityCache>, entityDispatcherDefaultOptions: EntityDispatcherDefaultOptions, scannedActions$: Observable<Action>, entityCacheSelector: EntityCacheSelector, correlationIdGenerator: CorrelationIdGenerator);
26
- /**
27
- * Create an `EntityDispatcher` for an entity type `T` and store.
28
- */
29
- create<T>(
30
- /** Name of the entity type */
31
- entityName: string,
32
- /**
33
- * Function that returns the primary key for an entity `T`.
34
- * Usually acquired from `EntityDefinition` metadata.
35
- * @param {IdSelector<T>} selectId
36
- */
37
- selectId?: IdSelector<T>,
38
- /** Defaults for options that influence dispatcher behavior such as whether
39
- * `add()` is optimistic or pessimistic;
40
- * @param {Partial<EntityDispatcherDefaultOptions>} defaultOptions
41
- */
42
- defaultOptions?: Partial<EntityDispatcherDefaultOptions>): EntityDispatcher<T>;
43
- ngOnDestroy(): void;
44
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityDispatcherFactory, never>;
45
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityDispatcherFactory>;
46
- }
@@ -1,58 +0,0 @@
1
- import { Action, Store } from '@ngrx/store';
2
- import { IdSelector, Update } from '@ngrx/entity';
3
- import { EntityAction, EntityActionOptions } from '../actions/entity-action';
4
- import { EntityActionGuard } from '../actions/entity-action-guard';
5
- import { EntityCommands } from './entity-commands';
6
- import { EntityCache } from '../reducers/entity-cache';
7
- import { EntityOp } from '../actions/entity-op';
8
- /**
9
- * Dispatches EntityCollection actions to their reducers and effects.
10
- * The substance of the interface is in EntityCommands.
11
- */
12
- export interface EntityDispatcher<T> extends EntityCommands<T> {
13
- /** Name of the entity type */
14
- readonly entityName: string;
15
- /**
16
- * Utility class with methods to validate EntityAction payloads.
17
- */
18
- readonly guard: EntityActionGuard<T>;
19
- /** Returns the primary key (id) of this entity */
20
- readonly selectId: IdSelector<T>;
21
- /** Returns the store, scoped to the EntityCache */
22
- readonly store: Store<EntityCache>;
23
- /**
24
- * Create an {EntityAction} for this entity type.
25
- * @param op {EntityOp} the entity operation
26
- * @param [data] the action data
27
- * @param [options] additional options
28
- * @returns the EntityAction
29
- */
30
- createEntityAction<P = any>(op: EntityOp, data?: P, options?: EntityActionOptions): EntityAction<P>;
31
- /**
32
- * Create an {EntityAction} for this entity type and
33
- * dispatch it immediately to the store.
34
- * @param op {EntityOp} the entity operation
35
- * @param [data] the action data
36
- * @param [options] additional options
37
- * @returns the dispatched EntityAction
38
- */
39
- createAndDispatch<P = any>(op: EntityOp, data?: P, options?: EntityActionOptions): EntityAction<P>;
40
- /**
41
- * Dispatch an Action to the store.
42
- * @param action the Action
43
- * @returns the dispatched Action
44
- */
45
- dispatch(action: Action): Action;
46
- /**
47
- * Convert an entity (or partial entity) into the `Update<T>` object
48
- * `update...` and `upsert...` methods take `Update<T>` args
49
- */
50
- toUpdate(entity: Partial<T>): Update<T>;
51
- }
52
- /**
53
- * Persistence operation canceled
54
- */
55
- export declare class PersistanceCanceled {
56
- readonly message?: string;
57
- constructor(message?: string);
58
- }
@@ -1,46 +0,0 @@
1
- import { Action } from '@ngrx/store';
2
- import { Actions } from '@ngrx/effects';
3
- import { Observable, SchedulerLike } from 'rxjs';
4
- import { EntityActionFactory } from '../actions/entity-action-factory';
5
- import { SaveEntities, SaveEntitiesCancel } from '../actions/entity-cache-action';
6
- import { EntityCacheDataService } from '../dataservices/entity-cache-data.service';
7
- import { Logger } from '../utils/interfaces';
8
- import * as i0 from "@angular/core";
9
- export declare class EntityCacheEffects {
10
- private actions;
11
- private dataService;
12
- private entityActionFactory;
13
- private logger;
14
- /**
15
- * Injecting an optional Scheduler that will be undefined
16
- * in normal application usage, but its injected here so that you can mock out
17
- * during testing using the RxJS TestScheduler for simulating passages of time.
18
- */
19
- private scheduler;
20
- /** Delay for error and skip observables. Must be multiple of 10 for marble testing. */
21
- private responseDelay;
22
- constructor(actions: Actions, dataService: EntityCacheDataService, entityActionFactory: EntityActionFactory, logger: Logger,
23
- /**
24
- * Injecting an optional Scheduler that will be undefined
25
- * in normal application usage, but its injected here so that you can mock out
26
- * during testing using the RxJS TestScheduler for simulating passages of time.
27
- */
28
- scheduler: SchedulerLike);
29
- /**
30
- * Observable of SAVE_ENTITIES_CANCEL actions with non-null correlation ids
31
- */
32
- saveEntitiesCancel$: Observable<SaveEntitiesCancel>;
33
- saveEntities$: Observable<Action>;
34
- /**
35
- * Perform the requested SaveEntities actions and return a scalar Observable<Action>
36
- * that the effect should dispatch to the store after the server responds.
37
- * @param action The SaveEntities action
38
- */
39
- saveEntities(action: SaveEntities): Observable<Action>;
40
- /** return handler of error result of saveEntities, returning a scalar observable of error action */
41
- private handleSaveEntitiesError$;
42
- /** return handler of the ChangeSet result of successful saveEntities() */
43
- private handleSaveEntitiesSuccess$;
44
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityCacheEffects, [null, null, null, null, { optional: true; }]>;
45
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityCacheEffects>;
46
- }
@@ -1,4 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { SchedulerLike } from 'rxjs';
3
- /** Token to inject a special RxJS Scheduler during marble tests. */
4
- export declare const ENTITY_EFFECTS_SCHEDULER: InjectionToken<SchedulerLike>;
@@ -1,55 +0,0 @@
1
- import { Action } from '@ngrx/store';
2
- import { Actions } from '@ngrx/effects';
3
- import { Observable, SchedulerLike } from 'rxjs';
4
- import { EntityAction } from '../actions/entity-action';
5
- import { EntityActionFactory } from '../actions/entity-action-factory';
6
- import { EntityOp } from '../actions/entity-op';
7
- import { EntityDataService } from '../dataservices/entity-data.service';
8
- import { PersistenceResultHandler } from '../dataservices/persistence-result-handler.service';
9
- import * as i0 from "@angular/core";
10
- export declare const persistOps: EntityOp[];
11
- export declare class EntityEffects {
12
- private actions;
13
- private dataService;
14
- private entityActionFactory;
15
- private resultHandler;
16
- /**
17
- * Injecting an optional Scheduler that will be undefined
18
- * in normal application usage, but its injected here so that you can mock out
19
- * during testing using the RxJS TestScheduler for simulating passages of time.
20
- */
21
- private scheduler;
22
- /** Delay for error and skip observables. Must be multiple of 10 for marble testing. */
23
- private responseDelay;
24
- /**
25
- * Observable of non-null cancellation correlation ids from CANCEL_PERSIST actions
26
- */
27
- cancel$: Observable<any>;
28
- persist$: Observable<Action>;
29
- constructor(actions: Actions<EntityAction>, dataService: EntityDataService, entityActionFactory: EntityActionFactory, resultHandler: PersistenceResultHandler,
30
- /**
31
- * Injecting an optional Scheduler that will be undefined
32
- * in normal application usage, but its injected here so that you can mock out
33
- * during testing using the RxJS TestScheduler for simulating passages of time.
34
- */
35
- scheduler: SchedulerLike);
36
- /**
37
- * Perform the requested persistence operation and return a scalar Observable<Action>
38
- * that the effect should dispatch to the store after the server responds.
39
- * @param action A persistence operation EntityAction
40
- */
41
- persist(action: EntityAction): Observable<Action>;
42
- private callDataService;
43
- /**
44
- * Handle error result of persistence operation on an EntityAction,
45
- * returning a scalar observable of error action
46
- */
47
- private handleError$;
48
- /**
49
- * Because EntityAction.payload.skip is true, skip the persistence step and
50
- * return a scalar success action that looks like the operation succeeded.
51
- */
52
- private handleSkipSuccess$;
53
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityEffects, [null, null, null, null, { optional: true; }]>;
54
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityEffects>;
55
- }
@@ -1,15 +0,0 @@
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,15 +0,0 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import { EntityDataModuleConfig } from './entity-data-config';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Module without effects or dataservices which means no HTTP calls
6
- * This module helpful for internal testing.
7
- * Also helpful for apps that handle server access on their own and
8
- * therefore opt-out of @ngrx/effects for entities
9
- */
10
- export declare class EntityDataModuleWithoutEffects {
11
- static forRoot(config: EntityDataModuleConfig): ModuleWithProviders<EntityDataModuleWithoutEffects>;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataModuleWithoutEffects, never>;
13
- static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModuleWithoutEffects, never, never, never>;
14
- static ɵinj: i0.ɵɵInjectorDeclaration<EntityDataModuleWithoutEffects>;
15
- }
@@ -1,15 +0,0 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import { EntityDataModuleConfig } from './entity-data-config';
3
- import * as i0 from "@angular/core";
4
- import * as i1 from "./entity-data-without-effects.module";
5
- /**
6
- * entity-data main module includes effects and HTTP data services
7
- * Configure with `forRoot`.
8
- * No `forFeature` yet.
9
- */
10
- export declare class EntityDataModule {
11
- static forRoot(config: EntityDataModuleConfig): ModuleWithProviders<EntityDataModule>;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataModule, never>;
13
- static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModule, never, [typeof i1.EntityDataModuleWithoutEffects], never>;
14
- static ɵinj: i0.ɵɵInjectorDeclaration<EntityDataModule>;
15
- }
@@ -1,16 +0,0 @@
1
- import { EntityAdapter } from '@ngrx/entity';
2
- import { Comparer, IdSelector } from '@ngrx/entity';
3
- import { EntityDispatcherDefaultOptions } from '../dispatchers/entity-dispatcher-default-options';
4
- import { EntityCollection } from '../reducers/entity-collection';
5
- import { EntityMetadata } from './entity-metadata';
6
- export interface EntityDefinition<T = any> {
7
- entityName: string;
8
- entityAdapter: EntityAdapter<T>;
9
- entityDispatcherOptions?: Partial<EntityDispatcherDefaultOptions>;
10
- initialState: EntityCollection<T>;
11
- metadata: EntityMetadata<T>;
12
- noChangeTracking: boolean;
13
- selectId: IdSelector<T>;
14
- sortComparer: false | Comparer<T>;
15
- }
16
- export declare function createEntityDefinition<T, S extends object>(metadata: EntityMetadata<T, S>): EntityDefinition<T>;
@@ -1,62 +0,0 @@
1
- import { EntityDefinition } from './entity-definition';
2
- import { EntityMetadata, EntityMetadataMap } from './entity-metadata';
3
- import * as i0 from "@angular/core";
4
- export interface EntityDefinitions {
5
- [entityName: string]: EntityDefinition<any>;
6
- }
7
- /** Registry of EntityDefinitions for all cached entity types */
8
- export declare class EntityDefinitionService {
9
- /** {EntityDefinition} for all cached entity types */
10
- private readonly definitions;
11
- constructor(entityMetadataMaps: EntityMetadataMap[]);
12
- /**
13
- * Get (or create) a data service for entity type
14
- * @param entityName - the name of the type
15
- *
16
- * Examples:
17
- * getDefinition('Hero'); // definition for Heroes, untyped
18
- * getDefinition<Hero>(`Hero`); // definition for Heroes, typed with Hero interface
19
- */
20
- getDefinition<T>(entityName: string, shouldThrow?: boolean): EntityDefinition<T>;
21
- /**
22
- * Create and register the {EntityDefinition} for the {EntityMetadata} of an entity type
23
- * @param name - the name of the entity type
24
- * @param definition - {EntityMetadata} for a collection for that entity type
25
- *
26
- * Examples:
27
- * registerMetadata(myHeroEntityDefinition);
28
- */
29
- registerMetadata(metadata: EntityMetadata): void;
30
- /**
31
- * Register an EntityMetadataMap.
32
- * @param metadataMap - a map of entityType names to entity metadata
33
- *
34
- * Examples:
35
- * registerMetadataMap({
36
- * 'Hero': myHeroMetadata,
37
- * Villain: myVillainMetadata
38
- * });
39
- */
40
- registerMetadataMap(metadataMap?: EntityMetadataMap): void;
41
- /**
42
- * Register an {EntityDefinition} for an entity type
43
- * @param definition - EntityDefinition of a collection for that entity type
44
- *
45
- * Examples:
46
- * registerDefinition('Hero', myHeroEntityDefinition);
47
- */
48
- registerDefinition<T>(definition: EntityDefinition<T>): void;
49
- /**
50
- * Register a batch of EntityDefinitions.
51
- * @param definitions - map of entityType name and associated EntityDefinitions to merge.
52
- *
53
- * Examples:
54
- * registerDefinitions({
55
- * 'Hero': myHeroEntityDefinition,
56
- * Villain: myVillainEntityDefinition
57
- * });
58
- */
59
- registerDefinitions(definitions: EntityDefinitions): void;
60
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionService, [{ optional: true; }]>;
61
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityDefinitionService>;
62
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Filters the `entities` array argument and returns the original `entities`,
3
- * or a new filtered array of entities.
4
- * NEVER mutate the original `entities` array itself.
5
- **/
6
- export type EntityFilterFn<T> = (entities: T[], pattern?: any) => T[];
7
- /**
8
- * Creates an {EntityFilterFn} that matches RegExp or RegExp string pattern
9
- * anywhere in any of the given props of an entity.
10
- * If pattern is a string, spaces are significant and ignores case.
11
- */
12
- export declare function PropsFilterFnFactory<T = any>(props?: (keyof T)[]): EntityFilterFn<T>;