import { AllowedJobTypes, DispatchableJobType, JobHandlerConstructor, PgBossConfig } from "./types.js"; import PgBoss from "pg-boss"; import { ApplicationService, LoggerService } from "@adonisjs/core/types"; //#region src/job_manager.d.ts declare class JobManager { protected _app: ApplicationService; protected _logger: LoggerService; protected _config: PgBossConfig; protected _pgBoss: PgBoss | null; protected _jobRegistry: Map; protected _workers: Map; constructor(config: PgBossConfig, logger: LoggerService, app: ApplicationService); /** * Ensure PgBoss is started */ protected ensureStarted(): Promise; /** * Resolve a job class from either a class or lazy import */ protected resolveJob(job: AllowedJobTypes): Promise; /** * Get the filepath from internal registry (no $$filepath needed!) */ protected getJobPath(job: JobHandlerConstructor): string; /** * Register a job with its filepath and optionally create a worker */ registerJob(jobPath: string, JobClass: JobHandlerConstructor, options?: PgBoss.WorkOptions): Promise; /** * Register a worker for a specific job path */ registerWorker(jobPath: string, JobClass: JobHandlerConstructor, options: PgBoss.WorkOptions): Promise; /** * Instantiate a job class with dependency injection */ protected instantiateJob(job: { name: string; data: unknown; }): Promise>; /** * Dispatch a job with type-safe payload (Dispatchable only) */ dispatch(job: T, payload: object, options?: PgBoss.SendOptions): Promise; /** * Schedule a cron job */ schedule(job: T, schedule: string, payload?: object, options?: PgBoss.ScheduleOptions): Promise; /** * Schedule a cron job using direct job path (for auto-discovery) */ scheduleByPath(jobPath: string, schedule: string, queueName: string, payload?: object, options?: PgBoss.ScheduleOptions): Promise; /** * Start processing jobs from a specific queue (matches Romain's pattern) */ process({ queueName }: { queueName?: string; }): Promise; /** * Get the raw PgBoss instance for advanced usage */ get raw(): PgBoss; /** * Get the raw PgBoss instance (alias for raw getter) */ get instance(): PgBoss; /** * Get the raw PgBoss instance (async version ensures it's started) */ getRaw(): Promise; /** * Start the job manager */ start(): Promise; /** * Stop the job manager */ stop(): Promise; /** * Close all connections (alias for stop) */ closeAll(): Promise; } //#endregion export { JobManager };