@tsed/bullmq 8.11.0 → 8.11.2-rc.1

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 (72) hide show
  1. package/lib/esm/BullMQModule.js +0 -1
  2. package/lib/esm/config/config.js +0 -1
  3. package/lib/esm/constants/BullMQTypes.js +0 -1
  4. package/lib/esm/constants/constants.js +0 -1
  5. package/lib/esm/contracts/JobMethods.js +0 -1
  6. package/lib/esm/contracts/JobStore.js +0 -1
  7. package/lib/esm/contracts/index.js +0 -1
  8. package/lib/esm/decorators/InjectQueue.js +0 -1
  9. package/lib/esm/decorators/InjectWorker.js +0 -1
  10. package/lib/esm/decorators/JobController.js +0 -1
  11. package/lib/esm/decorators/index.js +0 -1
  12. package/lib/esm/dispatchers/JobDispatcher.js +0 -1
  13. package/lib/esm/dispatchers/JobDispatcherOptions.js +0 -1
  14. package/lib/esm/dispatchers/index.js +0 -1
  15. package/lib/esm/index.js +0 -1
  16. package/lib/esm/utils/createQueueProvider.js +0 -1
  17. package/lib/esm/utils/createWorkerProvider.js +0 -1
  18. package/lib/esm/utils/getJobToken.js +0 -1
  19. package/lib/esm/utils/getQueueToken.js +0 -1
  20. package/lib/esm/utils/getWorkerToken.js +0 -1
  21. package/lib/esm/utils/mapQueueOptions.js +0 -1
  22. package/lib/esm/utils/mapWorkerOptions.js +0 -1
  23. package/package.json +11 -8
  24. package/.barrelsby.json +0 -5
  25. package/lib/esm/BullMQModule.js.map +0 -1
  26. package/lib/esm/config/config.js.map +0 -1
  27. package/lib/esm/constants/BullMQTypes.js.map +0 -1
  28. package/lib/esm/constants/constants.js.map +0 -1
  29. package/lib/esm/contracts/JobMethods.js.map +0 -1
  30. package/lib/esm/contracts/JobStore.js.map +0 -1
  31. package/lib/esm/contracts/index.js.map +0 -1
  32. package/lib/esm/decorators/InjectQueue.js.map +0 -1
  33. package/lib/esm/decorators/InjectWorker.js.map +0 -1
  34. package/lib/esm/decorators/JobController.js.map +0 -1
  35. package/lib/esm/decorators/index.js.map +0 -1
  36. package/lib/esm/dispatchers/JobDispatcher.js.map +0 -1
  37. package/lib/esm/dispatchers/JobDispatcherOptions.js.map +0 -1
  38. package/lib/esm/dispatchers/index.js.map +0 -1
  39. package/lib/esm/index.js.map +0 -1
  40. package/lib/esm/utils/createQueueProvider.js.map +0 -1
  41. package/lib/esm/utils/createWorkerProvider.js.map +0 -1
  42. package/lib/esm/utils/getJobToken.js.map +0 -1
  43. package/lib/esm/utils/getQueueToken.js.map +0 -1
  44. package/lib/esm/utils/getWorkerToken.js.map +0 -1
  45. package/lib/esm/utils/mapQueueOptions.js.map +0 -1
  46. package/lib/esm/utils/mapWorkerOptions.js.map +0 -1
  47. package/src/BullMQModule.spec.ts +0 -482
  48. package/src/BullMQModule.ts +0 -151
  49. package/src/config/config.ts +0 -59
  50. package/src/constants/BullMQTypes.ts +0 -7
  51. package/src/constants/constants.ts +0 -1
  52. package/src/contracts/JobMethods.ts +0 -7
  53. package/src/contracts/JobStore.ts +0 -7
  54. package/src/contracts/index.ts +0 -5
  55. package/src/decorators/InjectQueue.ts +0 -7
  56. package/src/decorators/InjectWorker.ts +0 -7
  57. package/src/decorators/JobController.spec.ts +0 -94
  58. package/src/decorators/JobController.ts +0 -33
  59. package/src/decorators/index.ts +0 -6
  60. package/src/dispatchers/JobDispatcher.spec.ts +0 -169
  61. package/src/dispatchers/JobDispatcher.ts +0 -78
  62. package/src/dispatchers/JobDispatcherOptions.ts +0 -4
  63. package/src/dispatchers/index.ts +0 -5
  64. package/src/index.ts +0 -24
  65. package/src/utils/createQueueProvider.ts +0 -16
  66. package/src/utils/createWorkerProvider.ts +0 -18
  67. package/src/utils/getJobToken.ts +0 -7
  68. package/src/utils/getQueueToken.ts +0 -3
  69. package/src/utils/getWorkerToken.ts +0 -3
  70. package/src/utils/mapQueueOptions.ts +0 -14
  71. package/src/utils/mapWorkerOptions.ts +0 -14
  72. package/vitest.config.mts +0 -26
