Breaking Changes
Job constructor reserved for dependency injection
The Job constructor no longer accepts payload and context parameters. These are now provided via the internal $hydrate() method called by the worker.
Before:
class SendEmailJob extends Job<SendEmailPayload> {
constructor(payload: SendEmailPayload, context: JobContext) {
super(payload, context)
}
}After:
class SendEmailJob extends Job<SendEmailPayload> {
// Constructor for DI only
constructor(private mailer: MailerService) {
super()
}
}
// Or simply omit the constructor if no DI needed
class SendEmailJob extends Job<SendEmailPayload> {
async execute() { ... }
}JobFactory signature simplified
The jobFactory now only receives JobClass. The worker handles payload/context via $hydrate().
Before: jobFactory: (JobClass, payload, context) => ...
After: jobFactory: (JobClass) => container.make(JobClass)
AbortSignal moved to this.signal
The signal parameter has been removed from execute(). Access it via this.signal instead.
Before: async execute(signal?: AbortSignal)
After: async execute() + use this.signal
static jobName replaced by options.name
Job name now defaults to the class name. The static jobName property is removed.
Before:
static readonly jobName = 'SendEmailJob'
static options = { queue: 'emails' }After:
static options = { queue: 'emails' }
// name defaults to class name, or override with: name: 'CustomName'Warning
If minifying code in production, always specify name explicitly.
Schedule jobName → name
ScheduleConfig.jobName and ScheduleData.jobName renamed to name. Database column renamed from job_name to name.
Warning
Existing databases require manual migration or table recreation.
New Features
this.signal- Access abort signal anywhere in the job instance for timeout handling$hydrate()method - Internal method for worker to provide runtime data (payload, context, signal)
Commits
- refactor!: rename jobName to name in Schedule types and database (00446c3)
- refactor!: replace static jobName with options.name (ef3e218)
- refactor!: separate dependency injection from job hydration (e1bc7b5)
- docs: improve JSDoc documentation for types with default values (c12654a)
Full Changelog: v0.1.0...v0.2.0