Queue.utils.tsx 675 B

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