1818
1919<script setup lang="ts">
2020import type { AbstractEvent } from " ~dm-types/events/AbstractEvent" ;
21+ import type { CollectionSubscriptionAdditionEvent } from " ~dm-types/events/CollectionSubscriptionAdditionEvent" ;
2122import type { CollectionUpdateEvent } from " ~dm-types/events/CollectionUpdateEvent" ;
2223import type { EdgeCreationEvent } from " ~dm-types/events/EdgeCreationEvent" ;
2324
@@ -37,23 +38,33 @@ const eventUserIds = $computed(() =>
3738);
3839const isCollectionUpdateEvent = (
3940 event : AbstractEvent ,
40- ): event is CollectionUpdateEvent => event .hasOwnProperty ( " numberOfIssues " ) ;
41+ ): event is CollectionUpdateEvent => event .type === " collection_update " ;
4142
4243const isEdgeCreationEvent = (
4344 event : AbstractEvent ,
44- ): event is EdgeCreationEvent => event .hasOwnProperty (" issuecodes" );
45+ ): event is EdgeCreationEvent => event .type === " edge" ;
46+
47+ const isCollectionSubscriptionAdditionEvent = (
48+ event : AbstractEvent ,
49+ ): event is CollectionSubscriptionAdditionEvent =>
50+ event .type === " subscription_additions" ;
4551
4652const fetchEventsAndAssociatedData = async () => {
4753 await fetchEvents ();
4854
49- await fetchIssuecodeDetails ([
50- ... events .value
51- .filter ((event ) => isCollectionUpdateEvent (event ))
52- .map (({ exampleIssuecode }) => exampleIssuecode ),
53- ... events .value
54- .filter ((event ) => isEdgeCreationEvent (event ))
55- .reduce <string []>((acc , { issuecodes }) => [... acc , ... issuecodes ], []),
56- ]);
55+ await fetchIssuecodeDetails (
56+ [
57+ events .value
58+ .filter ((event ) => isCollectionUpdateEvent (event ))
59+ .map (({ exampleIssuecode }) => exampleIssuecode ),
60+ events .value
61+ .filter ((event ) => isCollectionSubscriptionAdditionEvent (event ))
62+ .reduce <string []>((acc , { issuecode }) => [... acc , issuecode ], []),
63+ events .value
64+ .filter ((event ) => isEdgeCreationEvent (event ))
65+ .reduce <string []>((acc , { issuecodes }) => [... acc , ... issuecodes ], []),
66+ ].flat (),
67+ );
5768
5869 await fetchPublicationNames ([
5970 ... events .value
0 commit comments