@boringnode/queue 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +103 -20
  2. package/build/chunk-6IO4P6RB.js +145 -0
  3. package/build/chunk-6IO4P6RB.js.map +1 -0
  4. package/build/{chunk-VHN3XZDC.js → chunk-AHUVTAI7.js} +278 -29
  5. package/build/chunk-AHUVTAI7.js.map +1 -0
  6. package/build/chunk-S37X3CBO.js +500 -0
  7. package/build/chunk-S37X3CBO.js.map +1 -0
  8. package/build/index.d.ts +34 -8
  9. package/build/index.js +187 -31
  10. package/build/index.js.map +1 -1
  11. package/build/{job-DImdhRFO.d.ts → job-C4oyCVxR.d.ts} +275 -15
  12. package/build/src/contracts/adapter.d.ts +1 -1
  13. package/build/src/drivers/fake_adapter.d.ts +12 -6
  14. package/build/src/drivers/fake_adapter.js +1 -1
  15. package/build/src/drivers/knex_adapter.d.ts +6 -5
  16. package/build/src/drivers/knex_adapter.js +112 -0
  17. package/build/src/drivers/knex_adapter.js.map +1 -1
  18. package/build/src/drivers/redis_adapter.d.ts +6 -5
  19. package/build/src/drivers/redis_adapter.js +166 -402
  20. package/build/src/drivers/redis_adapter.js.map +1 -1
  21. package/build/src/drivers/redis_job_storage.d.ts +17 -0
  22. package/build/src/drivers/redis_job_storage.js +14 -0
  23. package/build/src/drivers/redis_job_storage.js.map +1 -0
  24. package/build/src/drivers/redis_scripts.d.ts +87 -0
  25. package/build/src/drivers/redis_scripts.js +29 -0
  26. package/build/src/drivers/redis_scripts.js.map +1 -0
  27. package/build/src/drivers/sync_adapter.d.ts +2 -1
  28. package/build/src/drivers/sync_adapter.js +7 -1
  29. package/build/src/drivers/sync_adapter.js.map +1 -1
  30. package/build/src/otel.d.ts +2 -2
  31. package/build/src/otel.js +3 -0
  32. package/build/src/otel.js.map +1 -1
  33. package/build/src/types/index.d.ts +1 -1
  34. package/build/src/types/main.d.ts +1 -1
  35. package/build/src/types/tracing_channels.d.ts +7 -1
  36. package/package.json +18 -19
  37. package/build/chunk-VHN3XZDC.js.map +0 -1
@@ -206,7 +206,13 @@ type Duration = number | string;
206
206
  * - `{ age?, count? }`: Keep with pruning by age and/or count
207
207
  */
208
208
  type JobRetention = boolean | {
209
+ /**
210
+ * Keep jobs newer than this duration.
211
+ */
209
212
  age?: Duration;
213
+ /**
214
+ * Keep at most this many jobs.
215
+ */
210
216
  count?: number;
211
217
  };
212
218
  /**
@@ -222,9 +228,19 @@ type JobStatus = 'pending' | 'active' | 'delayed' | 'completed' | 'failed';
222
228
  * console.log(`Dispatched job: ${jobId}`)
223
229
  * ```
224
230
  */
231
+ /**
232
+ * Outcome of a dedup-enabled dispatch.
233
+ * - `added`: new job was inserted
234
+ * - `skipped`: duplicate found within TTL, skipped silently
235
+ * - `replaced`: duplicate found within TTL, existing job's payload was replaced
236
+ * - `extended`: duplicate found within TTL, TTL window was reset
237
+ */
238
+ type DedupOutcome = 'added' | 'skipped' | 'replaced' | 'extended';
225
239
  interface DispatchResult {
226
240
  /** Unique identifier for this specific job instance */
227
241
  jobId: string;
242
+ /** Dedup outcome (only present when `.dedup()` was used). */
243
+ deduped?: DedupOutcome;
228
244
  }
229
245
  /**
230
246
  * Result returned when dispatching multiple jobs at once.
@@ -265,7 +281,7 @@ interface JobData {
265
281
  /**
266
282
  * Job priority (lower = higher priority).
267
283
  *
268
- * @default 0
284
+ * @default 5
269
285
  */
270
286
  priority?: number;
271
287
  /**
@@ -291,11 +307,50 @@ interface JobData {
291
307
  * ```
292
308
  */
