@fireflysemantics/slice 17.0.14 → 17.0.17

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.
@@ -15,11 +15,11 @@ const SCROLL_UP_DEBOUNCE_TIME_20 = 20;
15
15
  const SEARCH_DEBOUNCE_TIME_300 = 300;
16
16
 
17
17
  const { freeze } = Object;
18
- const ESTORE_DEFAULT_ID_KEY = "id";
19
- const ESTORE_DEFAULT_GID_KEY = "gid";
18
+ const ESTORE_DEFAULT_ID_KEY = 'id';
19
+ const ESTORE_DEFAULT_GID_KEY = 'gid';
20
20
  const ESTORE_CONFIG_DEFAULT = freeze({
21
21
  idKey: ESTORE_DEFAULT_ID_KEY,
22
- guidKey: ESTORE_DEFAULT_GID_KEY
22
+ guidKey: ESTORE_DEFAULT_GID_KEY,
23
23
  });
24
24
  class AbstractStore {
25
25
  constructor(config) {
@@ -54,7 +54,6 @@ class AbstractStore {
54
54
  * An Observable<E[]> reference
55
55
  * to the entities in the store or
56
56
  * Slice instance.
57
- *
58
57
  */
59
58
  this.obs = this.observe();
60
59
  this.config = config
@@ -110,14 +109,15 @@ class AbstractStore {
110
109
  }
111
110
  /**
112
111
  * Observe store state changes.
112
+ *
113
113
  * @param sort Optional sorting function yielding a sorted observable.
114
114
  * @example
115
- ```
116
- let todos$ = source.observe();
117
- //or with a sort by title function
118
- let todos$ = source.observe((a, b)=>(a.title > b.title ? -1 : 1));
119
- ```
120
- */
115
+ * ```
116
+ * let todos$ = source.observe();
117
+ * //or with a sort by title function
118
+ * let todos$ = source.observe((a, b)=>(a.title > b.title ? -1 : 1));
119
+ * ```
120
+ */
121
121
  observe(sort) {
122
122
  if (sort) {
123
123
  return this.notify.pipe(map((e) => e.sort(sort)));
@@ -126,10 +126,11 @@ class AbstractStore {
126
126
  }
127
127
  /**
128
128
  * Observe delta updates.
129
+ *
129
130
  * @example
130
- <pre>
131
- let todos$ = source.observeDelta();
132
- </pre>
131
+ * ```
132
+ * let todos$ = source.observeDelta();
133
+ * ```
133
134
  */
134
135
  observeDelta() {
135
136
  return this.notifyDelta.asObservable();
@@ -140,10 +141,10 @@ class AbstractStore {
140
141
  * @return A hot {@link Observable} that indicates whether the store is empty.
141
142
  *
142
143
  * @example
143
- <pre>
144
- source.isEmpty();
145
- </pre>
146
- */
144
+ * ```
145
+ * const empty$:Observable<boolean> = source.isEmpty();
146
+ * ```
147
+ */
147
148
  isEmpty() {
148
149
  return this.notify.pipe(map((entries) => entries.length == 0));
149
150
  }
@@ -153,10 +154,10 @@ class AbstractStore {
153
154
  * @return A snapshot that indicates whether the store is empty.
154
155
  *
155
156
  * @example
156
- <pre>
157
- source.isEmpty();
158
- </pre>
159
- */
157
+ * ```
158
+ * const empty:boolean = source.isEmptySnapshot();
159
+ * ```
160
+ */
160
161
  isEmptySnapshot() {
161
162
  return Array.from(this.entries.values()).length == 0;
162
163
  }
@@ -206,7 +207,7 @@ class AbstractStore {
206
207
  </pre>
207
208
  */
208
209
  contains(target) {
209
- if (typeof target === "string") {
210
+ if (typeof target === 'string') {
210
211
  return this.entries.get(target) ? true : false;
211
212
  }
212
213
  const guid = target[this.config.guidKey];
@@ -224,7 +225,7 @@ class AbstractStore {
224
225
  </pre>
225
226
  */
226
227
  containsById(target) {
227
- if (typeof target === "string") {
228
+ if (typeof target === 'string') {
228
229
  return this.idEntries.get(target) ? true : false;
229
230
  }
230
231
  const id = target[this.config.idKey];
@@ -256,14 +257,14 @@ class AbstractStore {
256
257
  * @param p The predicate used to query for the selection.
257
258
  * @return A snapshot array containing the entities that match the predicate.
258
259
  *
259
- * @example Select all the `Todo` instance where the `title` length is greater than 100.
260
- ```
261
- let todos:Todo[]=store.select(todo=>todo.title.length>100);
262
- ```
260
+ * @example Select all the Todo instances where the title length is greater than 100.
261
+ * ```
262
+ * let todos:Todo[]=store.select(todo=>todo.title.length>100);
263
+ * ```
263
264
  */
264
265
  select(p) {
265
266
  const selected = [];
266
- Array.from(this.entries.values()).forEach(e => {
267
+ Array.from(this.entries.values()).forEach((e) => {
267
268
  if (p(e)) {
268
269
  selected.push(e);
269
270
  }
@@ -275,10 +276,11 @@ class AbstractStore {
275
276
  * @param e1 The first entity
276
277
  * @param e2 The second entity
277
278
  * @return true if the two entities have equal GUID ids
278
- * @example Compare `todo1` with `todo2` by `gid`.
279
- ```
280
- if (equalsByGUID(todo1, todo2)){...};
281
- ```
279
+ *
280
+ * @example Compare todo1 with todo2 by gid.
281
+ * ```
282
+ * if (equalsByGUID(todo1, todo2)){...};
283
+ * ```
282
284
  */
283
285
  equalsByGUID(e1, e2) {
284
286
  return e1[this.GUID_KEY] == e2[this.GUID_KEY];
@@ -288,16 +290,18 @@ class AbstractStore {
288
290
  * @param e1 The first entity
289
291
  * @param e2 The second entity
290
292
  * @return true if the two entities have equal ID ids
291
- * @example Compare `todo1` with `todo2` by `id`.
292
- ```
293
- if (equalsByID(todo1, todo2)){...};
294
- ```
293
+ *
294
+ * @example Compare todo1 with todo2 by id.
295
+ *
296
+ * ```
297
+ * if (equalsByID(todo1, todo2)){...};
298
+ * ```
295
299
  */
296
300
  equalsByID(e1, e2) {
297
301
  return e1[this.ID_KEY] == e2[this.ID_KEY];
298
302
  }
299
303
  /**
300
- * Calls complete on all {@link BehaviorSubject} instances.
304
+ * Calls complete on all {@link ReplaySubject} instances.
301
305
  *
302
306
  * Call destroy when disposing of the store.
303
307
  */
@@ -542,15 +546,15 @@ class Slice extends AbstractStore {
542
546
  * @param eStore The EStore instance containing the elements considered for slicing
543
547
  *
544
548
  * @example
545
- <pre>
546
- //Empty slice
547
- new Slice<Todo>(Todo.COMPLETE, todo=>!todo.complete);
548
-
549
- //Initialized slice
550
- let todos = [new Todo(false, "You complete me!"),
551
- new Todo(true, "You completed me!")];
552
- new Slice<Todo>(Todo.COMPLETE, todo=>!todo.complete, todos);
553
- </pre>
549
+ * ```
550
+ * //Empty slice
551
+ * new Slice<Todo>(Todo.COMPLETE, todo=>!todo.complete);
552
+ *
553
+ * //Initialized slice
554
+ * let todos = [new Todo(false, "You complete me!"),
555
+ * new Todo(true, "You completed me!")];
556
+ * new Slice<Todo>(Todo.COMPLETE, todo=>!todo.complete, todos);
557
+ * ```
554
558
  */
555
559
  constructor(label, predicate, eStore) {
556
560
  super();
@@ -755,36 +759,43 @@ class Slice extends AbstractStore {
755
759
  * This `todoFactory` code will be used to illustrate the API examples. The following
756
760
  * utilities are used in the tests and the API Typedoc examples contained here.
757
761
  * @example Utilities for API Examples
758
- ```
759
- export const enum TodoSliceEnum {
760
- COMPLETE = "Complete",
761
- INCOMPLETE = "Incomplete"
762
- }
763
-
764
- export class Todo {
765
- constructor(public complete: boolean, public title: string,public gid?:string, public id?:string) {}
766
- }
767
-
768
- export let todos = [new Todo(false, "You complete me!"), new Todo(true, "You completed me!")];
769
-
770
- export function todosFactory():Todo[] {
771
- return [new Todo(false, "You complete me!"), new Todo(true, "You completed me!")];
772
- }
773
- ```
762
+ * ```
763
+ * export const enum TodoSliceEnum {
764
+ * COMPLETE = "Complete",
765
+ * INCOMPLETE = "Incomplete"
766
+ * }
767
+ * export class Todo {
768
+ * constructor(
769
+ * public complete: boolean,
770
+ * public title: string,
771
+ * public gid?:string,
772
+ * public id?:string) {}
773
+ * }
774
+ *
775
+ * export let todos = [new Todo(false, "You complete me!"), new Todo(true, "You completed me!")];
776
+ *
777
+ * export function todosFactory():Todo[] {
778
+ * return [new Todo(false, "You complete me!"), new Todo(true, "You completed me!")];
779
+ * }
780
+ * ```
774
781
  */
775
782
  class EStore extends AbstractStore {
776
783
  /**
777
784
  * Store constructor (Initialization with element is optional)
778
785
  *
779
786
  * perform initial notification to all observers,
780
- * such that function like {@link combineLatest}{}
787
+ * such that functions like {@link combineLatest}{}
781
788
  * will execute at least once.
782
- * @param entities
783
- * @example Dynamic `EStore<Todo>` Creation
784
- ```
785
- // Initialize the Store
786
- let store: EStore<Todo> = new EStore<Todo>(todosFactory());
787
- ```*/
789
+ *
790
+ * @param entities The entities to initialize the store with.
791
+ * @param config The optional configuration instance.
792
+ *
793
+ * @example EStore<Todo> Creation
794
+ * ```
795
+ * // Initialize the Store
796
+ * let store: EStore<Todo> = new EStore<Todo>(todosFactory());
797
+ * ```
798
+ */
788
799
  constructor(entities = [], config) {
789
800
  super(config);
790
801
  /**
@@ -839,7 +850,7 @@ class EStore extends AbstractStore {
839
850
  this.notifyDelta.next(delta);
840
851
  }
841
852
  /**
842
- * Calls complete on all {@link BehaviorSubject} instances.
853
+ * Calls complete on all EStore {@link ReplaySubject} instances.
843
854
  *
844
855
  * Call destroy when disposing of the store.
845
856
  */
@@ -847,7 +858,7 @@ class EStore extends AbstractStore {
847
858
  super.destroy();
848
859
  this.notifyLoading.complete();
849
860
  this.notifyActive.complete();
850
- this.slices.forEach(slice => slice.destroy());
861
+ this.slices.forEach((slice) => slice.destroy());
851
862
  }
852
863
  /**
853
864
  * Toggles the entity:
@@ -856,16 +867,15 @@ class EStore extends AbstractStore {
856
867
  * it will be deleted. If the store
857
868
  * does not contains the entity,
858
869
  * it is added.
859
- * @param e
860
- * @example Toggle the `Todo` instance
861
- ```
862
- estore.post(todo);
863
- // Remove todo
864
- estore.toggle(todo);
865
- // Add it back
866
- estore.toggle(todo);
867
-
868
- ```
870
+ * @param e The entity to toggle
871
+ * @example Toggle the Todo instance
872
+ * ```
873
+ * estore.post(todo);
874
+ * // Remove todo
875
+ * estore.toggle(todo);
876
+ * // Add it back
877
+ * estore.toggle(todo);
878
+ * ```
869
879
  */
870
880
  toggle(e) {
871
881
  if (this.contains(e)) {
@@ -886,11 +896,11 @@ class EStore extends AbstractStore {
886
896
  * change detection in the event that it maintains
887
897
  * a reference to the `active` state `Map` instance.
888
898
  *
889
- * @example Add a `todo1` and `todo2` as active
890
- ```
891
- addActive(todo1);
892
- addActive(todo2);
893
- ```
899
+ * @example Add todo1 and todo2 as active
900
+ * ```
901
+ * addActive(todo1);
902
+ * addActive(todo2);
903
+ * ```
894
904
  */
895
905
  addActive(e) {
896
906
  if (this.contains(e)) {
@@ -904,18 +914,18 @@ class EStore extends AbstractStore {
904
914
  }
905
915
  }
906
916
  /**
907
- * Delete an entity as active.
917
+ * Delete an active entity.
908
918
  *
909
919
  * Also we clone the map prior to broadcasting it with
910
920
  * `notifyActive` to make sure we will trigger Angular
911
921
  * change detection in the event that it maintains
912
922
  * a reference to the `active` state `Map` instance.
913
923
  *
914
- * @example Mark a `todo` instance as active
915
- ```
916
- deleteActive(todo1);
917
- deleteActive(todo2);
918
- ```
924
+ * @example Remove todo1 and todo2 as active entities
925
+ * ```
926
+ * deleteActive(todo1);
927
+ * deleteActive(todo2);
928
+ * ```
919
929
  */
920
930
  deleteActive(e) {
921
931
  this.active.delete(e.gid);
@@ -929,23 +939,23 @@ class EStore extends AbstractStore {
929
939
  * change detection in the event that it maintains
930
940
  * a reference to the `active` state `Map` instance.
931
941
  *
932
- * @example Mark a `todo` instance as active
933
- ```
934
- deleteActive(todo1);
935
- deleteActive(todo2);
936
- ```
942
+ * @example Clear active todo instances
943
+ * ```
944
+ * store.clearActive();
945
+ * ```
937
946
  */
938
947
  clearActive() {
939
948
  this.active.clear();
940
949
  this.notifyActive.next(new Map(this.active));
941
950
  }
942
951
  /**
943
- * Observe the active entity.
952
+ * Observe the active entities.
953
+ *
944
954
  * @example
945
- <pre>
946
- let active$ = source.observeActive();
947
- </pre>
948
- */
955
+ * ```
956
+ * let active$ = store.observeActive();
957
+ * ```
958
+ */
949
959
  observeActive() {
950
960
  return this.notifyActive.asObservable();
951
961
  }
@@ -968,35 +978,91 @@ class EStore extends AbstractStore {
968
978
  }
969
979
  /**
970
980
  * @return A snapshot of the loading state.
981
+ * @example Create a reference to the loading state
982
+ * ```
983
+ * const loading:boolean = todoStore.loading;
984
+ * ```
971
985
  */
972
986
  get loading() {
973
987
  return this._loading;
974
988
  }
975
989
  /**
976
990
  * Observe loading.
991
+ *
992
+ * Note that this obverable piped through
993
+ * `takeWhile(v->v, true), such that it will
994
+ * complete after each emission.
995
+ *
996
+ * See:
997
+ * https://fireflysemantics.medium.com/waiting-on-estore-to-load-8dcbe161613c
998
+ *
999
+ * For more details.
1000
+ * Also note that v=>v is the same as v=>v!=false
1001
+ *
977
1002
  * @example
978
- <pre>
979
- let loading$ = source.observeLoading();
980
- </pre>
981
-
982
- Note that this obverable piped through
983
- `takeWhile(v->v, true), such that it will
984
- complete after each emission.
985
-
986
- See:
987
- https://medium.com/@ole.ersoy/waiting-on-estore-to-load-8dcbe161613c
988
-
989
- For more details.
990
- */
1003
+ * ```
1004
+ * const observeLoadingHandler: Observer<boolean> = {
1005
+ * complete: () => {
1006
+ * console.log(`Data Loaded and Observable Marked as Complete`);
1007
+ * }, // completeHandler
1008
+ * error: () => {
1009
+ * console.log(`Any Errors?`);
1010
+ * }, // errorHandler
1011
+ * next: (l) => {
1012
+ * console.log(`Data loaded and loading is ${l}`);
1013
+ * },
1014
+ * };
1015
+ *
1016
+ * const observeLoadingResubscribeHandler: Observer<boolean> = {
1017
+ * complete: () => {
1018
+ * console.log(`Data Loaded and Resubscribe Observable Marked as Complete`);
1019
+ * }, // completeHandler
1020
+ * error: () => {
1021
+ * console.log(`Any Resubscribe Errors?`);
1022
+ * }, // errorHandler
1023
+ * next: (l) => {
1024
+ * console.log(`Data loaded and resusbscribe loading value is ${l}`);
1025
+ * },
1026
+ * };
1027
+ *
1028
+ * const todoStore: EStore<Todo> = new EStore();
1029
+ * //============================================
1030
+ * // Loading is true by default
1031
+ * //============================================
1032
+ * console.log(`The initial value of loading is ${todoStore.loading}`);
1033
+ * //============================================
1034
+ * // Observe Loading
1035
+ * //============================================
1036
+ * let loading$: Observable<boolean> = todoStore.observeLoading();
1037
+ * loading$.subscribe((l) => console.log(`The value of loading is ${l}`));
1038
+ *
1039
+ * todoStore.loading = false;
1040
+ * loading$.subscribe(observeLoadingHandler);
1041
+ * //============================================
1042
+ * // The subscription no longer fires
1043
+ * //============================================
1044
+ * todoStore.loading = true;
1045
+ * todoStore.loading = false;
1046
+ *
1047
+ * //============================================
1048
+ * // The subscription no longer fires,
1049
+ * // so if we want to observe loading again
1050
+ * // resusbscribe.
1051
+ * //============================================
1052
+ * todoStore.loading = true;
1053
+ * loading$ = todoStore.observeLoading();
1054
+ * loading$.subscribe(observeLoadingResubscribeHandler);
1055
+ * todoStore.loading = false;
1056
+ * ```
1057
+ */
991
1058
  observeLoading() {
992
- return this.notifyLoading.asObservable().
993
- pipe(takeWhile(v => v, true));
1059
+ return this.notifyLoading.asObservable().pipe(takeWhile((v) => v, true));
994
1060
  }
995
1061
  /**
996
1062
  * Notfiies when loading has completed.
997
1063
  */
998
1064
  observeLoadingComplete() {
999
- return this.observeLoading().pipe(filter(loading => loading == false), switchMap(() => of(true)));
1065
+ return this.observeLoading().pipe(filter((loading) => loading == false), switchMap(() => of(true)));
1000
1066
  }
1001
1067
  /**
1002
1068
  * Sets the current searching state and notifies observers.
@@ -1028,14 +1094,13 @@ class EStore extends AbstractStore {
1028
1094
  For more details.
1029
1095
  */
1030
1096
  observeSearching() {
1031
- return this.notifySearching.asObservable().
1032
- pipe(takeWhile(v => v, true));
1097
+ return this.notifySearching.asObservable().pipe(takeWhile((v) => v, true));
1033
1098
  }
1034
1099
  /**
1035
1100
  * Notfiies when searching has completed.
1036
1101
  */
1037
1102
  observeSearchingComplete() {
1038
- return this.observeSearching().pipe(filter(searching => searching == false), switchMap(() => of(true)));
1103
+ return this.observeSearching().pipe(filter((searching) => searching == false), switchMap(() => of(true)));
1039
1104
  }
1040
1105
  /**
1041
1106
  * Adds a slice to the store and keys it by the slices label.
@@ -1080,10 +1145,11 @@ class EStore extends AbstractStore {
1080
1145
  /**
1081
1146
  * Post (Add a new) element(s) to the store.
1082
1147
  * @param e An indiidual entity or an array of entities
1083
- * @example Post a `todo`.
1084
- ```
1085
- store.post(todo);
1086
- ```
1148
+ * @example Post a Todo instance.
1149
+ *
1150
+ *```
1151
+ * store.post(todo);
1152
+ *```
1087
1153
  */
1088
1154
  post(e) {
1089
1155
  if (!Array.isArray(e)) {
@@ -1093,7 +1159,7 @@ class EStore extends AbstractStore {
1093
1159
  e[this.GUID_KEY] = guid;
1094
1160
  this.entries.set(guid, e);
1095
1161
  this.updateIDEntry(e);
1096
- Array.from(this.slices.values()).forEach(s => {
1162
+ Array.from(this.slices.values()).forEach((s) => {
1097
1163
  s.post(e);
1098
1164
  });
1099
1165
  //Create a new array reference to trigger Angular change detection.
@@ -1106,15 +1172,15 @@ class EStore extends AbstractStore {
1106
1172
  }
1107
1173
  }
1108
1174
  /**
1109
- * Post elements to the store.
1175
+ * Post N entities to the store.
1110
1176
  * @param ...e
1111
- * @example Post two `Todo` instances.
1112
- ```
1113
- store.post(todo1, todo2);
1114
- ```
1177
+ * @example Post two Todo instances.
1178
+ * ```
1179
+ * store.post(todo1, todo2);
1180
+ * ```
1115
1181
  */
1116
1182
  postN(...e) {
1117
- e.forEach(e => {
1183
+ e.forEach((e) => {
1118
1184
  const guid = e[this.GUID_KEY]
1119
1185
  ? e[this.GUID_KEY]
1120
1186
  : GUID();
@@ -1122,7 +1188,7 @@ class EStore extends AbstractStore {
1122
1188
  this.entries.set(guid, e);
1123
1189
  this.updateIDEntry(e);
1124
1190
  });
1125
- Array.from(this.slices.values()).forEach(s => {
1191
+ Array.from(this.slices.values()).forEach((s) => {
1126
1192
  s.postA(e);
1127
1193
  });
1128
1194
  //Create a new array reference to trigger Angular change detection.
@@ -1133,21 +1199,22 @@ class EStore extends AbstractStore {
1133
1199
  /**
1134
1200
  * Post (Add) an array of elements to the store.
1135
1201
  * @param e
1136
- * @example Post a `Todo` array.
1137
- ```
1138
- store.post([todo1, todo2]);
1139
- ```
1202
+ * @example Post a Todo array.
1203
+ *
1204
+ * ```
1205
+ * store.post([todo1, todo2]);
1206
+ * ```
1140
1207
  */
1141
1208
  postA(e) {
1142
1209
  this.postN(...e);
1143
1210
  }
1144
1211
  /**
1145
- * Put (Update) an element.
1212
+ * Put (Update) an entity.
1146
1213
  * @param e
1147
1214
  * @example Put a Todo instance.
1148
- ```
1149
- store.put(todo1);
1150
- ```
1215
+ * ```
1216
+ * store.put(todo1);
1217
+ * ```
1151
1218
  */
1152
1219
  put(e) {
1153
1220
  if (!Array.isArray(e)) {
@@ -1158,7 +1225,7 @@ class EStore extends AbstractStore {
1158
1225
  this.notify.next(v);
1159
1226
  const delta = { type: "Put" /* ActionTypes.PUT */, entries: [e] };
1160
1227
  this.notifyDelta.next(delta);
1161
- Array.from(this.slices.values()).forEach(s => {
1228
+ Array.from(this.slices.values()).forEach((s) => {
1162
1229
  s.put(e);
1163
1230
  });
1164
1231
  }
@@ -1169,25 +1236,26 @@ class EStore extends AbstractStore {
1169
1236
  /**
1170
1237
  * Put (Update) an element or add an element that was read from a persistence source
1171
1238
  * and thus already has an assigned global id`.
1172
- * @param e
1173
- * @example Put Todo instances.
1174
- ```
1175
- store.put(todo1, todo2);
1176
- ```
1239
+ * @param e The enetity instances to update.
1240
+ * @example Put N Todo instances.
1241
+ *
1242
+ * ```
1243
+ * store.put(todo1, todo2);
1244
+ * ```
1177
1245
  */
1178
1246
  putN(...e) {
1179
1247
  this.putA(e);
1180
1248
  }
1181
1249
  /**
1182
- * Put (Update) the array of elements.
1183
- * @param e
1184
- * @example Put Todo instances.
1185
- ```
1186
- store.put([todo1, todo2]);
1187
- ```
1250
+ * Put (Update) the array of enntities.
1251
+ * @param e The array of enntities to update
1252
+ * @example Put an array of Todo instances.
1253
+ * ```
1254
+ * store.put([todo1, todo2]);
1255
+ * ```
1188
1256
  */
1189
1257
  putA(e) {
1190
- e.forEach(e => {
1258
+ e.forEach((e) => {
1191
1259
  let guid = e[this.GUID_KEY];
1192
1260
  this.entries.set(guid, e);
1193
1261
  this.updateIDEntry(e);
@@ -1197,7 +1265,7 @@ class EStore extends AbstractStore {
1197
1265
  this.notify.next(v);
1198
1266
  const delta = { type: "Put" /* ActionTypes.PUT */, entries: e };
1199
1267
  this.notifyDelta.next(delta);
1200
- Array.from(this.slices.values()).forEach(s => {
1268
+ Array.from(this.slices.values()).forEach((s) => {
1201
1269
  s.putA(e);
1202
1270
  });
1203
1271
  }
@@ -1205,9 +1273,9 @@ class EStore extends AbstractStore {
1205
1273
  * Delete (Update) the array of elements.
1206
1274
  * @param e
1207
1275
  * @example Delete todo1.
1208
- ```
1209
- store.delete(todo1]);
1210
- ```
1276
+ * ```
1277
+ * store.delete(todo1]);
1278
+ * ```
1211
1279
  */
1212
1280
  delete(e) {
1213
1281
  if (!Array.isArray(e)) {
@@ -1215,14 +1283,14 @@ class EStore extends AbstractStore {
1215
1283
  const guid = e[this.GUID_KEY];
1216
1284
  this.entries.delete(guid);
1217
1285
  this.deleteIDEntry(e);
1218
- Array.from(this.slices.values()).forEach(s => {
1286
+ Array.from(this.slices.values()).forEach((s) => {
1219
1287
  s.entries.delete(guid);
1220
1288
  });
1221
1289
  //Create a new array reference to trigger Angular change detection.
1222
1290
  let v = [...Array.from(this.entries.values())];
1223
1291
  const delta = { type: "Delete" /* ActionTypes.DELETE */, entries: [e] };
1224
1292
  this.notifyAll(v, delta);
1225
- Array.from(this.slices.values()).forEach(s => {
1293
+ Array.from(this.slices.values()).forEach((s) => {
1226
1294
  s.delete(e);
1227
1295
  });
1228
1296
  }
@@ -1233,29 +1301,29 @@ class EStore extends AbstractStore {
1233
1301
  /**
1234
1302
  * Delete N elements.
1235
1303
  * @param ...e
1236
- * @example Put Todo instances.
1237
- ```
1238
- store.delete(todo1, todo2);
1239
- ```
1304
+ * @example Delete N Todo instance argument.
1305
+ * ```
1306
+ * store.deleteN(todo1, todo2);
1307
+ * ```
1240
1308
  */
1241
1309
  deleteN(...e) {
1242
1310
  this.deleteA(e);
1243
1311
  }
1244
1312
  /**
1245
- * Delete N elements.
1246
- * @param ...e
1247
- * @example Put Todo instances.
1248
- ```
1249
- store.delete(todo1, todo2);
1250
- ```
1313
+ * Delete an array of elements.
1314
+ * @param e The array of instances to be deleted
1315
+ * @example Delete the array of Todo instances.
1316
+ * ```
1317
+ * store.deleteA([todo1, todo2]);
1318
+ * ```
1251
1319
  */
1252
1320
  deleteA(e) {
1253
- e.forEach(e => {
1321
+ e.forEach((e) => {
1254
1322
  this.deleteActive(e);
1255
1323
  const guid = e[this.GUID_KEY];
1256
1324
  this.entries.delete(guid);
1257
1325
  this.deleteIDEntry(e);
1258
- Array.from(this.slices.values()).forEach(s => {
1326
+ Array.from(this.slices.values()).forEach((s) => {
1259
1327
  s.entries.delete(guid);
1260
1328
  });
1261
1329
  });
@@ -1263,21 +1331,21 @@ class EStore extends AbstractStore {
1263
1331
  let v = [...Array.from(this.entries.values())];
1264
1332
  const delta = { type: "Delete" /* ActionTypes.DELETE */, entries: e };
1265
1333
  this.notifyAll(v, delta);
1266
- Array.from(this.slices.values()).forEach(s => {
1334
+ Array.from(this.slices.values()).forEach((s) => {
1267
1335
  s.deleteA(e);
1268
1336
  });
1269
1337
  }
1270
1338
  /**
1271
1339
  * Delete elements by {@link Predicate}.
1272
1340
  * @param p The predicate.
1273
- * @example Put Todo instances.
1274
- ```
1275
- store.delete(todo1, todo2);
1276
- ```
1341
+ * @example Delete the Todo instances.
1342
+ * ```
1343
+ * store.delete(todo1, todo2);
1344
+ * ```
1277
1345
  */
1278
1346
  deleteP(p) {
1279
1347
  const d = [];
1280
- Array.from(this.entries.values()).forEach(e => {
1348
+ Array.from(this.entries.values()).forEach((e) => {
1281
1349
  if (p(e)) {
1282
1350
  d.push(e);
1283
1351
  const id = e[this.GUID_KEY];
@@ -1290,7 +1358,7 @@ class EStore extends AbstractStore {
1290
1358
  let v = [...Array.from(this.entries.values())];
1291
1359
  const delta = { type: "Delete" /* ActionTypes.DELETE */, entries: d };
1292
1360
  this.notifyAll(v, delta);
1293
- Array.from(this.slices.values()).forEach(s => {
1361
+ Array.from(this.slices.values()).forEach((s) => {
1294
1362
  s.deleteA(d);
1295
1363
  });
1296
1364
  }
@@ -1323,18 +1391,18 @@ class EStore extends AbstractStore {
1323
1391
  * send their own delta notification.
1324
1392
  *
1325
1393
  * @example Reset the store.
1326
- ```
1327
- store.reset();
1328
- ```
1394
+ * ```
1395
+ * store.reset();
1396
+ * ```
1329
1397
  */
1330
1398
  reset() {
1331
1399
  const delta = {
1332
1400
  type: "Reset" /* ActionTypes.RESET */,
1333
- entries: Array.from(this.entries.values())
1401
+ entries: Array.from(this.entries.values()),
1334
1402
  };
1335
1403
  this.notifyAll([], delta);
1336
1404
  this.entries = new Map();
1337
- Array.from(this.slices.values()).forEach(s => {
1405
+ Array.from(this.slices.values()).forEach((s) => {
1338
1406
  s.reset();
1339
1407
  });
1340
1408
  }