All files / src/api types.ts

100% Statements 10/10
100% Branches 0/0
100% Functions 0/0
100% Lines 10/10

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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 961x 1x 1x 1x 1x 1x 1x 1x 1x       1x                                                                                                                                                                      
export const TASK_STATUSES = [
  "pending",
  "assigned",
  "running",
  "retrying",
  "succeeded",
  "failed",
  "cancelled",
] as const;
 
export type TaskStatus = (typeof TASK_STATUSES)[number];
 
export const ROBOT_STATUSES = ["idle", "busy", "offline"] as const;
 
export type RobotStatus = (typeof ROBOT_STATUSES)[number];
 
export interface Task {
  id: string;
  type: string;
  status: TaskStatus;
  priority: number;
  payload: Record<string, unknown>;
  external_id: string | null;
  robot_id: string | null;
  command_id: string | null;
  attempts: number;
  max_attempts: number;
  timeout_seconds: number;
  available_at: string;
  lease_expires_at: string | null;
  started_at: string | null;
  finished_at: string | null;
  last_error: string | null;
  result: Record<string, unknown> | null;
  created_at: string;
  updated_at: string;
  version: number;
}
 
export interface TaskList {
  items: Task[];
  limit: number;
  offset: number;
}
 
export interface TaskEvent {
  id: string;
  task_id: string;
  kind: string;
  from_status: string | null;
  to_status: string | null;
  robot_id: string | null;
  message: string | null;
  payload: Record<string, unknown>;
  created_at: string;
}
 
export interface Robot {
  id: string;
  name: string;
  namespace: string;
  status: RobotStatus;
  capabilities: string[];
  last_seen_at: string | null;
  current_task_id: string | null;
  created_at: string;
  updated_at: string;
}
 
export interface Stats {
  tasks: Record<string, number>;
  task_total: number;
  robots: Record<string, number>;
  queues: Record<string, number | null>;
}
 
export interface Health {
  status: string;
  checks: Record<string, string>;
}
 
export interface TaskFilters {
  statuses?: TaskStatus[];
  type?: string;
  robotId?: string;
  query?: string;
}
 
export interface CreateTaskInput {
  type: string;
  payload?: Record<string, unknown>;
  priority?: number;
  max_attempts?: number;
  timeout_seconds?: number;
}