293
309
  groupId?: string;
310
+ /**
311
+ * Timestamp (ms) when the job was dispatched.
312
+ * Used to compute queue wait time in OTel instrumentation.
313
+ */
314
+ createdAt?: number;
294
315
  /**
295
316
  * Serialized trace context for distributed tracing.
296
317
  * Injected by OTel plugin at dispatch time.
297
318
  */
298
319
  traceContext?: Record<string, string>;
320
+ /**
321
+ * Deduplication configuration for this job.
322
+ * When set, adapters apply dedup semantics keyed on `dedup.id`.
323
+ * Set automatically when `.dedup()` is called on the dispatcher.
324
+ */
325
+ dedup?: {
326
+ /**
327
+ * Dedup key, prefixed with the job name (e.g. `SendInvoiceJob::order-123`).
328
+ * The combined `<jobName>::<id>` length is capped at 510 characters by the
329
+ * Knex storage column. Dispatcher validates this at `.dedup()` time.
330
+ */
331
+ id: string;
332
+ /**
333
+ * TTL in milliseconds (must be positive). When set, dedup lock auto-expires
334
+ * after TTL. After expiry, the same dedup id produces a brand-new job
335
+ * (coexists with prior). Omit `ttl` entirely for a no-expiry lock that
336
+ * persists until the job is removed.
337
+ */
338
+ ttl?: number;
339
+ /**
340
+ * Reset the TTL clock when a duplicate arrives within the window.
341
+ * The window length stays at the original ttl — passing a different
342
+ * `ttl` on the duplicating dispatch does not resize the window.
343
+ */
344
+ extend?: boolean;
345
+ /**
346
+ * Swap the payload of the existing pending or delayed job when a
347
+ * duplicate arrives within the TTL window. Active jobs and retained
348
+ * completed/failed jobs return `'skipped'` without mutation. Only
349
+ * `payload` is swapped — priority, queue, delay, and groupId of the
350
+ * existing job are preserved.
351
+ */
352
+ replace?: boolean;
353
+ };
299
354
  }
300
355
  /**
301
356
  * Record of a job's current state, including history for completed/failed jobs.
@@ -345,22 +400,28 @@ interface JobOptions {
345
400
  queue?: string;
346
401
  /**
347
402
  * Adapter name or factory to use for this job.
403
+ *
404
+ * Defaults to the queue manager's configured default adapter.
348
405
  */
349
406
  adapter?: string | (() => Adapter);
350
407
  /**
351
408
  * Maximum retry attempts before permanent failure.
352
409
  *
353
- * @default 3
410
+ * This is a convenience alias for `retry.maxRetries`.
411
+ *
412
+ * @default 0
354
413
  */
355
414
  maxRetries?: number;
356
415
  /**
357
416
  * Job priority (lower = higher priority).
358
417
  *
359
- * @default 0
418
+ * @default 5
360
419
  */
361
420
  priority?: number;
362
421
  /**
363
- * Retry configuration (backoff strategy, delays, etc.).
422
+ * Retry configuration for this job.
423
+ *
424
+ * Overrides queue-level and global retry settings.
364
425
  */
365
426
  retry?: RetryConfig;
366
427
  /**
@@ -372,10 +433,22 @@ interface JobOptions {
372
433
  /**
373
434
  * Whether to mark job as failed on timeout.
374
435
  *
375
- * @default true
436
+ * When disabled, timed out jobs follow the normal retry policy.
437
+ *
438
+ * @default false
376
439
  */
377
440
  failOnTimeout?: boolean;
441
+ /**
442
+ * Retention policy for completed jobs.
443
+ *
444
+ * By default, completed jobs are removed immediately.
445
+ */
378
446
  removeOnComplete?: JobRetention;
447
+ /**
448
+ * Retention policy for failed jobs.
449
+ *
450
+ * By default, failed jobs are removed immediately after the failure hooks run.
451
+ */
379
452
  removeOnFail?: JobRetention;
380
453
  }
381
454
  /**
@@ -443,23 +516,77 @@ type JobClass<T extends Job = Job> = (new (...args: unknown[]) => T) & {
443
516
  * ```
444
517
  */
445
518
  type JobFactory = (JobClass: JobClass) => Job | Promise<Job>;
