import { RetryStrategy } from '@happyvertical/jobs'; import { JobHandle } from './job-handle.js'; import { SmrtJobCollection, TimeoutBehavior } from './smrt-job.js'; /** * Priority levels for jobs */ export type Priority = 'critical' | 'high' | 'normal' | 'low' | number; /** * Convert priority to numeric value */ export declare function priorityToNumber(priority: Priority): number; /** * Parse delay string to milliseconds */ export declare function parseDelay(delay: string | number): number; /** * Fluent builder for creating background jobs * * Example: * ```typescript * const handle = await doc.background('generateSummary', { format: 'md' }) * .delay('5m') * .retries(5) * .priority('high') * .queue('summaries') * .timeout(300000) * .enqueue(); * ``` */ export declare class JobBuilder { private readonly objectType; private readonly objectId; private readonly method; private readonly args; private readonly collection; private _queue; private _delay; private _retries; private _priority; private _timeout; private _timeoutBehavior; private _retryStrategy; private _tenantJobCap; constructor(objectType: string, objectId: string | null, method: string, args: Record, collection: SmrtJobCollection); /** * Set the queue name */ queue(name: string): this; /** * Set a delay before the job runs * @param delay - Delay as milliseconds or string like '5m', '1h', '30s' */ delay(delay: string | number): this; /** * Set when the job should run */ runAt(date: Date): this; /** * Set the maximum number of retry attempts. * * Clamped to {@link MAX_JOB_RETRIES} so a misconfigured caller cannot pin a * worker on a poison job indefinitely (S5 audit #1402). */ retries(count: number): this; /** * Set the retry strategy */ retryStrategy(strategy: RetryStrategy): this; /** * Set the job priority */ priority(level: Priority): this; /** * Set the job timeout in milliseconds */ timeout(ms: number): this; /** * Set what happens when the job times out */ timeoutBehavior(behavior: TimeoutBehavior): this; /** * Override the per-tenant in-flight job cap for this enqueue. * * Defaults to {@link DEFAULT_TENANT_JOB_CAP}. Pass `0` (or a negative value) * to disable the cap for trusted internal callers (S5 audit #1402). */ tenantJobCap(max: number): this; /** * Enqueue the job and return a handle */ enqueue(): Promise>; } export default JobBuilder; //# sourceMappingURL=job-builder.d.ts.map