/** * Types for background job UI components */ import type { Snippet } from 'svelte'; export type JobStatus = 'pending' | 'ready' | 'running' | 'completed' | 'failed' | 'cancelled'; export type JobPriority = 'low' | 'normal' | 'high' | 'critical'; export type TimeoutBehavior = 'fail' | 'kill' | 'warn'; /** * Job data structure for display */ export interface JobData { id: string; queue: string; objectType: string; objectId: string | null; method: string; args: Record; status: JobStatus; priority: number; attempts: number; maxAttempts: number; timeout: number; timeoutBehavior: TimeoutBehavior; runAt: Date | string; startedAt: Date | string | null; completedAt: Date | string | null; lastError: string | null; resultPointer: string | null; workerId: string | null; createdAt: Date | string; updatedAt: Date | string; } /** * Job statistics for dashboard */ export interface JobStats { total: number; pending: number; ready: number; running: number; completed: number; failed: number; cancelled: number; avgDuration: number | null; successRate: number | null; } /** * Queue statistics */ export interface QueueStats { name: string; pending: number; running: number; completed24h: number; failed24h: number; avgDuration: number | null; } /** * Filter options for job list */ export interface JobFilter { status?: JobStatus | JobStatus[] | 'all'; queue?: string; objectType?: string; search?: string; limit?: number; offset?: number; } /** * Sort options for job list */ export interface JobSort { field: 'createdAt' | 'runAt' | 'priority' | 'status'; direction: 'asc' | 'desc'; } /** * JobList component props */ export interface JobListProps { /** Jobs to display */ jobs: JobData[]; /** Loading state */ loading?: boolean; /** Filter state */ filter?: JobFilter; /** Sort state */ sort?: JobSort; /** Selectable rows */ selectable?: boolean; /** Selected job IDs */ selected?: Set; /** Callback when selection changes */ onSelectionChange?: (selected: Set) => void; /** Callback when job is clicked */ onJobClick?: (job: JobData) => void; /** Callback when retry is clicked */ onRetry?: (job: JobData) => void; /** Callback when cancel is clicked */ onCancel?: (job: JobData) => void; /** Empty state snippet */ empty?: Snippet; } /** * JobDetail component props */ export interface JobDetailProps { /** Job to display */ job: JobData; /** Show result data */ showResult?: boolean; /** Callback when retry is clicked */ onRetry?: (job: JobData) => void; /** Callback when cancel is clicked */ onCancel?: (job: JobData) => void; /** Callback when delete is clicked */ onDelete?: (job: JobData) => void; } /** * JobStats component props */ export interface JobStatsProps { /** Statistics data */ stats: JobStats; /** Queue breakdown */ queues?: QueueStats[]; /** Loading state */ loading?: boolean; /** Auto-refresh interval (ms, 0 = disabled) */ refreshInterval?: number; } /** * JobActions component props */ export interface JobActionsProps { /** Job to perform actions on */ job: JobData; /** Show retry button */ showRetry?: boolean; /** Show cancel button */ showCancel?: boolean; /** Show delete button */ showDelete?: boolean; /** Callback when retry is clicked */ onRetry?: (job: JobData) => void; /** Callback when cancel is clicked */ onCancel?: (job: JobData) => void; /** Callback when delete is clicked */ onDelete?: (job: JobData) => void; /** Compact mode */ compact?: boolean; } /** * JobDashboard component props */ export interface JobDashboardProps { /** Statistics data */ stats: JobStats; /** Queue breakdown */ queues?: QueueStats[]; /** Recent jobs */ recentJobs?: JobData[]; /** Failed jobs */ failedJobs?: JobData[]; /** Loading state */ loading?: boolean; /** Callback when job is clicked */ onJobClick?: (job: JobData) => void; /** Callback when retry is clicked */ onRetry?: (job: JobData) => void; } /** * Helper function to get status variant for Badge */ export declare function getStatusVariant(status: JobStatus): 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info'; /** * Helper function to format duration */ export declare function formatDuration(ms: number | null): string; /** * Helper function to format relative time */ export declare function formatRelativeTime(date: Date | string | null): string; /** * Helper function to get priority label */ export declare function getPriorityLabel(priority: number): string; /** * Helper function to get priority color class */ export declare function getPriorityClass(priority: number): string; //# sourceMappingURL=types.d.ts.map