519
+ /**
520
+ * Retry policy used by jobs, queues, or the queue manager.
521
+ */
446
522
  interface RetryConfig {
523
+ /**
524
+ * Number of retry attempts after the first failed execution.
525
+ *
526
+ * Set to `0` to disable retries.
527
+ *
528
+ * @default 0
529
+ */
447
530
  maxRetries?: number;
531
+ /**
532
+ * Factory that creates the backoff strategy used between retry attempts.
533
+ *
534
+ * If omitted, failed jobs are retried as soon as the adapter makes them
535
+ * available again.
536
+ */
448
537
  backoff?: () => BackoffStrategy$1;
449
538
  }
539
+ /**
540
+ * Built-in retry delay algorithms.
541
+ */
450
542
  type BackoffStrategy = 'exponential' | 'linear' | 'fixed';
543
+ /**
544
+ * Configuration for built-in and custom retry backoff strategies.
545
+ */
451
546
  interface BackoffConfig {
547
+ /**
548
+ * Strategy used to compute the delay before the next retry.
549
+ */
452
550
  strategy: BackoffStrategy;
551
+ /**
552
+ * Initial delay used by the strategy.
553
+ */
453
554
  baseDelay: Duration;
555
+ /**
556
+ * Upper bound for computed retry delays.
557
+ */
454
558
  maxDelay?: Duration;
559
+ /**
560
+ * Growth factor for exponential backoff.
561
+ */
455
562
  multiplier?: number;
563
+ /**
564
+ * Whether to randomize retry delays to avoid retry bursts.
565
+ */
456
566
  jitter?: boolean;
457
567
  }
568
+ /**
569
+ * Runtime configuration for a named queue.
570
+ */
458
571
  interface QueueConfig {
572
+ /**
573
+ * Adapter name used by jobs dispatched to this queue.
574
+ *
575
+ * Falls back to the queue manager's default adapter.
576
+ */
459
577
  adapter?: string;
578
+ /**
579
+ * Retry policy applied to jobs in this queue unless overridden by job options.
580
+ */
460
581
  retry?: RetryConfig;
582
+ /**
583
+ * Default job options applied to jobs in this queue unless overridden by the job.
584
+ */
461
585
  defaultJobOptions?: JobOptions;
462
586
  }
587
+ /**
588
+ * Runtime options for workers that poll queues and execute jobs.
589
+ */
463
590
  interface WorkerConfig {
464
591
  /**
465
592
  * Maximum number of jobs to process concurrently.
@@ -508,22 +635,32 @@ interface WorkerConfig {
508
635
  */
509
636
  onShutdownSignal?: () => void | Promise<void>;
510
637
  }
638
+ /**
639
+ * Event yielded by the low-level worker processing generator.
640
+ */
511
641
  type WorkerCycle = {
642
+ /** A job was acquired and execution started. */
512
643
  type: 'started';
513
644
  queue: string;
514
645
  job: JobData;
515
646
  } | {
647
+ /** A running job finished, either successfully or after failure handling. */
516
648
  type: 'completed';
517
649
  queue: string;
518
650
  job: JobData;
519
651
  } | {
652
+ /** No work was available. Consumers should wait before polling again. */
520
653
  type: 'idle';
521
654
  suggestedDelay: Duration;
522
655
  } | {
656
+ /** An unexpected worker loop error occurred. */
523
657
  type: 'error';
524
658
  error: Error;
525
659
  suggestedDelay: Duration;
526
660
  };
661
+ /**
662
+ * Factory used to lazily create adapter instances.
663
+ */
527
664
  type AdapterFactory<T extends Adapter = Adapter> = () => T;
528
665
  /**
529
666
  * Status of a schedule.
@@ -602,13 +739,59 @@ interface ScheduleListOptions {
602
739
  status?: ScheduleStatus;
603
740
  }
604
741
  interface QueueManagerConfig {
742
+ /**
743
+ * Name of the adapter used when a job does not select one explicitly.
744
+ *
745
+ * Must match one of the keys from `adapters`.
746
+ */
605
747
  default: string;
748
+ /**
749
+ * Available queue adapters keyed by name.
750
+ *
751
+ * Adapters are lazy-instantiated the first time they are used.
752
+ */
606
753
  adapters: Record<string, AdapterFactory>;
754
+ /**
755
+ * Global retry configuration applied to all jobs unless overridden by
756
+ * queue-level or job-level options.
757
+ */
607
758
  retry?: RetryConfig;
