Skip to content

Commit 7d0c9ad

Browse files
committed
Started using 'getEventType'.
1 parent ab5998f commit 7d0c9ad

File tree

6 files changed

+12616
-24
lines changed

6 files changed

+12616
-24
lines changed

src/common/helpers.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,23 @@ const EVENT_TYPE_TRANSLATION_TABLE = {
2323
"EXTRACTION_ATTACHMENTS_CONTINUE": EventType.ExtractionAttachmentsContinue,
2424
"EXTRACTION_DATA_DELETE": EventType.ExtractionDataDelete,
2525
"EXTRACTION_ATTACHMENTS_DELETE": EventType.ExtractionAttachmentsDelete,
26-
27-
"EXTRACTION_EXTERNAL_SYNC_UNITS_DONE": ExtractorEventType.ExtractionExternalSyncUnitsDone,
28-
"EXTRACTION_EXTERNAL_SYNC_UNITS_ERROR": ExtractorEventType.ExtractionExternalSyncUnitsError,
29-
"EXTRACTION_METADATA_DONE": ExtractorEventType.ExtractionMetadataDone,
30-
"EXTRACTION_METADATA_ERROR": ExtractorEventType.ExtractionMetadataError,
31-
"EXTRACTION_DATA_PROGRESS": ExtractorEventType.ExtractionDataProgress,
32-
"EXTRACTION_DATA_DELAY": ExtractorEventType.ExtractionDataDelay,
33-
"EXTRACTION_DATA_DONE": ExtractorEventType.ExtractionDataDone,
34-
"EXTRACTION_DATA_ERROR": ExtractorEventType.ExtractionDataError,
35-
"EXTRACTION_ATTACHMENTS_PROGRESS": ExtractorEventType.ExtractionAttachmentsProgress,
36-
"EXTRACTION_ATTACHMENTS_DELAY": ExtractorEventType.ExtractionAttachmentsDelay,
37-
"EXTRACTION_ATTACHMENTS_DONE": ExtractorEventType.ExtractionAttachmentsDone,
38-
"EXTRACTION_ATTACHMENTS_ERROR": ExtractorEventType.ExtractionAttachmentsError,
39-
"EXTRACTION_DATA_DELETE_DONE": ExtractorEventType.ExtractionDataDeleteDone,
40-
"EXTRACTION_DATA_DELETE_ERROR": ExtractorEventType.ExtractionDataDeleteError,
41-
"EXTRACTION_ATTACHMENTS_DELETE_DONE": ExtractorEventType.ExtractionAttachmentsDeleteDone,
42-
"EXTRACTION_ATTACHMENTS_DELETE_ERROR": ExtractorEventType.ExtractionAttachmentsDeleteError
4326
};
4427

4528
/**
4629
* Translates Event type from the old naming scheme to the new one
4730
*/
48-
export function getEventType(eventType: string): EventType | ExtractorEventType {
31+
export function getEventType(eventType: string): EventType {
4932
// If we notice that the event has a newer translation, translate to that
5033
if(eventType in EVENT_TYPE_TRANSLATION_TABLE){
5134
return EVENT_TYPE_TRANSLATION_TABLE[eventType as keyof typeof EVENT_TYPE_TRANSLATION_TABLE];
5235
}
5336

54-
// Return the correct event type
55-
if (eventType in ExtractorEventType) {
56-
return eventType as ExtractorEventType;
57-
}else if (eventType in EventType) {
37+
// Event type doesn't need translation, return
38+
if (eventType in EventType) {
5839
return eventType as EventType;
5940
}
6041

61-
return ExtractorEventType.UnknownEventType;
42+
return EventType.UnknownEventType;
6243
}
6344

6445
export function getTimeoutErrorEventType(eventType: EventType): {

0 commit comments

Comments
 (0)