@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,365 +0,0 @@
1
- import { EntityAdapter, IdSelector, Update } from '@ngrx/entity';
2
- import { ChangeStateMap, EntityCollection } from './entity-collection';
3
- import { EntityAction } from '../actions/entity-action';
4
- import { EntityActionDataServiceError } from '../dataservices/data-service-error';
5
- import { EntityActionGuard } from '../actions/entity-action-guard';
6
- import { EntityChangeTracker } from './entity-change-tracker';
7
- import { EntityDefinition } from '../entity-metadata/entity-definition';
8
- import { EntityDefinitionService } from '../entity-metadata/entity-definition.service';
9
- import { MergeStrategy } from '../actions/merge-strategy';
10
- import { UpdateResponseData } from '../actions/update-response-data';
11
- import * as i0 from "@angular/core";
12
- /**
13
- * Map of {EntityOp} to reducer method for the operation.
14
- * If an operation is missing, caller should return the collection for that reducer.
15
- */
16
- export interface EntityCollectionReducerMethodMap<T> {
17
- [method: string]: (collection: EntityCollection<T>, action: EntityAction) => EntityCollection<T>;
18
- }
19
- /**
20
- * Base implementation of reducer methods for an entity collection.
21
- */
22
- export declare class EntityCollectionReducerMethods<T> {
23
- entityName: string;
24
- definition: EntityDefinition<T>;
25
- protected adapter: EntityAdapter<T>;
26
- protected guard: EntityActionGuard<T>;
27
- /** True if this collection tracks unsaved changes */
28
- protected isChangeTracking: boolean;
29
- /** Extract the primary key (id); default to `id` */
30
- selectId: IdSelector<T>;
31
- /**
32
- * Track changes to entities since the last query or save
33
- * Can revert some or all of those changes
34
- */
35
- entityChangeTracker: EntityChangeTracker<T>;
36
- /**
37
- * Convert an entity (or partial entity) into the `Update<T>` object
38
- * `id`: the primary key and
39
- * `changes`: the entity (or partial entity of changes).
40
- */
41
- protected toUpdate: (entity: Partial<T>) => Update<T>;
42
- /**
43
- * Dictionary of the {EntityCollectionReducerMethods} for this entity type,
44
- * keyed by the {EntityOp}
45
- */
46
- readonly methods: EntityCollectionReducerMethodMap<T>;
47
- constructor(entityName: string, definition: EntityDefinition<T>, entityChangeTracker?: EntityChangeTracker<T>);
48
- /** Cancel a persistence operation */
49
- protected cancelPersist(collection: EntityCollection<T>): EntityCollection<T>;
50
- protected queryAll(collection: EntityCollection<T>): EntityCollection<T>;
51
- protected queryAllError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
52
- /**
53
- * Merges query results per the MergeStrategy
54
- * Sets loading flag to false and loaded flag to true.
55
- */
56
- protected queryAllSuccess(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
57
- protected queryByKey(collection: EntityCollection<T>, action: EntityAction<number | string>): EntityCollection<T>;
58
- protected queryByKeyError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
59
- protected queryByKeySuccess(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
60
- protected queryLoad(collection: EntityCollection<T>): EntityCollection<T>;
61
- protected queryLoadError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
62
- /**
63
- * Replaces all entities in the collection
64
- * Sets loaded flag to true, loading flag to false,
65
- * and clears changeState for the entire collection.
66
- */
67
- protected queryLoadSuccess(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
68
- protected queryMany(collection: EntityCollection<T>, action: EntityAction): EntityCollection<T>;
69
- protected queryManyError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
70
- protected queryManySuccess(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
71
- /**
72
- * Save multiple new entities.
73
- * If saving pessimistically, delay adding to collection until server acknowledges success.
74
- * If saving optimistically; add immediately.
75
- * @param collection The collection to which the entities should be added.
76
- * @param action The action payload holds options, including whether the save is optimistic,
77
- * and the data, which must be an array of entities.
78
- * If saving optimistically, the entities must have their keys.
79
- */
80
- protected saveAddMany(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
81
- /**
82
- * Attempt to save new entities failed or timed-out.
83
- * Action holds the error.
84
- * If saved pessimistically, new entities are not in the collection and
85
- * you may not have to compensate for the error.
86
- * If saved optimistically, the unsaved entities are in the collection and
87
- * you may need to compensate for the error.
88
- */
89
- protected saveAddManyError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
90
- /**
91
- * Successfully saved new entities to the server.
92
- * If saved pessimistically, add the entities from the server to the collection.
93
- * If saved optimistically, the added entities are already in the collection.
94
- * However, the server might have set or modified other fields (e.g, concurrency field),
95
- * and may even return additional new entities.
96
- * Therefore, upsert the entities in the collection with the returned values (if any)
97
- * Caution: in a race, this update could overwrite unsaved user changes.
98
- * Use pessimistic add to avoid this risk.
99
- * Note: saveAddManySuccess differs from saveAddOneSuccess when optimistic.
100
- * saveAddOneSuccess updates (not upserts) with the lone entity from the server.
101
- * There is no effect if the entity is not already in cache.
102
- * saveAddManySuccess will add an entity if it is not found in cache.
103
- */
104
- protected saveAddManySuccess(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
105
- /**
106
- * Save a new entity.
107
- * If saving pessimistically, delay adding to collection until server acknowledges success.
108
- * If saving optimistically; add entity immediately.
109
- * @param collection The collection to which the entity should be added.
110
- * @param action The action payload holds options, including whether the save is optimistic,
111
- * and the data, which must be an entity.
112
- * If saving optimistically, the entity must have a key.
113
- */
114
- protected saveAddOne(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
115
- /**
116
- * Attempt to save a new entity failed or timed-out.
117
- * Action holds the error.
118
- * If saved pessimistically, the entity is not in the collection and
119
- * you may not have to compensate for the error.
120
- * If saved optimistically, the unsaved entity is in the collection and
121
- * you may need to compensate for the error.
122
- */
123
- protected saveAddOneError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
124
- /**
125
- * Successfully saved a new entity to the server.
126
- * If saved pessimistically, add the entity from the server to the collection.
127
- * If saved optimistically, the added entity is already in the collection.
128
- * However, the server might have set or modified other fields (e.g, concurrency field)
129
- * Therefore, update the entity in the collection with the returned value (if any)
130
- * Caution: in a race, this update could overwrite unsaved user changes.
131
- * Use pessimistic add to avoid this risk.
132
- */
133
- protected saveAddOneSuccess(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
134
- /**
135
- * Delete an entity from the server by key and remove it from the collection (if present).
136
- * If the entity is an unsaved new entity, remove it from the collection immediately
137
- * and skip the server delete request.
138
- * An optimistic save removes an existing entity from the collection immediately;
139
- * a pessimistic save removes it after the server confirms successful delete.
140
- * @param collection Will remove the entity with this key from the collection.
141
- * @param action The action payload holds options, including whether the save is optimistic,
142
- * and the data, which must be a primary key or an entity with a key;
143
- * this reducer extracts the key from the entity.
144
- */
145
- protected saveDeleteOne(collection: EntityCollection<T>, action: EntityAction<number | string | T>): EntityCollection<T>;
146
- /**
147
- * Attempt to delete the entity on the server failed or timed-out.
148
- * Action holds the error.
149
- * If saved pessimistically, the entity could still be in the collection and
150
- * you may not have to compensate for the error.
151
- * If saved optimistically, the entity is not in the collection and
152
- * you may need to compensate for the error.
153
- */
154
- protected saveDeleteOneError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
155
- /**
156
- * Successfully deleted entity on the server. The key of the deleted entity is in the action payload data.
157
- * If saved pessimistically, if the entity is still in the collection it will be removed.
158
- * If saved optimistically, the entity has already been removed from the collection.
159
- */
160
- protected saveDeleteOneSuccess(collection: EntityCollection<T>, action: EntityAction<number | string>): EntityCollection<T>;
161
- /**
162
- * Delete multiple entities from the server by key and remove them from the collection (if present).
163
- * Removes unsaved new entities from the collection immediately
164
- * but the id is still sent to the server for deletion even though the server will not find that entity.
165
- * Therefore, the server must be willing to ignore a delete request for an entity it cannot find.
166
- * An optimistic save removes existing entities from the collection immediately;
167
- * a pessimistic save removes them after the server confirms successful delete.
168
- * @param collection Removes entities from this collection.
169
- * @param action The action payload holds options, including whether the save is optimistic,
170
- * and the data, which must be an array of primary keys or entities with a key;
171
- * this reducer extracts the key from the entity.
172
- */
173
- protected saveDeleteMany(collection: EntityCollection<T>, action: EntityAction<(number | string | T)[]>): EntityCollection<T>;
174
- /**
175
- * Attempt to delete the entities on the server failed or timed-out.
176
- * Action holds the error.
177
- * If saved pessimistically, the entities could still be in the collection and
178
- * you may not have to compensate for the error.
179
- * If saved optimistically, the entities are not in the collection and
180
- * you may need to compensate for the error.
181
- */
182
- protected saveDeleteManyError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
183
- /**
184
- * Successfully deleted entities on the server. The keys of the deleted entities are in the action payload data.
185
- * If saved pessimistically, entities that are still in the collection will be removed.
186
- * If saved optimistically, the entities have already been removed from the collection.
187
- */
188
- protected saveDeleteManySuccess(collection: EntityCollection<T>, action: EntityAction<(number | string)[]>): EntityCollection<T>;
189
- /**
190
- * Save an update to an existing entity.
191
- * If saving pessimistically, update the entity in the collection after the server confirms success.
192
- * If saving optimistically, update the entity immediately, before the save request.
193
- * @param collection The collection to update
194
- * @param action The action payload holds options, including if the save is optimistic,
195
- * and the data which, must be an {Update<T>}
196
- */
197
- protected saveUpdateOne(collection: EntityCollection<T>, action: EntityAction<Update<T>>): EntityCollection<T>;
198
- /**
199
- * Attempt to update the entity on the server failed or timed-out.
200
- * Action holds the error.
201
- * If saved pessimistically, the entity in the collection is in the pre-save state
202
- * you may not have to compensate for the error.
203
- * If saved optimistically, the entity in the collection was updated
204
- * and you may need to compensate for the error.
205
- */
206
- protected saveUpdateOneError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
207
- /**
208
- * Successfully saved the updated entity to the server.
209
- * If saved pessimistically, update the entity in the collection with data from the server.
210
- * If saved optimistically, the entity was already updated in the collection.
211
- * However, the server might have set or modified other fields (e.g, concurrency field)
212
- * Therefore, update the entity in the collection with the returned value (if any)
213
- * Caution: in a race, this update could overwrite unsaved user changes.
214
- * Use pessimistic update to avoid this risk.
215
- * @param collection The collection to update
216
- * @param action The action payload holds options, including if the save is optimistic, and
217
- * the update data which, must be an UpdateResponse<T> that corresponds to the Update sent to the server.
218
- * You must include an UpdateResponse even if the save was optimistic,
219
- * to ensure that the change tracking is properly reset.
220
- */
221
- protected saveUpdateOneSuccess(collection: EntityCollection<T>, action: EntityAction<UpdateResponseData<T>>): EntityCollection<T>;
222
- /**
223
- * Save updated entities.
224
- * If saving pessimistically, update the entities in the collection after the server confirms success.
225
- * If saving optimistically, update the entities immediately, before the save request.
226
- * @param collection The collection to update
227
- * @param action The action payload holds options, including if the save is optimistic,
228
- * and the data which, must be an array of {Update<T>}.
229
- */
230
- protected saveUpdateMany(collection: EntityCollection<T>, action: EntityAction<Update<T>[]>): EntityCollection<T>;
231
- /**
232
- * Attempt to update entities on the server failed or timed-out.
233
- * Action holds the error.
234
- * If saved pessimistically, the entities in the collection are in the pre-save state
235
- * you may not have to compensate for the error.
236
- * If saved optimistically, the entities in the collection were updated
237
- * and you may need to compensate for the error.
238
- */
239
- protected saveUpdateManyError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
240
- /**
241
- * Successfully saved the updated entities to the server.
242
- * If saved pessimistically, the entities in the collection will be updated with data from the server.
243
- * If saved optimistically, the entities in the collection were already updated.
244
- * However, the server might have set or modified other fields (e.g, concurrency field)
245
- * Therefore, update the entity in the collection with the returned values (if any)
246
- * Caution: in a race, this update could overwrite unsaved user changes.
247
- * Use pessimistic update to avoid this risk.
248
- * @param collection The collection to update
249
- * @param action The action payload holds options, including if the save is optimistic,
250
- * and the data which, must be an array of UpdateResponse<T>.
251
- * You must include an UpdateResponse for every Update sent to the server,
252
- * even if the save was optimistic, to ensure that the change tracking is properly reset.
253
- */
254
- protected saveUpdateManySuccess(collection: EntityCollection<T>, action: EntityAction<UpdateResponseData<T>[]>): EntityCollection<T>;
255
- /**
256
- * Save a new or existing entity.
257
- * If saving pessimistically, delay adding to collection until server acknowledges success.
258
- * If saving optimistically; add immediately.
259
- * @param collection The collection to which the entity should be upserted.
260
- * @param action The action payload holds options, including whether the save is optimistic,
261
- * and the data, which must be a whole entity.
262
- * If saving optimistically, the entity must have its key.
263
- */
264
- protected saveUpsertOne(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
265
- /**
266
- * Attempt to save new or existing entity failed or timed-out.
267
- * Action holds the error.
268
- * If saved pessimistically, new or updated entity is not in the collection and
269
- * you may not have to compensate for the error.
270
- * If saved optimistically, the unsaved entities are in the collection and
271
- * you may need to compensate for the error.
272
- */
273
- protected saveUpsertOneError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
274
- /**
275
- * Successfully saved new or existing entities to the server.
276
- * If saved pessimistically, add the entities from the server to the collection.
277
- * If saved optimistically, the added entities are already in the collection.
278
- * However, the server might have set or modified other fields (e.g, concurrency field)
279
- * Therefore, update the entities in the collection with the returned values (if any)
280
- * Caution: in a race, this update could overwrite unsaved user changes.
281
- * Use pessimistic add to avoid this risk.
282
- */
283
- protected saveUpsertOneSuccess(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
284
- /**
285
- * Save multiple new or existing entities.
286
- * If saving pessimistically, delay adding to collection until server acknowledges success.
287
- * If saving optimistically; add immediately.
288
- * @param collection The collection to which the entities should be upserted.
289
- * @param action The action payload holds options, including whether the save is optimistic,
290
- * and the data, which must be an array of whole entities.
291
- * If saving optimistically, the entities must have their keys.
292
- */
293
- protected saveUpsertMany(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
294
- /**
295
- * Attempt to save new or existing entities failed or timed-out.
296
- * Action holds the error.
297
- * If saved pessimistically, new entities are not in the collection and
298
- * you may not have to compensate for the error.
299
- * If saved optimistically, the unsaved entities are in the collection and
300
- * you may need to compensate for the error.
301
- */
302
- protected saveUpsertManyError(collection: EntityCollection<T>, action: EntityAction<EntityActionDataServiceError>): EntityCollection<T>;
303
- /**
304
- * Successfully saved new or existing entities to the server.
305
- * If saved pessimistically, add the entities from the server to the collection.
306
- * If saved optimistically, the added entities are already in the collection.
307
- * However, the server might have set or modified other fields (e.g, concurrency field)
308
- * Therefore, update the entities in the collection with the returned values (if any)
309
- * Caution: in a race, this update could overwrite unsaved user changes.
310
- * Use pessimistic add to avoid this risk.
311
- */
312
- protected saveUpsertManySuccess(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
313
- /**
314
- * Replaces all entities in the collection
315
- * Sets loaded flag to true.
316
- * Merges query results, preserving unsaved changes
317
- */
318
- protected addAll(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
319
- protected addMany(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
320
- protected addOne(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
321
- protected removeMany(collection: EntityCollection<T>, action: EntityAction<number[] | string[]>): EntityCollection<T>;
322
- protected removeOne(collection: EntityCollection<T>, action: EntityAction<number | string>): EntityCollection<T>;
323
- protected removeAll(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
324
- protected updateMany(collection: EntityCollection<T>, action: EntityAction<Update<T>[]>): EntityCollection<T>;
325
- protected updateOne(collection: EntityCollection<T>, action: EntityAction<Update<T>>): EntityCollection<T>;
326
- protected upsertMany(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
327
- protected upsertOne(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
328
- protected commitAll(collection: EntityCollection<T>): EntityCollection<T>;
329
- protected commitMany(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
330
- protected commitOne(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
331
- protected undoAll(collection: EntityCollection<T>): EntityCollection<T>;
332
- protected undoMany(collection: EntityCollection<T>, action: EntityAction<T[]>): EntityCollection<T>;
333
- protected undoOne(collection: EntityCollection<T>, action: EntityAction<T>): EntityCollection<T>;
334
- /** Dangerous: Completely replace the collection's ChangeState. Use rarely and wisely. */
335
- protected setChangeState(collection: EntityCollection<T>, action: EntityAction<ChangeStateMap<T>>): EntityCollection<T>;
336
- /**
337
- * Dangerous: Completely replace the collection.
338
- * Primarily for testing and rehydration from local storage.
339
- * Use rarely and wisely.
340
- */
341
- protected setCollection(collection: EntityCollection<T>, action: EntityAction<EntityCollection<T>>): EntityCollection<T>;
342
- protected setFilter(collection: EntityCollection<T>, action: EntityAction<any>): EntityCollection<T>;
343
- protected setLoaded(collection: EntityCollection<T>, action: EntityAction<boolean>): EntityCollection<T>;
344
- protected setLoading(collection: EntityCollection<T>, action: EntityAction<boolean>): EntityCollection<T>;
345
- protected setLoadingFalse(collection: EntityCollection<T>): EntityCollection<T>;
346
- protected setLoadingTrue(collection: EntityCollection<T>): EntityCollection<T>;
347
- /** Set the collection's loading flag */
348
- protected setLoadingFlag(collection: EntityCollection<T>, loading: boolean): EntityCollection<T>;
349
- /** Safely extract data from the EntityAction payload */
350
- protected extractData<D = any>(action: EntityAction<D>): D;
351
- /** Safely extract MergeStrategy from EntityAction. Set to IgnoreChanges if collection itself is not tracked. */
352
- protected extractMergeStrategy(action: EntityAction): MergeStrategy;
353
- protected isOptimistic(action: EntityAction): boolean;
354
- }
355
- /**
356
- * Creates {EntityCollectionReducerMethods} for a given entity type.
357
- */
358
- export declare class EntityCollectionReducerMethodsFactory {
359
- private entityDefinitionService;
360
- constructor(entityDefinitionService: EntityDefinitionService);
361
- /** Create the {EntityCollectionReducerMethods} for the named entity type */
362
- create<T>(entityName: string): EntityCollectionReducerMethodMap<T>;
363
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityCollectionReducerMethodsFactory, never>;
364
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityCollectionReducerMethodsFactory>;
365
- }
@@ -1,47 +0,0 @@
1
- import { MetaReducer } from '@ngrx/store';
2
- import { EntityAction } from '../actions/entity-action';
3
- import { EntityCollection } from './entity-collection';
4
- import { EntityCollectionReducer, EntityCollectionReducerFactory } from './entity-collection-reducer';
5
- import * as i0 from "@angular/core";
6
- /** A hash of EntityCollectionReducers */
7
- export interface EntityCollectionReducers {
8
- [entity: string]: EntityCollectionReducer<any>;
9
- }
10
- /**
11
- * Registry of entity types and their previously-constructed reducers.
12
- * Can create a new CollectionReducer, which it registers for subsequent use.
13
- */
14
- export declare class EntityCollectionReducerRegistry {
15
- private entityCollectionReducerFactory;
16
- protected entityCollectionReducers: EntityCollectionReducers;
17
- private entityCollectionMetaReducer;
18
- constructor(entityCollectionReducerFactory: EntityCollectionReducerFactory, entityCollectionMetaReducers?: MetaReducer<EntityCollection, EntityAction>[]);
19
- /**
20
- * Get the registered EntityCollectionReducer<T> for this entity type or create one and register it.
21
- * @param entityName Name of the entity type for this reducer
22
- */
23
- getOrCreateReducer<T>(entityName: string): EntityCollectionReducer<T>;
24
- /**
25
- * Register an EntityCollectionReducer for an entity type
26
- * @param entityName - the name of the entity type
27
- * @param reducer - reducer for that entity type
28
- *
29
- * Examples:
30
- * registerReducer('Hero', myHeroReducer);
31
- * registerReducer('Villain', myVillainReducer);
32
- */
33
- registerReducer<T>(entityName: string, reducer: EntityCollectionReducer<T>): EntityCollectionReducer<T>;
34
- /**
35
- * Register a batch of EntityCollectionReducers.
36
- * @param reducers - reducers to merge into existing reducers
37
- *
38
- * Examples:
39
- * registerReducers({
40
- * Hero: myHeroReducer,
41
- * Villain: myVillainReducer
42
- * });
43
- */
44
- registerReducers(reducers: EntityCollectionReducers): void;
45
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityCollectionReducerRegistry, [null, { optional: true; }]>;
46
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityCollectionReducerRegistry>;
47
- }
@@ -1,14 +0,0 @@
1
- import { EntityAction } from '../actions/entity-action';
2
- import { EntityCollection } from './entity-collection';
3
- import { EntityCollectionReducerMethodsFactory } from './entity-collection-reducer-methods';
4
- import * as i0 from "@angular/core";
5
- export type EntityCollectionReducer<T = any> = (collection: EntityCollection<T>, action: EntityAction) => EntityCollection<T>;
6
- /** Create a default reducer for a specific entity collection */
7
- export declare class EntityCollectionReducerFactory {
8
- private methodsFactory;
9
- constructor(methodsFactory: EntityCollectionReducerMethodsFactory);
10
- /** Create a default reducer for a collection of entities of T */
11
- create<T = any>(entityName: string): EntityCollectionReducer<T>;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityCollectionReducerFactory, never>;
13
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityCollectionReducerFactory>;
14
- }
@@ -1,41 +0,0 @@
1
- import { EntityState, Dictionary } from '@ngrx/entity';
2
- /** Types of change in a ChangeState instance */
3
- export declare enum ChangeType {
4
- /** The entity has not changed from its last known server state. */
5
- Unchanged = 0,
6
- /** The entity was added to the collection */
7
- Added = 1,
8
- /** The entity is scheduled for delete and was removed from the collection */
9
- Deleted = 2,
10
- /** The entity in the collection was updated */
11
- Updated = 3
12
- }
13
- /**
14
- * Change state for an entity with unsaved changes;
15
- * an entry in an EntityCollection.changeState map
16
- */
17
- export interface ChangeState<T> {
18
- changeType: ChangeType;
19
- originalValue?: T | undefined;
20
- }
21
- /**
22
- * Map of entity primary keys to entity ChangeStates.
23
- * Each entry represents an entity with unsaved changes.
24
- */
25
- export type ChangeStateMap<T> = Dictionary<ChangeState<T>>;
26
- /**
27
- * Data and information about a collection of entities of a single type.
28
- * EntityCollections are maintained in the EntityCache within the ngrx store.
29
- */
30
- export interface EntityCollection<T = any> extends EntityState<T> {
31
- /** Name of the entity type for this collection */
32
- entityName: string;
33
- /** A map of ChangeStates, keyed by id, for entities with unsaved changes */
34
- changeState: ChangeStateMap<T>;
35
- /** The user's current collection filter pattern */
36
- filter?: string;
37
- /** true if collection was ever filled by QueryAll; forced false if cleared */
38
- loaded: boolean;
39
- /** true when a query or save operation is in progress */
40
- loading: boolean;
41
- }
@@ -1,7 +0,0 @@
1
- import { InjectionToken, FactoryProvider } from '@angular/core';
2
- import { MemoizedSelector } from '@ngrx/store';
3
- import { EntityCache } from '../reducers/entity-cache';
4
- export declare const ENTITY_CACHE_SELECTOR_TOKEN: InjectionToken<MemoizedSelector<Object, EntityCache, import("@ngrx/store").DefaultProjectorFn<EntityCache>>>;
5
- export declare const entityCacheSelectorProvider: FactoryProvider;
6
- export type EntityCacheSelector = MemoizedSelector<Object, EntityCache>;
7
- export declare function createEntityCacheSelector(entityCacheName?: string): MemoizedSelector<Object, EntityCache>;
@@ -1,63 +0,0 @@
1
- import { Store } from '@ngrx/store';
2
- import { Actions } from '@ngrx/effects';
3
- import { Dictionary } from '@ngrx/entity';
4
- import { Observable } from 'rxjs';
5
- import { EntityAction } from '../actions/entity-action';
6
- import { EntityCacheSelector } from './entity-cache-selector';
7
- import { EntitySelectors } from './entity-selectors';
8
- import { EntityCache } from '../reducers/entity-cache';
9
- import { EntityCollection, ChangeStateMap } from '../reducers/entity-collection';
10
- import * as i0 from "@angular/core";
11
- /**
12
- * The selector observable functions for entity collection members.
13
- */
14
- export interface EntitySelectors$<T> {
15
- /** Name of the entity collection for these selectors$ */
16
- readonly entityName: string;
17
- /** Names from custom selectors from additionalCollectionState fits here, 'any' to avoid conflict with entityName */
18
- readonly [name: string]: Observable<any> | Store<any> | any;
19
- /** Observable of the collection as a whole */
20
- readonly collection$: Observable<EntityCollection> | Store<EntityCollection>;
21
- /** Observable of count of entities in the cached collection. */
22
- readonly count$: Observable<number> | Store<number>;
23
- /** Observable of all entities in the cached collection. */
24
- readonly entities$: Observable<T[]> | Store<T[]>;
25
- /** Observable of actions related to this entity type. */
26
- readonly entityActions$: Observable<EntityAction>;
27
- /** Observable of the map of entity keys to entities */
28
- readonly entityMap$: Observable<Dictionary<T>> | Store<Dictionary<T>>;
29
- /** Observable of error actions related to this entity type. */
30
- readonly errors$: Observable<EntityAction>;
31
- /** Observable of the filter pattern applied by the entity collection's filter function */
32
- readonly filter$: Observable<string> | Store<string>;
33
- /** Observable of entities in the cached collection that pass the filter function */
34
- readonly filteredEntities$: Observable<T[]> | Store<T[]>;
35
- /** Observable of the keys of the cached collection, in the collection's native sort order */
36
- readonly keys$: Observable<string[] | number[]> | Store<string[] | number[]>;
37
- /** Observable true when the collection has been loaded */
38
- readonly loaded$: Observable<boolean> | Store<boolean>;
39
- /** Observable true when a multi-entity query command is in progress. */
40
- readonly loading$: Observable<boolean> | Store<boolean>;
41
- /** ChangeState (including original values) of entities with unsaved changes */
42
- readonly changeState$: Observable<ChangeStateMap<T>> | Store<ChangeStateMap<T>>;
43
- }
44
- /** Creates observable EntitySelectors$ for entity collections. */
45
- export declare class EntitySelectors$Factory {
46
- private store;
47
- private actions;
48
- private selectEntityCache;
49
- /** Observable of the EntityCache */
50
- entityCache$: Observable<EntityCache>;
51
- /** Observable of error EntityActions (e.g. QUERY_ALL_ERROR) for all entity types */
52
- entityActionErrors$: Observable<EntityAction>;
53
- constructor(store: Store<any>, actions: Actions<EntityAction>, selectEntityCache: EntityCacheSelector);
54
- /**
55
- * Creates an entity collection's selectors$ observables for this factory's store.
56
- * `selectors$` are observable selectors of the cached entity collection.
57
- * @param entityName - is also the name of the collection.
58
- * @param selectors - selector functions for this collection.
59
- **/
60
- create<T, S$ extends EntitySelectors$<T> = EntitySelectors$<T>>(entityName: string, selectors: EntitySelectors<T>): S$;
61
- static ɵfac: i0.ɵɵFactoryDeclaration<EntitySelectors$Factory, never>;
62
- static ɵprov: i0.ɵɵInjectableDeclaration<EntitySelectors$Factory>;
63
- }