759
+ /**
760
+ * Global job options applied to all jobs unless overridden by queue-level
761
+ * or job-level options.
762
+ */
608
763
  defaultJobOptions?: JobOptions;
764
+ /**
765
+ * Per-queue configuration keyed by queue name.
766
+ *
767
+ * Use this to select adapters or defaults for specific queues.
768
+ */
609
769
  queues?: Record<string, QueueConfig>;
770
+ /**
771
+ * Worker runtime options used by `Worker` instances.
772
+ */
610
773
  worker?: WorkerConfig;
774
+ /**
775
+ * Glob patterns used to discover and register job classes.
776
+ *
777
+ * These locations are used by `init()` when `autoLoadJobs` is enabled,
778
+ * and by `QueueManager.loadJobs()` when called without arguments.
779
+ */
611
780
  locations?: string[];
781
+ /**
782
+ * Whether `init()` should immediately register jobs from configured locations.
783
+ *
784
+ * Framework integrations may disable this to defer job loading until a
785
+ * command lifecycle is ready, then call `QueueManager.loadJobs()`.
786
+ *
787
+ * @default true
788
+ */
789
+ autoLoadJobs?: boolean;
790
+ /**
791
+ * Logger used by the queue runtime.
792
+ *
793
+ * Defaults to the console logger.
794
+ */
612
795
  logger?: Logger;
613
796
  /**
614
797
  * Custom factory function for job instantiation.
@@ -642,6 +825,16 @@ interface QueueManagerConfig {
642
825
  executionWrapper?: <T>(fn: () => Promise<T>, job: AcquiredJob, queue: string) => Promise<T>;
643
826
  }
644
827
 
828
+ /**
829
+ * Result of a push operation when dedup was involved.
830
+ * `outcome` tells the dispatcher what happened; `jobId` is the ID of the
831
+ * existing job when deduped (skipped/replaced/extended).
832
+ */
833
+ interface PushResult {
834
+ outcome: DedupOutcome;
835
+ /** ID of the existing job when a duplicate was detected, otherwise the newly added job's id. */
836
+ jobId: string;
837
+ }
645
838
  /**
646
839
  * A job that has been acquired by a worker for processing.
647
840
  * Extends JobData with the timestamp when the job was acquired.
@@ -704,6 +897,23 @@ interface Adapter {
704
897
  * @returns Number of jobs that were recovered (not including permanently failed ones)
705
898
  */
706
899
  recoverStalledJobs(queue: string, stalledThreshold: number, maxStalledCount: number): Promise<number>;
900
+ /**
901
+ * Renew the acquired timestamp of in-flight jobs (heartbeat).
902
+ *
903
+ * A worker calls this periodically for the jobs it is actively processing
904
+ * so that long-running handlers are not mistaken for stalled jobs and
905
+ * re-delivered while they are still running. Only jobs that are still active
906
+ * AND still owned by the calling worker (the one set via setWorkerId) are
907
+ * renewed; jobs that have already been recovered/completed, or have since
908
+ * been re-acquired by another worker, are skipped. This prevents a slow
909
+ * worker from resurrecting a job or sabotaging the recovery of the worker
910
+ * that legitimately owns it now with a late heartbeat.
911
+ *
912
+ * @param queue - The queue the jobs belong to
913
+ * @param jobIds - The ids of the jobs currently being processed
914
+ * @returns Number of jobs whose timestamp was renewed
915
+ */
916
+ renewJobs(queue: string, jobIds: string[]): Promise<number>;
707
917
  /**
708
918
  * Mark a job as completed and remove it from the queue.
709
919
  *
@@ -741,30 +951,34 @@ interface Adapter {
741
951
  * Push a job to the default queue for immediate processing.
742
952
  *
743
953
  * @param jobData - The job data to push
954
+ * @returns PushResult if jobData.dedup is set, otherwise void
744
955
  */
745
- push(jobData: JobData): Promise<void>;
956
+ push(jobData: JobData): Promise<PushResult | void>;
746
957
  /**
747
958
  * Push a job to a specific queue for immediate processing.
748
959
  *
749
960
  * @param queue - The queue name to push to
750
961
  * @param jobData - The job data to push
962
+ * @returns PushResult if jobData.dedup is set, otherwise void
751
963
  */
