-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: replace 'ALL' task by empty filter
- Loading branch information
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const BATCH_SEARCH = 'BatchSearchRunner' | ||
const BATCH_DOWNLOAD = 'BatchDownloadRunner' | ||
const SCAN = 'ScanTask' | ||
const INDEX = 'IndexTask' | ||
const EXTRACT_NLP = 'ExtractNlpTask' | ||
export const TASK_NAMES = Object.freeze({ | ||
BATCH_SEARCH, | ||
BATCH_DOWNLOAD, | ||
SCAN, | ||
INDEX, | ||
EXTRACT_NLP | ||
}) | ||
export const taskNameValidator = (v) => TASK_NAMES.includes(v) | ||
|
||
export function getTaskName(longName) { | ||
const taskName = longName.split('.').pop() | ||
if (taskNameValidator(taskName)) { | ||
return taskName | ||
} | ||
throw new Error(`Wrong task name ${longName}`) | ||
} | ||
|
||
export function getLongTaskName(shortName) { | ||
if (taskNameValidator(shortName)) { | ||
return `org.icij.datashare.tasks.${shortName}` | ||
} | ||
throw new Error(`Wrong task name ${shortName}`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters