/** * BullMQ-like advanced operations */ import type { IFlashQClient, JobState, JobWithState } from '../types'; /** * Get jobs filtered by queue and/or state with pagination. * * @param client - FlashQ client instance * @param options - Filter options * @returns Jobs and total count * * @example * ```typescript * // Get all waiting jobs * const { jobs, total } = await client.getJobs({ state: 'waiting' }); * * // Paginate results * const { jobs } = await client.getJobs({ limit: 10, offset: 20 }); * ``` */ export declare function getJobs(client: IFlashQClient, options?: { queue?: string; state?: JobState; limit?: number; offset?: number; }): Promise<{ jobs: JobWithState[]; total: number; }>; /** * Get job counts by state for a queue. * * @param client - FlashQ client instance * @param queue - Queue name * @returns Counts by state * * @example * ```typescript * const counts = await client.getJobCounts('emails'); * console.log(`Waiting: ${counts.waiting}`); * console.log(`Active: ${counts.active}`); * ``` */ export declare function getJobCounts(client: IFlashQClient, queue: string): Promise<{ waiting: number; active: number; delayed: number; completed: number; failed: number; }>; /** * Get total count of jobs in a queue (waiting + delayed). * * @param client - FlashQ client instance * @param queue - Queue name * @returns Total job count * * @example * ```typescript * const total = await client.count('emails'); * console.log(`${total} jobs in queue`); * ``` */ export declare function count(client: IFlashQClient, queue: string): Promise; /** * Clean jobs older than grace period by state. * * @param client - FlashQ client instance * @param queue - Queue name * @param grace - Grace period in ms * @param state - Job state to clean * @param limit - Optional max jobs to clean * @returns Number of jobs cleaned * * @example * ```typescript * // Clean completed jobs older than 1 hour * const cleaned = await client.clean('emails', 3600000, 'completed'); * ``` */ export declare function clean(client: IFlashQClient, queue: string, grace: number, state: 'waiting' | 'delayed' | 'completed' | 'failed', limit?: number): Promise; /** * Drain all waiting jobs from a queue. * * @param client - FlashQ client instance * @param queue - Queue name * @returns Number of jobs drained * * @example * ```typescript * const drained = await client.drain('emails'); * console.log(`Drained ${drained} jobs`); * ``` */ export declare function drain(client: IFlashQClient, queue: string): Promise; /** * Remove ALL data for a queue (jobs, DLQ, cron, state). * Use with caution - this is destructive! * * @param client - FlashQ client instance * @param queue - Queue name * @returns Total items removed * * @example * ```typescript * const removed = await client.obliterate('test-queue'); * ``` */ export declare function obliterate(client: IFlashQClient, queue: string): Promise; /** * Change job priority. * * @param client - FlashQ client instance * @param jobId - Job ID * @param priority - New priority (higher = processed first) * * @example * ```typescript * await client.changePriority(jobId, 100); * ``` */ export declare function changePriority(client: IFlashQClient, jobId: number, priority: number): Promise; /** * Move job from processing back to delayed. * * @param client - FlashQ client instance * @param jobId - Job ID * @param delay - Delay in ms * * @example * ```typescript * // Delay for 5 minutes * await client.moveToDelayed(jobId, 300000); * ``` */ export declare function moveToDelayed(client: IFlashQClient, jobId: number, delay: number): Promise; /** * Promote delayed job to waiting immediately. * * @param client - FlashQ client instance * @param jobId - Job ID * * @example * ```typescript * await client.promote(jobId); * ``` */ export declare function promote(client: IFlashQClient, jobId: number): Promise; /** * Update job data. * * @param client - FlashQ client instance * @param jobId - Job ID * @param data - New data payload * * @example * ```typescript * await client.update(jobId, { email: 'new@example.com' }); * ``` */ export declare function update(client: IFlashQClient, jobId: number, data: T): Promise; /** * Discard job - move directly to DLQ. * * @param client - FlashQ client instance * @param jobId - Job ID * * @example * ```typescript * await client.discard(jobId); * ``` */ export declare function discard(client: IFlashQClient, jobId: number): Promise; //# sourceMappingURL=advanced.d.ts.map