752
- pushOn(queue: string, jobData: JobData): Promise<void>;
964
+ pushOn(queue: string, jobData: JobData): Promise<PushResult | void>;
753
965
  /**
754
966
  * Push a job to the default queue with a delay.
755
967
  *
756
968
  * @param jobData - The job data to push
757
969
  * @param delay - Delay in milliseconds before the job becomes available
970
+ * @returns PushResult if jobData.dedup is set, otherwise void
758
971
  */
759
- pushLater(jobData: JobData, delay: number): Promise<void>;
972
+ pushLater(jobData: JobData, delay: number): Promise<PushResult | void>;
760
973
  /**
761
974
  * Push a job to a specific queue with a delay.
762
975
  *
763
976
  * @param queue - The queue name to push to
764
977
  * @param jobData - The job data to push
765
978
  * @param delay - Delay in milliseconds before the job becomes available
979
+ * @returns PushResult if jobData.dedup is set, otherwise void
766
980
  */
767
- pushLaterOn(queue: string, jobData: JobData, delay: number): Promise<void>;
981
+ pushLaterOn(queue: string, jobData: JobData, delay: number): Promise<PushResult | void>;
768
982
  /**
769
983
  * Push multiple jobs to the default queue for immediate processing.
770
984
  *
@@ -871,11 +1085,12 @@ interface Adapter {
871
1085
  *
872
1086
  * ```
873
1087
  * Job.dispatch(payload)
874
- * .toQueue('emails') // optional: target queue
875
- * .priority(1) // optional: 1-10, lower = higher priority
876
- * .in('5m') // optional: delay before processing
877
- * .with('redis') // optional: specific adapter
878
- * .run() // dispatch the job
1088
+ * .toQueue('emails') // optional: target queue
1089
+ * .priority(1) // optional: 1-10, lower = higher priority
1090
+ * .in('5m') // optional: delay before processing
1091
+ * .dedup({ id: 'order-123' }) // optional: deduplication
1092
+ * .with('redis') // optional: specific adapter
1093
+ * .run() // dispatch the job
879
1094
  * ```
880
1095
  *
881
1096
  * @typeParam T - The payload type for this job
@@ -973,6 +1188,51 @@ declare class JobDispatcher<T> {
973
1188
  * ```
974
1189
  */
975
1190
  group(groupId: string): this;
