(type: TaskType)
| 96 | const TASK_ID_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz' |
| 97 | |
| 98 | export function generateTaskId(type: TaskType): string { |
| 99 | const prefix = getTaskIdPrefix(type) |
| 100 | const bytes = randomBytes(8) |
| 101 | let id = prefix |
| 102 | for (let i = 0; i < 8; i++) { |
| 103 | id += TASK_ID_ALPHABET[bytes[i]! % TASK_ID_ALPHABET.length] |
| 104 | } |
| 105 | return id |
| 106 | } |
| 107 | |
| 108 | export function createTaskStateBase( |
| 109 | id: string, |
no test coverage detected