Queue.utils.tsx24 lines · main
| 1 | import { capitalize } from 'lodash' |
| 2 | |
| 3 | export const QUEUE_MESSAGE_TYPES = ['archived', 'available', 'scheduled'] as const |
| 4 | export type QUEUE_MESSAGE_TYPE = (typeof QUEUE_MESSAGE_TYPES)[number] |
| 5 | |
| 6 | export const QUEUE_MESSAGE_OPTIONS = QUEUE_MESSAGE_TYPES.map((type) => ({ |
| 7 | id: type, |
| 8 | name: capitalize(type), |
| 9 | })) |
| 10 | |
| 11 | export const getQueueFunctionsMapping = (command: string) => { |
| 12 | switch (command) { |
| 13 | case 'select': |
| 14 | return ['send', 'send_batch', 'read', 'pop', 'archive', 'delete'] |
| 15 | case 'insert': |
| 16 | return ['send', 'send_batch'] |
| 17 | case 'update': |
| 18 | return ['read', 'pop'] |
| 19 | case 'delete': |
| 20 | return ['archive', 'delete'] |
| 21 | default: |
| 22 | return [] |
| 23 | } |
| 24 | } |