1191
+ /**
1192
+ * Configure deduplication for this job.
1193
+ *
1194
+ * Modes:
1195
+ * - **Simple** (`{ id }`): skip duplicates while the job exists.
1196
+ * - **Throttle** (`{ id, ttl }`): skip duplicates within a TTL window.
1197
+ * - **Extend** (`{ id, ttl, extend: true }`): reset the TTL clock on each duplicate.
1198
+ * The window length stays at the original ttl from the first dispatch.
1199
+ * - **Replace** (`{ id, ttl, replace: true }`): swap the payload of the existing
1200
+ * pending/delayed job on duplicate within TTL. Active jobs and retained
1201
+ * completed/failed jobs return `'skipped'`. Only `payload` changes —
1202
+ * priority/queue/delay/groupId are preserved.
1203
+ * - **Debounce** (`{ id, ttl, replace: true, extend: true }`): replace + reset TTL.
1204
+ *
1205
+ * The id is automatically prefixed with the job name to prevent collisions
1206
+ * between different job types.
1207
+ *
1208
+ * @param options.id - Unique deduplication key
1209
+ * @param options.ttl - TTL as Duration ('5s', 5000). Required for extend/replace.
1210
+ * @param options.extend - Reset the TTL clock on duplicate within window. Window
1211
+ * length stays at the original ttl; this option's `ttl` arg is ignored on extend.
1212
+ * @param options.replace - Swap payload of existing pending/delayed job within
1213
+ * window. Active and retained jobs are not modified.
1214
+ *
1215
+ * @example
1216
+ * ```typescript
1217
+ * // Simple dedup
1218
+ * await SendInvoiceJob.dispatch({ orderId: 123 })
1219
+ * .dedup({ id: 'order-123' })
1220
+ *
1221
+ * // Throttle: 5 second window
1222
+ * await SendEmailJob.dispatch({ to: 'x' })
1223
+ * .dedup({ id: 'welcome', ttl: '5s' })
1224
+ *
1225
+ * // Debounce: replace payload within window
1226
+ * await SaveDraftJob.dispatch({ content: 'latest' })
1227
+ * .dedup({ id: 'draft-42', ttl: '2s', replace: true, extend: true })
1228
+ * ```
1229
+ */
1230
+ dedup(options: {
1231
+ id: string;
1232
+ ttl?: Duration;
1233
+ extend?: boolean;
1234
+ replace?: boolean;
1235
+ }): this;
976
1236
  /**
977
1237
  * Use a specific adapter for this job.
978
1238
  *
@@ -1451,4 +1711,4 @@ declare abstract class Job<Payload = any> {
1451
1711
  failed?(error: Error): Promise<void>;
1452
1712
  }
1453
1713
 
1454
- export { type Adapter as A, type BackoffConfig as B, type Duration as D, type JobData as J, type Logger as L, type QueueManagerConfig as Q, type RetryConfig as R, type ScheduleConfig as S, type WorkerCycle as W, type JobClass as a, type AcquiredJob as b, type JobRetention as c, type JobRecord as d, type ScheduleData as e, type ScheduleListOptions as f, type JobOptions as g, type QueueConfig as h, type JobFactory as i, Job as j, type ScheduleStatus as k, ScheduleBuilder as l, JobBatchDispatcher as m, customBackoff as n, linearBackoff as o, exponentialBackoff as p, fixedBackoff as q, type AdapterFactory as r, type BackoffStrategy as s, type DispatchManyResult as t, type DispatchResult as u, type JobContext as v, type JobStatus as w, type ScheduleResult as x, type WorkerConfig as y };
1714
+ export { type Adapter as A, type BackoffConfig as B, type DedupOutcome as D, type JobData as J, type Logger as L, type PushResult as P, type QueueManagerConfig as Q, type RetryConfig as R, type ScheduleConfig as S, type WorkerCycle as W, type JobClass as a, type AcquiredJob as b, type JobRetention as c, type JobRecord as d, type ScheduleData as e, type ScheduleListOptions as f, type JobOptions as g, type QueueConfig as h, type Duration as i, type JobFactory as j, Job as k, type ScheduleStatus as l, JobBatchDispatcher as m, ScheduleBuilder as n, customBackoff as o, exponentialBackoff as p, fixedBackoff as q, linearBackoff as r, type AdapterFactory as s, type BackoffStrategy as t, type DispatchManyResult as u, type DispatchResult as v, type JobContext as w, type JobStatus as x, type ScheduleResult as y, type WorkerConfig as z };
@@ -1 +1 @@
1
- export { b as AcquiredJob, A as Adapter } from '../../job-DImdhRFO.js';
1
+ export { b as AcquiredJob, A as Adapter, P as PushResult } from '../../job-C4oyCVxR.js';
@@ -1,4 +1,4 @@
1
- import { A as Adapter, J as JobData, a as JobClass, b as AcquiredJob, c as JobRetention, d as JobRecord, S as ScheduleConfig, e as ScheduleData, f as ScheduleListOptions } from '../../job-DImdhRFO.js';
1
+ import { A as Adapter, J as JobData, a as JobClass, P as PushResult, b as AcquiredJob, c as JobRetention, d as JobRecord, S as ScheduleConfig, e as ScheduleData, f as ScheduleListOptions } from '../../job-C4oyCVxR.js';
2
2
 
3
3
  interface FakeJobRecord {
4
4
  queue: string;
@@ -23,7 +23,12 @@ declare function fake(): () => FakeAdapter;
23
23
  */
