/** * Job management operations */ import type { IFlashQClient, JobState, JobWithState, JobLogEntry } from '../types'; /** * Get a job with its current state. * * @param client - FlashQ client instance * @param jobId - Job ID * @returns Job with state, or null if not found * * @example * ```typescript * const result = await client.getJob(123); * if (result) { * console.log(`Job ${result.job.id} is ${result.state}`); * } * ``` */ export declare function getJob(client: IFlashQClient, jobId: number): Promise; /** * Get job state only. * * @param client - FlashQ client instance * @param jobId - Job ID * @returns Job state or null if not found * * @example * ```typescript * const state = await client.getState(123); * console.log(`Job state: ${state}`); * ``` */ export declare function getState(client: IFlashQClient, jobId: number): Promise; /** * Get job result. * * @param client - FlashQ client instance * @param jobId - Job ID * @returns Job result or null * * @example * ```typescript * const result = await client.getResult<{ sent: boolean }>(123); * ``` */ export declare function getResult(client: IFlashQClient, jobId: number): Promise; /** * Wait for a job to complete and return its result. * Useful for synchronous workflows. * * @param client - FlashQ client instance * @param jobId - Job ID * @param timeout - Timeout in ms (default: 30000) * @returns Job result or null * @throws Error if job fails or times out * * @example * ```typescript * const job = await client.push('process', { data: 'value' }); * const result = await client.finished(job.id); * console.log('Result:', result); * ``` */ export declare function finished(client: IFlashQClient, jobId: number, timeout?: number): Promise; /** * Get a job by its custom ID. * Custom IDs are set using the `jobId` option when pushing. * * @param client - FlashQ client instance * @param customId - Custom job ID * @returns Job with state or null * * @example * ```typescript * // Push with custom ID * await client.push('process', { orderId: 123 }, { jobId: 'order-123' }); * * // Retrieve by custom ID * const result = await client.getJobByCustomId('order-123'); * ``` */ export declare function getJobByCustomId(client: IFlashQClient, customId: string): Promise; /** * Get multiple jobs by their IDs in a single call. * * @param client - FlashQ client instance * @param jobIds - Array of job IDs * @returns Array of jobs with states * * @example * ```typescript * const jobs = await client.getJobsBatch([1, 2, 3, 4, 5]); * ``` */ export declare function getJobsBatch(client: IFlashQClient, jobIds: number[]): Promise; /** * Cancel a pending job. * * @param client - FlashQ client instance * @param jobId - Job ID * * @example * ```typescript * await client.cancel(job.id); * ``` */ export declare function cancel(client: IFlashQClient, jobId: number): Promise; /** * Update job progress. * * @param client - FlashQ client instance * @param jobId - Job ID * @param progress - Progress value (0-100) * @param message - Optional progress message * * @example * ```typescript * await client.progress(job.id, 50, 'Halfway done'); * ``` */ export declare function progress(client: IFlashQClient, jobId: number, progressValue: number, message?: string): Promise; /** * Get job progress. * * @param client - FlashQ client instance * @param jobId - Job ID * @returns Progress value and message * * @example * ```typescript * const { progress, message } = await client.getProgress(job.id); * ``` */ export declare function getProgress(client: IFlashQClient, jobId: number): Promise<{ progress: number; message?: string; }>; /** * Add a log entry to a job. * * @param client - FlashQ client instance * @param jobId - Job ID * @param message - Log message * @param level - Log level (info, warn, error) * * @example * ```typescript * await client.log(job.id, 'Processing step 1', 'info'); * await client.log(job.id, 'Warning: low memory', 'warn'); * ``` */ export declare function log(client: IFlashQClient, jobId: number, message: string, level?: 'info' | 'warn' | 'error'): Promise; /** * Get log entries for a job. * * @param client - FlashQ client instance * @param jobId - Job ID * @returns Array of log entries * * @example * ```typescript * const logs = await client.getLogs(job.id); * ``` */ export declare function getLogs(client: IFlashQClient, jobId: number): Promise; /** Send a heartbeat to prevent job from being marked as stalled. */ export declare function heartbeat(client: IFlashQClient, jobId: number): Promise; /** * Send a partial result for streaming jobs. * Emits a "partial" event that can be subscribed via SSE/WebSocket. * * @param client - FlashQ client instance * @param jobId - Job ID (must be in processing) * @param data - Partial result data * @param index - Optional chunk index for ordering * * @example * ```typescript * // LLM token streaming * for await (const token of llm.generate(prompt)) { * await client.partial(job.id, { token }); * } * ``` */ export declare function partial(client: IFlashQClient, jobId: number, data: unknown, index?: number): Promise; //# sourceMappingURL=jobs.d.ts.map