All files / web/src/constants/api endpoints.ts

100% Statements 56/56
100% Branches 17/17
89.47% Functions 17/19
100% Lines 56/56

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 721x   1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x   1x 1x 1x 1x   1x 1x 1x   1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x              
export const API_PREFIX = '/api' as const
 
export const API_ENDPOINTS = {
  HEALTH: '/health', 
  WORKFLOW: {
    LIST: `${API_PREFIX}/workflows`,
    CREATE: `${API_PREFIX}/workflows`,
    GET: (id: string) => `${API_PREFIX}/workflows/${id}` as const,
    UPDATE: (id: string) => `${API_PREFIX}/workflows/${id}` as const,
    DELETE: (id: string) => `${API_PREFIX}/workflows/${id}` as const,
  },
 
  EXECUTION: {
    INLINE_RUN: `${API_PREFIX}/workflows/execute`,
    SUBMIT: (id: string) => `${API_PREFIX}/workflows/${id}/executions` as const,
    STATUS: (id: string) => `${API_PREFIX}/executions/${id}` as const,
    HISTORY: (id: string) => `${API_PREFIX}/workflows/${id}/executions` as const,
  },
 
  TASK: {
    LIST: `${API_PREFIX}/tasks`,
    STATUS: (id: string) => `${API_PREFIX}/tasks/${id}` as const,
  },
 
  NODE: {
    EXECUTE: `${API_PREFIX}/nodes/execute`,
  },
 
  TRIGGER: {
    ACTIVATE: (id: string) => `${API_PREFIX}/workflows/${id}/activate` as const,
    DEACTIVATE: (id: string) => `${API_PREFIX}/workflows/${id}/deactivate` as const,
    STATUS: (id: string) => `${API_PREFIX}/workflows/${id}/trigger-status` as const,
    TEST: (id: string) => `${API_PREFIX}/workflows/${id}/test` as const,
    WEBHOOK: (id: string) => `${API_PREFIX}/triggers/webhook/${id}` as const,
  },
 
  AGENT: {
    LIST: `${API_PREFIX}/agents`,
    CREATE: `${API_PREFIX}/agents`,
    GET: (id: string) => `${API_PREFIX}/agents/${id}` as const,
    UPDATE: (id: string) => `${API_PREFIX}/agents/${id}` as const,
    DELETE: (id: string) => `${API_PREFIX}/agents/${id}` as const,
    EXECUTE: (id: string) => `${API_PREFIX}/agents/${id}/execute` as const,
    EXECUTE_INLINE: `${API_PREFIX}/agents/execute-inline`,
  },
 
  SECRET: {
    LIST: `${API_PREFIX}/secrets`,
    CREATE: `${API_PREFIX}/secrets`,
    UPDATE: (key: string) => `${API_PREFIX}/secrets/${key}` as const,
    DELETE: (key: string) => `${API_PREFIX}/secrets/${key}` as const,
  },
 
  PYTHON: {
    EXECUTE: `${API_PREFIX}/python/execute`,
    SCRIPTS: `${API_PREFIX}/python/scripts`,
    TEMPLATES: `${API_PREFIX}/python/templates`,
    TEMPLATE: (id: string) => `${API_PREFIX}/python/templates/${id}` as const,
  },
 
  CONFIG: {
    GET: `${API_PREFIX}/config`,
    UPDATE: `${API_PREFIX}/config`,
  },
} as const
 
export type ApiEndpoints = typeof API_ENDPOINTS
export type WorkflowEndpoints = typeof API_ENDPOINTS.WORKFLOW
export type ExecutionEndpoints = typeof API_ENDPOINTS.EXECUTION
export type TriggerEndpoints = typeof API_ENDPOINTS.TRIGGER
export type AgentEndpoints = typeof API_ENDPOINTS.AGENT
export type SecretEndpoints = typeof API_ENDPOINTS.SECRET