@clipboard-health/background-jobs-adapter 0.5.0 → 0.5.2

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@clipboard-health/background-jobs-adapter",
3
3
  "description": "Minimal adapter interface for background jobs operations supporting Mongo and Postgres implementations.",
4
- "version": "0.5.0",
4
+ "version": "0.5.2",
5
5
  "bugs": "https://github.com/ClipboardHealth/core-utils/issues",
6
6
  "dependencies": {
7
7
  "tslib": "2.8.1"
@@ -50,11 +50,11 @@ export declare const ENQUEUE_FIELD_NAMES: {
50
50
  };
51
51
  export type EnqueueOptions = MongoEnqueueOptions | PostgresEnqueueOptions;
52
52
  /**
53
- * Minimal adapter interface for background jobs operations supporting background-jobs-mongo (Mongo)
53
+ * Minimal adapter interface for background jobs operations supporting mongo-jobs (Mongo)
54
54
  * and background-jobs-postgres (Postgres) implementations.
55
55
  */
56
- export interface BackgroundJobsAdapter {
57
- implementation: BackgroundJobsImplementation;
56
+ export interface BackgroundJobsAdapter<TImplementation extends BackgroundJobsImplementation = BackgroundJobsImplementation> {
57
+ implementation: TImplementation;
58
58
  /**
59
59
  * Enqueue a job to be processed.
60
60
  *
@@ -63,6 +63,6 @@ export interface BackgroundJobsAdapter {
63
63
  * @param options - Optional configuration for the job
64
64
  * @returns A promise that resolves to the enqueued job or undefined (implementation-specific)
65
65
  */
66
- enqueue<T>(handler: string | HandlerClassOrInstance<T>, data: T, options?: EnqueueOptions): Promise<unknown>;
66
+ enqueue<T>(handler: string | HandlerClassOrInstance<T>, data: T, options?: TImplementation extends "mongo" ? MongoEnqueueOptions : TImplementation extends "postgres" ? PostgresEnqueueOptions : EnqueueOptions): Promise<unknown>;
67
67
  }
68
68
  export {};