/** * Task Validator - Validation logic for task operations * @requirement REQ-V2-003 - Task validation * * Provides validation for: * - State transitions * - State history integrity * - Queue and file consistency */ import { type WorkflowState } from '@shadel/workflow-core'; import type { Task as QueueTask } from './task-queue.js'; import type { TaskFileData } from './task-file-sync.js'; /** * Validation result */ export interface ValidationResult { valid: boolean; error?: string; source?: 'queue' | 'file'; } /** * Task Validator - Validation logic for task operations * * Responsibilities: * - Validate state transitions * - Validate state history integrity * - Validate queue and file consistency */ export declare class TaskValidator { /** * Valid state transitions map */ private readonly validTransitions; /** * Validate state transition * * @param currentState - Current workflow state * @param newState - New workflow state * @throws Error if transition is invalid */ validateStateTransition(currentState: WorkflowState, newState: WorkflowState): Promise; /** * Validate state history integrity * * Checks for: * - State regression (going backwards) * - State skipping (unless explicitly allowed) * - Invalid states in history * * @param task - Task from queue or file * @returns Validation result */ validateStateHistory(task: QueueTask | TaskFileData): Promise; /** * Validate both queue and file data * * Validates: * - Queue data integrity * - File data integrity * - Consistency between queue and file * * @param queueTask - Task from queue * @param fileData - Task from file * @returns Validation result */ validateBoth(queueTask: QueueTask, fileData: TaskFileData): Promise; /** * Get valid transitions from a state * * @param state - Current state * @returns Array of valid next states */ getValidTransitions(state: WorkflowState): WorkflowState[]; }