forked from WorldBrain/Memex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.js
82 lines (70 loc) · 1.98 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/** Filter/projection values for download details table UI filters. */
export const FILTERS = {
ALL: 'all',
FAIL: 'fail',
SUCC: 'success',
}
/** User-facing strings for download statuses. */
export const DOWNLOAD_STATUS = {
SKIP: 'Skipped',
FAIL: 'Failed',
SUCC: 'Success',
}
/** States for importer. */
export const STATUS = {
LOADING: 'loading',
IDLE: 'idle',
RUNNING: 'running',
PAUSED: 'paused',
STOPPED: 'stopped',
}
/** Different types of imports. */
export const IMPORT_TYPE = {
BOOKMARK: 'b',
HISTORY: 'h',
OTHERS: 'o',
}
export const IMPORT_SERVICES = {
POCKET: 'p',
NETSCAPE: 'n',
}
export const IMPORT_TYPE_DISPLAY = {
[IMPORT_TYPE.BOOKMARK]: 'bookmarks',
[IMPORT_TYPE.HISTORY]: 'history',
[IMPORT_TYPE.OTHERS]: 'pocket',
}
/** Keys used for local storage. */
export const STORAGE_KEYS = {
HISTORY_STATS: 'history_stats',
BOOKMARK_STATS: 'bookmark_stats',
ALLOW_TYPES: 'allow_types',
DOWNLOAD_DATA: 'import_progress',
IMPORT_STATE: 'import_state',
TOTALS_STATE: 'import_totals_state',
SUCCESS_STATE: 'import_success_progress_state',
FAIL_STATE: 'import_fail_progress_state',
}
export const IMPORT_CONN_NAME = 'imports-bg-ui-runtime-connection'
export const CMD_PRE = 'imports/'
/** Commands used for BG <-> UI bi-directional communication */
export const CMDS = {
INIT: `${CMD_PRE}INIT`,
START: `${CMD_PRE}START`,
PAUSE: `${CMD_PRE}PAUSE`,
RESUME: `${CMD_PRE}RESUME`,
FINISH: `${CMD_PRE}FINISH`,
CANCEL: `${CMD_PRE}CANCEL`,
NEXT: `${CMD_PRE}NEXT`,
COMPLETE: `${CMD_PRE}COMPLETE`,
RECALC: `${CMD_PRE}RECALC`,
SET_CONCURRENCY: `${CMD_PRE}SET_CONCURRENCY`,
SET_PROCESS_ERRS: `${CMD_PRE}SET_PROCESS_ERRS`,
}
/** Estimated time to download a doc (seconds) */
export const DOC_TIME_EST = 0.5
export const DEF_CONCURRENCY = 10
export const DEF_ALLOW = {
[IMPORT_TYPE.HISTORY]: false,
[IMPORT_TYPE.BOOKMARK]: false,
[IMPORT_TYPE.OTHERS]: false,
}