24
24
  declare class FakeAdapter implements Adapter {
25
25
  #private;
26
- setWorkerId(_workerId: string): void;
26
+ /**
27
+ * Set the function to call when the fake is disposed
28
+ */
29
+ onDispose(fn: () => void): this;
30
+ [Symbol.dispose](): void;
31
+ setWorkerId(workerId: string): void;
27
32
  getPushedJobs(): FakeJobRecord[];
28
33
  getPushedJobsOn(queue: string): FakeJobRecord[];
29
34
  findPushed(matcher: FakeJobMatcher, query?: FakeJobQuery): FakeJobRecord | undefined;
@@ -37,10 +42,10 @@ declare class FakeAdapter implements Adapter {
37
42
  assertNothingPushed(): void;
38
43
  size(): Promise<number>;
39
44
  sizeOf(queue: string): Promise<number>;
40
- push(jobData: JobData): Promise<void>;
41
- pushOn(queue: string, jobData: JobData): Promise<void>;
42
- pushLater(jobData: JobData, delay: number): Promise<void>;
43
- pushLaterOn(queue: string, jobData: JobData, delay: number): Promise<void>;
45
+ push(jobData: JobData): Promise<PushResult | void>;
46
+ pushOn(queue: string, jobData: JobData): Promise<PushResult | void>;
47
+ pushLater(jobData: JobData, delay: number): Promise<PushResult | void>;
48
+ pushLaterOn(queue: string, jobData: JobData, delay: number): Promise<PushResult | void>;
44
49
  pushMany(jobs: JobData[]): Promise<void>;
45
50
  pushManyOn(queue: string, jobs: JobData[]): Promise<void>;
46
51
  pop(): Promise<AcquiredJob | null>;
@@ -49,6 +54,7 @@ declare class FakeAdapter implements Adapter {
49
54
  failJob(jobId: string, queue: string, error?: Error, removeOnFail?: JobRetention): Promise<void>;
50
55
  retryJob(jobId: string, queue: string, retryAt?: Date): Promise<void>;
51
56
  recoverStalledJobs(queue: string, stalledThreshold: number, maxStalledCount: number): Promise<number>;
57
+ renewJobs(queue: string, jobIds: string[]): Promise<number>;
52
58
  getJob(jobId: string, queue: string): Promise<JobRecord | null>;
53
59
  destroy(): Promise<void>;
54
60
  upsertSchedule(config: ScheduleConfig): Promise<string>;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FakeAdapter,
3
3
  fake
4
- } from "../../chunk-VHN3XZDC.js";
4
+ } from "../../chunk-AHUVTAI7.js";
5
5
  import "../../chunk-WVLSICD4.js";
6
6
  import "../../chunk-QEFYHCL7.js";
7
7
  import "../../chunk-PZ5AY32C.js";
@@ -1,5 +1,5 @@
1
1
  import { Knex } from 'knex';
2
- import { A as Adapter, b as AcquiredJob, c as JobRetention, d as JobRecord, J as JobData, S as ScheduleConfig, e as ScheduleData, f as ScheduleListOptions } from '../../job-DImdhRFO.js';
2
+ import { A as Adapter, b as AcquiredJob, c as JobRetention, d as JobRecord, J as JobData, P as PushResult, S as ScheduleConfig, e as ScheduleData, f as ScheduleListOptions } from '../../job-C4oyCVxR.js';
3
3
 
4
4
  interface KnexAdapterOptions {
5
5
  connection: Knex;
@@ -34,15 +34,16 @@ declare class KnexAdapter implements Adapter {
34
34
  failJob(jobId: string, queue: string, error?: Error, removeOnFail?: JobRetention): Promise<void>;
35
35
  getJob(jobId: string, queue: string): Promise<JobRecord | null>;
36
36
  retryJob(jobId: string, queue: string, retryAt?: Date): Promise<void>;
37
- push(jobData: JobData): Promise<void>;
38
- pushOn(queue: string, jobData: JobData): Promise<void>;
39
- pushLater(jobData: JobData, delay: number): Promise<void>;
40
- pushLaterOn(queue: string, jobData: JobData, delay: number): Promise<void>;
37
+ push(jobData: JobData): Promise<PushResult | void>;
38
+ pushOn(queue: string, jobData: JobData): Promise<PushResult | void>;
39
+ pushLater(jobData: JobData, delay: number): Promise<PushResult | void>;
40
+ pushLaterOn(queue: string, jobData: JobData, delay: number): Promise<PushResult | void>;
41
41
  pushMany(jobs: JobData[]): Promise<void>;
42
42
  pushManyOn(queue: string, jobs: JobData[]): Promise<void>;
43
43
  size(): Promise<number>;
44
44
  sizeOf(queue: string): Promise<number>;
45
45
  recoverStalledJobs(queue: string, stalledThreshold: number, maxStalledCount: number): Promise<number>;
46
+ renewJobs(queue: string, jobIds: string[]): Promise<number>;
46
47
  upsertSchedule(config: ScheduleConfig): Promise<string>;
47
48
  /**
48
49
  * @deprecated Use `upsertSchedule` instead.