@@ -1,7 +0,0 @@
1
- import {JobsOptions} from "bullmq";
2
-
3
- export interface JobStore {
4
- name: string;
5
- queue: string;
6
- opts: JobsOptions;
7
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./JobMethods.js";
5
- export * from "./JobStore.js";
@@ -1,7 +0,0 @@
1
- import {Inject} from "@tsed/di";
2
-
3
- import {getQueueToken} from "../utils/getQueueToken.js";
4
-
5
- export function InjectQueue(name: string) {
6
- return Inject(getQueueToken(name));
7
- }
@@ -1,7 +0,0 @@
1
- import {Inject} from "@tsed/di";
2
-
3
- import {getWorkerToken} from "../utils/getWorkerToken.js";
4
-
5
- export function InjectWorker(name: string) {
6
- return Inject(getWorkerToken(name));
7
- }
@@ -1,94 +0,0 @@
1
- import {Store} from "@tsed/core";
2
- import {GlobalProviders} from "@tsed/di";
3
-
4
- import {FallbackJobController, JobController} from "./JobController.js";
5
-
6
- describe("JobController", () => {
7
- afterEach(() => GlobalProviders.clear());
8
-
9
- it("should set the proper store data", () => {
10
- @JobController("testjob")
11
- class TestJob {}
12
-
13
- const store = Store.from(TestJob).get("bullmq");
14
-
15
- expect(store.name).toBe("testjob");
16
- expect(store.queue).toBe("default");
17
- expect(store.opts).toStrictEqual({});
18
- });
19
-
20
- it("should allow settings a custom queue", () => {
21
- @JobController("testjob", "custom")
22
- class CustomQueueJob {}
23
-
24
- const store = Store.from(CustomQueueJob).get("bullmq");
25
-
26
- expect(store.queue).toBe("custom");
27
- });
28
-
29
- it("should allow custom options to be set", () => {
30
- @JobController("testjob", "default", {
31
- backoff: 69,
32
- attempts: 42
33
- })
34
- class CustomOptionsJob {}
35
-
36
- const store = Store.from(CustomOptionsJob).get("bullmq");
37
-
38
- expect(store.opts).toStrictEqual({
39
- backoff: 69,
40
- attempts: 42
41
- });
42
- });
43
-
44
- it("should set type for cron jobs", () => {
45
- @JobController("testjob", "default", {
46
- repeat: {count: 42}
47
- })
48
- class CustomCronJob {}
49
-
50
- const store = Store.from(CustomCronJob).get("bullmq");
51
-
52
- expect(store).toBeDefined();
53
- });
54
- });
55
-
56
- describe("FallbackJobController", () => {
57
- afterEach(() => GlobalProviders.clear());
58
-
59
- describe("with queue", () => {
60
- it("should set the proper store data", () => {
61
- @FallbackJobController("default")
62
- class FallbackJob {}
63
-
64
- const store = Store.from(FallbackJob).get("bullmq");
65
- expect(store.queue).toBe("default");
66
-
67
- const fallbackControllerForQueue = GlobalProviders.get("bullmq.fallback-job.default");
68
- expect(fallbackControllerForQueue).not.toBeUndefined();
69
- expect(fallbackControllerForQueue?.type).toEqual("bullmq:fallback-job");
70
- expect(fallbackControllerForQueue?.useClass).toEqual(FallbackJob);
71
-
72
- const fallbackController = GlobalProviders.get("bullmq.fallback-job");
73
- expect(fallbackController).toBeUndefined();
74
- });
75
- });
76
-
77
- describe("without queue", () => {
78
- it("should set the proper store data", () => {
79
- @FallbackJobController()
80
- class FallbackJob {}
81
-
82
- const store = Store.from(FallbackJob).get("bullmq");
83
- expect(store.queue).toBeUndefined();
84
-
85
- const fallbackController = GlobalProviders.get("bullmq.fallback-job");
86
- expect(fallbackController).not.toBeUndefined();
87
- expect(fallbackController?.type).toEqual("bullmq:fallback-job");
88
- expect(fallbackController?.useClass).toEqual(FallbackJob);
89
-
90
- const fallbackControllerForQueue = GlobalProviders.get("bullmq.fallback-job.default");
91
- expect(fallbackControllerForQueue).toBeUndefined();
92
- });
93
- });
94
- });
@@ -1,33 +0,0 @@
1
- import {StoreMerge, useDecorators} from "@tsed/core";
2
- import {Injectable} from "@tsed/di";
3
- import {JobsOptions} from "bullmq";
4
-
5
- import {BullMQTypes} from "../constants/BullMQTypes.js";
6
- import {BULLMQ} from "../constants/constants.js";
7
- import {getFallbackJobToken, getJobToken} from "../utils/getJobToken.js";
8
-
9
- export function JobController(name: string, queue: string = "default", opts: JobsOptions = {}) {
10
- return useDecorators(
11
- StoreMerge(BULLMQ, {
12
- name,
13
- queue,
14
- opts
15
- }),
16
- Injectable({
17
- token: getJobToken(queue, name),
18
- type: opts.repeat ? BullMQTypes.CRON : BullMQTypes.JOB
19
- })
20
- );
21
- }
22
-
23
- export function FallbackJobController(queue?: string) {
24
- return useDecorators(
25
- StoreMerge(BULLMQ, {
26
- queue
27
- }),
28
- Injectable({
29
- token: getFallbackJobToken(queue),
30
- type: BullMQTypes.FALLBACK_JOB
31
- })
32
- );
33
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./InjectQueue.js";
5
- export * from "./InjectWorker.js";
6
- export * from "./JobController.js";
@@ -1,169 +0,0 @@
1
- import {catchAsyncError} from "@tsed/core";
2
- import {DITest, inject, injectable, injector} from "@tsed/di";
3
- import {beforeEach} from "vitest";
4
-
5
- import {JobMethods} from "../contracts/index.js";
6
- import {JobController} from "../decorators/index.js";
7
- import {JobDispatcher} from "./JobDispatcher.js";
8
-
9
- @JobController("example-job-with-custom-id-from-job-methods")
10
- class ExampleJobWithCustomJobIdFromJobMethods implements JobMethods {
11
- handle(payload: string) {}
12
-
13
- jobId(payload: string): string {
14
- return payload.toUpperCase();
15
- }
16
- }
17
-
18
- @JobController("example-job", "default", {
19
- backoff: 69
20
- })
21
- class ExampleTestJob implements JobMethods {
22
- handle(payload: {msg: string}) {}
23
- }
24
-
25
- @JobController("queue-not-configured", "not-configured")
26
- class NotConfiguredQueueTestJob implements JobMethods {
27
- handle() {}
28
- }
29
-
30
- function getFixture() {
31
- const dispatcher = inject(JobDispatcher);
32
- const queue = {
33
- name: "default",
34
- add: vi.fn()
35
- };
36
-
37
- const specialQueue = {
38
- name: "special",
39
- add: vi.fn()
40
- };
41
-
42
- injectable("bullmq.queue.default").value(queue);
43
- injectable("bullmq.queue.special").value(specialQueue);
44
- injectable("bullmq.job.default.example-job").value(new ExampleTestJob());
45
- injectable("bullmq.job.default.example-job-with-custom-id-from-job-methods").value(new ExampleJobWithCustomJobIdFromJobMethods());
46
-
47
- vi.spyOn(injector(), "resolve");
48
-
49
- return {
50
- dispatcher,
51
- queue,
52
- specialQueue,
53
- job: inject<ExampleJobWithCustomJobIdFromJobMethods>("bullmq.job.default.example-job-with-custom-id-from-job-methods")
54
- };
55
- }
56
-
57
- describe("JobDispatcher", () => {
58
- beforeEach(() => DITest.create());
59
- afterEach(() => DITest.reset());
60
-
61
- it("should throw an exception when a queue is not configured", async () => {
62
- const {dispatcher} = getFixture();
63
-
64
- const error = await catchAsyncError(() => dispatcher.dispatch(NotConfiguredQueueTestJob));
65
-
66
- await expect(error).toEqual(new Error("Queue(not-configured) not defined"));
67
-
68
- expect(injector().resolve).toHaveBeenCalledWith("bullmq.queue.not-configured", expect.anything());
69
- });
70
- it("should dispatch job as type", async () => {
71
- const {dispatcher, queue} = getFixture();
72
-
73
- await dispatcher.dispatch(ExampleTestJob, {msg: "hello test"});
74
-
75
- expect(queue.add).toHaveBeenCalledOnce();
76
- expect(queue.add).toHaveBeenCalledWith(
77
- "example-job",
78
- expect.objectContaining({msg: "hello test"}),
79
- expect.objectContaining({backoff: 69})
80
- );
81
- });
82
- it("should dispatch job as options", async () => {
83
- const {dispatcher, specialQueue} = getFixture();
84
-
85
- await dispatcher.dispatch(
86
- {
87
- queue: "special",
88
- name: "some-name"
89
- },
90
- {msg: "hello test"}
91
- );
92
-
93
- expect(specialQueue.add).toHaveBeenCalledOnce();
94
- expect(specialQueue.add).toHaveBeenCalledWith("some-name", expect.objectContaining({msg: "hello test"}), expect.anything());
95
- });
96
- it("should dispatch job as string", async () => {
97
- const {dispatcher, queue} = getFixture();
98
-
99
- await dispatcher.dispatch("some-name", {msg: "hello test"});
100
-
101
- expect(queue.add).toHaveBeenCalledOnce();
102
- expect(queue.add).toHaveBeenCalledWith("some-name", expect.objectContaining({msg: "hello test"}), expect.anything());
103
- });
104
- it("should overwrite job options defined by the job", async () => {
105
- const {dispatcher, queue} = getFixture();
106
-
107
- await dispatcher.dispatch(ExampleTestJob, {msg: "hello test"}, {backoff: 42, jobId: "ffeeaa"});
108
-
109
- expect(queue.add).toHaveBeenCalledOnce();
110
- expect(queue.add).toHaveBeenCalledWith(
111
- "example-job",
112
- expect.objectContaining({msg: "hello test"}),
113
- expect.objectContaining({backoff: 42, jobId: "ffeeaa"})
114
- );
115
- });
116
- it("should keep existing options and add new ones", async () => {
117
- const {dispatcher, queue} = getFixture();
118
-
119
- await dispatcher.dispatch(ExampleTestJob, {msg: "hello test"}, {jobId: "ffeeaa"});
120
-
121
- expect(queue.add).toHaveBeenCalledOnce();
122
- expect(queue.add).toHaveBeenCalledWith(
123
- "example-job",
124
- expect.objectContaining({msg: "hello test"}),
125
- expect.objectContaining({backoff: 69, jobId: "ffeeaa"})
126
- );
127
- });
128
- describe("custom jobId", () => {
129
- it("should allow setting the job id from within the job", async () => {
130
- const {dispatcher, queue} = getFixture();
131
-
132
- await dispatcher.dispatch(ExampleJobWithCustomJobIdFromJobMethods, "hello world");
133
-
134
- expect(queue.add).toHaveBeenCalledOnce();
135
- expect(queue.add).toHaveBeenCalledWith("example-job-with-custom-id-from-job-methods", "hello world", expect.anything());
136
-
137
- const [, , opts] = queue.add.mock.calls.at(-1)!;
138
-
139
- expect(opts).toMatchObject({
140
- jobId: "HELLO WORLD"
141
- });
142
- });
143
-
144
- it("should pass the payload to the jobId method", async () => {
145
- const {dispatcher, job} = getFixture();
146
-
147
- vi.spyOn(job, "jobId");
148
-
149
- await dispatcher.dispatch(ExampleJobWithCustomJobIdFromJobMethods, "hello world");
150
-
151
- expect(job.jobId).toHaveBeenCalledOnce();
152
- expect(job.jobId).toHaveBeenCalledWith("hello world");
153
- });
154
-
155
- it("should choose the jobId provided to the dispatcher even when the method is implemented", async () => {
156
- const {dispatcher, queue} = getFixture();
157
-
158
- await dispatcher.dispatch(ExampleJobWithCustomJobIdFromJobMethods, "hello world", {
159
- jobId: "I don't think so"
160
- });
161
-
162
- const [, , opts] = queue.add.mock.calls.at(-1)!;
163
-
164
- expect(opts).toMatchObject({
165
- jobId: "I don't think so"
166
- });
167
- });
168
- });
169
- });
@@ -1,78 +0,0 @@
1
- import {isClass, Store, Type} from "@tsed/core";
2
- import {inject, injectable} from "@tsed/di";
3
- import {Job as BullMQJob, JobsOptions, Queue} from "bullmq";
4
-
5
- import {BULLMQ} from "../constants/constants.js";
6
- import {JobMethods, type JobStore} from "../contracts/index.js";
7
- import {getJobToken} from "../utils/getJobToken.js";
8
- import {getQueueToken} from "../utils/getQueueToken.js";
9
- import type {JobDispatcherOptions} from "./JobDispatcherOptions.js";
10
-
11
- export class JobDispatcher {
12
- public async dispatch<T extends JobMethods>(
13
- job: Type<T>,
14
- payload?: Parameters<T["handle"]>[0],
15
- options?: JobsOptions
16
- ): Promise<BullMQJob>;
17
- public async dispatch<P = unknown>(job: JobDispatcherOptions, payload?: P, options?: JobsOptions): Promise<BullMQJob>;
18
- public async dispatch<P = unknown>(job: string, payload?: P, options?: JobsOptions): Promise<BullMQJob>;
19
- public async dispatch(job: Type | JobDispatcherOptions | string, payload: unknown, options: JobsOptions = {}): Promise<BullMQJob> {
20
- const {queueName, jobName, defaultJobOptions} = await this.resolveDispatchArgs(job, payload);
21
-
22
- const queue = inject<Queue>(getQueueToken(queueName));
23
-
24
- if (!queue) {
25
- throw new Error(`Queue(${queueName}) not defined`);
26
- }
27
-
28
- return queue.add(jobName, payload, {
29
- ...defaultJobOptions,
30
- ...options
31
- });
32
- }
33
-
34
- private async resolveDispatchArgs(job: Type | JobDispatcherOptions | string, payload: unknown) {
35
- let queueName: string;
36
- let jobName: string;
37
- let defaultJobOptions: JobsOptions | undefined;
38
-
39
- if (typeof job === "function") {
40
- // job is passed as a Type
41
- const store = Store.from(job).get<JobStore>(BULLMQ);
42
- queueName = store.queue;
43
- jobName = store.name;
44
-
45
- defaultJobOptions = await this.retrieveJobOptionsFromClassBasedJob(store, payload);
46
- } else if (typeof job === "object") {
47
- // job is passed as JobDispatcherOptions
48
- queueName = job.queue;
49
- jobName = job.name;
50
- } else {
51
- // job is passed as a string
52
- queueName = "default";
53
- jobName = job;
54
- }
55
-
56
- return {
57
- queueName,
58
- jobName,
59
- defaultJobOptions
60
- };
61
- }
62
-
63
- private async retrieveJobOptionsFromClassBasedJob(store: JobStore, payload: unknown): Promise<JobsOptions> {
64
- const job = inject<JobMethods>(getJobToken(store.queue, store.name));
65
- const jobId = await job.jobId?.(payload);
66
-
67
- if (jobId === undefined) {
68
- return store.opts;
69
- }
70
-
71
- return {
72
- ...store.opts,
73
- jobId
74
- };
75
- }
76
- }
77
-
78
- injectable(JobDispatcher);
@@ -1,4 +0,0 @@
1
- export interface JobDispatcherOptions {
2
- queue: string;
3
- name: string;
4
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./JobDispatcher.js";
5
- export * from "./JobDispatcherOptions.js";
package/src/index.ts DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./BullMQModule.js";
5
- export * from "./config/config.js";
6
- export * from "./constants/BullMQTypes.js";
7
- export * from "./constants/constants.js";
8
- export * from "./contracts/index.js";
9
- export * from "./contracts/JobMethods.js";
10
- export * from "./contracts/JobStore.js";
11
- export * from "./decorators/index.js";
12
- export * from "./decorators/InjectQueue.js";
13
- export * from "./decorators/InjectWorker.js";
14
- export * from "./decorators/JobController.js";
15
- export * from "./dispatchers/index.js";
16
- export * from "./dispatchers/JobDispatcher.js";
17
- export * from "./dispatchers/JobDispatcherOptions.js";
18
- export * from "./utils/createQueueProvider.js";
19
- export * from "./utils/createWorkerProvider.js";
20
- export * from "./utils/getJobToken.js";
21
- export * from "./utils/getQueueToken.js";
22
- export * from "./utils/getWorkerToken.js";
23
- export * from "./utils/mapQueueOptions.js";
24
- export * from "./utils/mapWorkerOptions.js";
@@ -1,16 +0,0 @@
1
- import {inject, injectable} from "@tsed/di";
2
- import {Queue, QueueOptions} from "bullmq";
3
-
4
- import {getQueueToken} from "./getQueueToken.js";
5
-
6
- export function createQueueProvider(queue: string, opts: QueueOptions) {
7
- const token = getQueueToken(queue);
8
-
9
- injectable(token)
10
- .factory(() => new Queue(queue, opts))
11
- .hooks({
12
- $onDestroy: (queue: Queue) => queue.close()
13
- });
14
-
15
- return inject<Queue>(token);
16
- }
@@ -1,18 +0,0 @@
1
- import {inject, injectable} from "@tsed/di";
2
- import {Job, Worker, WorkerOptions} from "bullmq";
3
-
4
- import {BullMQTypes} from "../constants/BullMQTypes.js";
5
- import {getWorkerToken} from "./getWorkerToken.js";
6
-
7
- export function createWorkerProvider(worker: string, process: (job: Job) => any, opts: WorkerOptions) {
8
- const token = getWorkerToken(worker);
9
-
10
- injectable(token)
11
- .type(BullMQTypes.WORKER)
12
- .value(new Worker(worker, process, opts))
13
- .hooks({
14
- $onDestroy: (worker: Worker) => worker.close()
15
- });
16
-
17
- return inject<Worker>(token);
18
- }
@@ -1,7 +0,0 @@
1
- export function getJobToken(queue: string, name: string) {
2
- return `bullmq.job.${queue}.${name}`;
3
- }
4
-
5
- export function getFallbackJobToken(queue?: string) {
6
- return ["bullmq.fallback-job", queue].filter(Boolean).join(".");
7
- }
@@ -1,3 +0,0 @@
1
- export function getQueueToken(queue: string) {
2
- return `bullmq.queue.${queue}`;
3
- }
@@ -1,3 +0,0 @@
1
- export function getWorkerToken(worker: string) {
2
- return `bullmq.worker.${worker}`;
3
- }
@@ -1,14 +0,0 @@
1
- import {deepMerge} from "@tsed/core";
2
- import type {QueueOptions} from "bullmq";
3
-
4
- import {BullMQConfig} from "../config/config.js";
5
-
6
- export function mapQueueOptions(queue: string, bullMQConfig: BullMQConfig): QueueOptions {
7
- return deepMerge<QueueOptions, QueueOptions>(
8
- {
9
- connection: bullMQConfig.connection,
10
- ...bullMQConfig.defaultQueueOptions
11
- },
12
- bullMQConfig.queueOptions?.[queue]
13
- )!;
14
- }
@@ -1,14 +0,0 @@
1
- import {deepMerge} from "@tsed/core";
2
- import type {WorkerOptions} from "bullmq";
3
-
4
- import {BullMQConfig} from "../config/config.js";
5
-
6
- export function mapWorkerOptions(queue: string, bullMQConfig: BullMQConfig): WorkerOptions {
7
- return deepMerge<WorkerOptions, WorkerOptions>(
8
- {
9
- connection: bullMQConfig.connection,
10
- ...bullMQConfig.defaultWorkerOptions
11
- },
12
- bullMQConfig.workerOptions?.[queue]
13
- )!;
14
- }
package/vitest.config.mts DELETED
@@ -1,26 +0,0 @@
1
- // @ts-ignore
2
- import {presets} from "@tsed/vitest/presets";
3
- import {defineConfig} from "vitest/config";
4
-
5
- export default defineConfig(
6
- {
7
- ...presets,
8
- test: {
9
- ...presets.test,
10
- coverage: {
11
- ...presets.test.coverage,
12
- exclude: [
13
- ...presets.test.coverage.exclude,
14
- "**/contracts/**/*",
15
- "**/config/**/*"
16
- ],
17
- thresholds: {
18
- statements: 0,
19
- branches: 0,
20
- functions: 0,
21
- lines: 0
22
- }
23
- }
24
- }
25
- }
26
- );