@beautinique/be-jobs 1.0.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.
- package/dist/classes/BullQueue.d.ts +16 -0
- package/dist/classes/BullQueue.js +80 -0
- package/dist/classes/BullQueue.js.map +1 -0
- package/dist/classes/BullWorker.d.ts +18 -0
- package/dist/classes/BullWorker.js +80 -0
- package/dist/classes/BullWorker.js.map +1 -0
- package/dist/classes/index.d.ts +2 -0
- package/dist/classes/index.js +19 -0
- package/dist/classes/index.js.map +1 -0
- package/dist/constants/index.d.ts +6 -0
- package/dist/constants/index.js +7 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ConnectionOptions } from 'bullmq';
|
|
2
|
+
import type { TQueueJobUnion } from '../types';
|
|
3
|
+
declare class BullQueue {
|
|
4
|
+
private connection;
|
|
5
|
+
private queues;
|
|
6
|
+
private isConnected;
|
|
7
|
+
private readonly defaultJobOptions;
|
|
8
|
+
connect(connection: ConnectionOptions): void;
|
|
9
|
+
private createQueue;
|
|
10
|
+
private getQueue;
|
|
11
|
+
private getOrCreateQueue;
|
|
12
|
+
addJob<T extends TQueueJobUnion>({ queueName, jobName, data, options }: T): Promise<import("bullmq").Job<any, any, string>>;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const bullQueue: BullQueue;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bullQueue = void 0;
|
|
4
|
+
const bullmq_1 = require("bullmq");
|
|
5
|
+
class BullQueue {
|
|
6
|
+
connection = null;
|
|
7
|
+
queues = new Map();
|
|
8
|
+
isConnected = false;
|
|
9
|
+
defaultJobOptions = {
|
|
10
|
+
attempts: 3,
|
|
11
|
+
backoff: {
|
|
12
|
+
type: 'exponential',
|
|
13
|
+
delay: 2000,
|
|
14
|
+
},
|
|
15
|
+
removeOnComplete: {
|
|
16
|
+
age: 30,
|
|
17
|
+
count: 5,
|
|
18
|
+
},
|
|
19
|
+
removeOnFail: {
|
|
20
|
+
age: 1800,
|
|
21
|
+
count: 10,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
connect(connection) {
|
|
25
|
+
if (this.isConnected) {
|
|
26
|
+
console.warn('⚠️ BullQueue already connected.');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.connection = connection;
|
|
30
|
+
this.isConnected = true;
|
|
31
|
+
console.info('✅ BullQueue connected');
|
|
32
|
+
}
|
|
33
|
+
createQueue(name) {
|
|
34
|
+
if (!this.connection)
|
|
35
|
+
throw new Error('BullQueue not connected. Call connect() first.');
|
|
36
|
+
const queue = new bullmq_1.Queue(name, {
|
|
37
|
+
connection: this.connection,
|
|
38
|
+
defaultJobOptions: this.defaultJobOptions,
|
|
39
|
+
});
|
|
40
|
+
this.queues.set(name, queue);
|
|
41
|
+
return queue;
|
|
42
|
+
}
|
|
43
|
+
getQueue(name) {
|
|
44
|
+
const queue = this.queues.get(name);
|
|
45
|
+
if (!queue) {
|
|
46
|
+
throw new Error(`Queue ${name} not found.`);
|
|
47
|
+
}
|
|
48
|
+
return queue;
|
|
49
|
+
}
|
|
50
|
+
getOrCreateQueue(name) {
|
|
51
|
+
if (!this.isConnected) {
|
|
52
|
+
throw new Error('Queue not ready. Call connect() first.');
|
|
53
|
+
}
|
|
54
|
+
if (!this.queues.has(name)) {
|
|
55
|
+
return this.createQueue(name);
|
|
56
|
+
}
|
|
57
|
+
return this.getQueue(name);
|
|
58
|
+
}
|
|
59
|
+
async addJob({ queueName, jobName, data, options }) {
|
|
60
|
+
const queue = this.getOrCreateQueue(queueName);
|
|
61
|
+
try {
|
|
62
|
+
const job = await queue.add(String(jobName), data, options);
|
|
63
|
+
console.info(`✅ Job added → ${queueName}:${jobName} (${job.id})`);
|
|
64
|
+
return job;
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
console.error(`❌ Failed to add job → ${queueName}:${jobName}`, err);
|
|
68
|
+
throw err;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async close() {
|
|
72
|
+
await Promise.all([...this.queues.values()].map((queue) => queue.close()));
|
|
73
|
+
this.queues.clear();
|
|
74
|
+
this.connection = null;
|
|
75
|
+
this.isConnected = false;
|
|
76
|
+
console.warn('🛑 All Queues Closed');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.bullQueue = new BullQueue();
|
|
80
|
+
//# sourceMappingURL=BullQueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BullQueue.js","sourceRoot":"","sources":["../../src/classes/BullQueue.ts"],"names":[],"mappings":";;;AAAA,mCAA+E;AAG/E,MAAM,SAAS;IACL,UAAU,GAA6B,IAAI,CAAC;IAC5C,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IACtC,WAAW,GAAG,KAAK,CAAC;IACX,iBAAiB,GAAsB;QACtD,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE;YACP,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,IAAI;SACZ;QACD,gBAAgB,EAAE;YAChB,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC;SACT;QACD,YAAY,EAAE;YACZ,GAAG,EAAE,IAAI;YACT,KAAK,EAAE,EAAE;SACV;KACF,CAAC;IAIK,OAAO,CAAC,UAA6B;QAC1C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;YAChD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B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C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YAC5D,OAAO,CAAC,IAAI,CAAC,iBAAiB,SAAS,IAAI,OAAO,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;YAClE,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,yBAAyB,SAAS,IAAI,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;YACpE,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;IAIM,KAAK,CAAC,KAAK;QAChB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAE3E,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACvC,CAAC;CACF;AAEY,QAAA,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Worker, type ConnectionOptions, type Job, type WorkerOptions } from 'bullmq';
|
|
2
|
+
import type { TJobData, TJobName, TQueueName } from '../types';
|
|
3
|
+
export declare class BullWorker {
|
|
4
|
+
private connection;
|
|
5
|
+
private workers;
|
|
6
|
+
private isConnected;
|
|
7
|
+
connect(connection: ConnectionOptions): void;
|
|
8
|
+
private registerEvents;
|
|
9
|
+
createWorker<Q extends TQueueName, J extends TJobName<Q>>({ queueName, jobName, handler, options, }: {
|
|
10
|
+
queueName: Q;
|
|
11
|
+
jobName: J;
|
|
12
|
+
handler: (job: Job<TJobData<Q, J>>) => Promise<void>;
|
|
13
|
+
options?: Omit<WorkerOptions, 'connection'>;
|
|
14
|
+
}): Worker<any, any, string>;
|
|
15
|
+
closeWorker(queueName: TQueueName, jobName: string): Promise<void>;
|
|
16
|
+
closeAll(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare const bullWorker: BullWorker;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bullWorker = exports.BullWorker = void 0;
|
|
4
|
+
const bullmq_1 = require("bullmq");
|
|
5
|
+
class BullWorker {
|
|
6
|
+
connection = null;
|
|
7
|
+
workers = new Map();
|
|
8
|
+
isConnected = false;
|
|
9
|
+
connect(connection) {
|
|
10
|
+
if (this.isConnected) {
|
|
11
|
+
console.warn('⚠️ BullWorker already connected.');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
this.connection = connection;
|
|
15
|
+
this.isConnected = true;
|
|
16
|
+
console.info('✅ BullWorker connected');
|
|
17
|
+
}
|
|
18
|
+
registerEvents(worker, workerKey) {
|
|
19
|
+
worker.on('completed', (job) => {
|
|
20
|
+
console.info(`✅ Worker completed → ${workerKey} (${job.id})`);
|
|
21
|
+
});
|
|
22
|
+
worker.on('failed', (job, err) => {
|
|
23
|
+
console.error(`❌ Worker failed → ${workerKey} (${job?.id})`, err);
|
|
24
|
+
});
|
|
25
|
+
worker.on('error', (err) => {
|
|
26
|
+
console.error(`❌ Worker error → ${workerKey}`, err);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
createWorker({ queueName, jobName, handler, options, }) {
|
|
30
|
+
if (!this.isConnected || !this.connection) {
|
|
31
|
+
throw new Error('BullWorker not connected. Call connect() first.');
|
|
32
|
+
}
|
|
33
|
+
const workerKey = `${queueName}:${String(jobName)}`;
|
|
34
|
+
if (this.workers.has(workerKey)) {
|
|
35
|
+
console.warn(`⚠️ Worker already exists → ${workerKey}`);
|
|
36
|
+
return this.workers.get(workerKey);
|
|
37
|
+
}
|
|
38
|
+
const worker = new bullmq_1.Worker(queueName, async (job) => {
|
|
39
|
+
if (job.name !== jobName)
|
|
40
|
+
return;
|
|
41
|
+
try {
|
|
42
|
+
console.info(`📩 Processing → ${workerKey} (${job.id})`);
|
|
43
|
+
await handler(job);
|
|
44
|
+
console.info(`✅ Completed → ${workerKey} (${job.id})`);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
console.error(`❌ Failed → ${workerKey} (${job.id})`, err);
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
connection: this.connection,
|
|
52
|
+
concurrency: 3,
|
|
53
|
+
limiter: { max: 10, duration: 1000 },
|
|
54
|
+
...options,
|
|
55
|
+
});
|
|
56
|
+
this.registerEvents(worker, workerKey);
|
|
57
|
+
this.workers.set(workerKey, worker);
|
|
58
|
+
console.info(`🚀 Worker started → ${workerKey}`);
|
|
59
|
+
return worker;
|
|
60
|
+
}
|
|
61
|
+
async closeWorker(queueName, jobName) {
|
|
62
|
+
const workerKey = `${queueName}:${jobName}`;
|
|
63
|
+
const worker = this.workers.get(workerKey);
|
|
64
|
+
if (!worker)
|
|
65
|
+
return;
|
|
66
|
+
await worker.close();
|
|
67
|
+
this.workers.delete(workerKey);
|
|
68
|
+
console.warn(`🛑 Worker closed → ${workerKey}`);
|
|
69
|
+
}
|
|
70
|
+
async closeAll() {
|
|
71
|
+
await Promise.all([...this.workers.values()].map((worker) => worker.close()));
|
|
72
|
+
this.workers.clear();
|
|
73
|
+
this.connection = null;
|
|
74
|
+
this.isConnected = false;
|
|
75
|
+
console.warn('🛑 All Workers Closed');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.BullWorker = BullWorker;
|
|
79
|
+
exports.bullWorker = new BullWorker();
|
|
80
|
+
//# sourceMappingURL=BullWorker.js.map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C,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAEpC,OAAO,CAAC,IAAI,CAAC,uBAAuB,SAAS,EAAE,CAAC,CAAC;QAEjD,OAAO,MAAM,CAAC;IAChB,CAAC;IAIM,KAAK,CAAC,WAAW,CAAC,SAAqB,EAAE,OAAe;QAC7D,MAAM,SAAS,GAAG,GAAG,SAAS,IAAI,OAAO,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAE3C,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QAErB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAE/B,OAAO,CAAC,IAAI,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC;IAIM,KAAK,CAAC,QAAQ;QACnB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAE9E,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAErB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACxC,CAAC;CACF;AAvID,gCAuIC;AAIY,QAAA,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BullQueue"), exports);
|
|
18
|
+
__exportStar(require("./BullWorker"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAAG;IAC1B,aAAa,EAAE,EAAE,UAAU,EAAE,EAAe,EAAE;CACtC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './classes';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./classes"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JobsOptions } from 'bullmq';
|
|
2
|
+
import type { QUEUE_SCHEMA } from '../constants';
|
|
3
|
+
type TSchema = typeof QUEUE_SCHEMA;
|
|
4
|
+
export type TQueueName = keyof TSchema;
|
|
5
|
+
export type TJobName<Q extends TQueueName> = keyof TSchema[Q];
|
|
6
|
+
export type TJobData<Q extends TQueueName, J extends TJobName<Q>> = TSchema[Q][J];
|
|
7
|
+
export type TQueueJobUnion = {
|
|
8
|
+
[Q in TQueueName]: {
|
|
9
|
+
[J in TJobName<Q>]: {
|
|
10
|
+
queueName: Q;
|
|
11
|
+
jobName: J;
|
|
12
|
+
data: TJobData<Q, J>;
|
|
13
|
+
options?: JobsOptions;
|
|
14
|
+
};
|
|
15
|
+
}[TJobName<Q>];
|
|
16
|
+
}[TQueueName];
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@beautinique/be-jobs",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Jobs for the Beautinique backend project.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [],
|
|
19
|
+
"author": "Nageshwar",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"type": "commonjs",
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"prettier": "^3.8.3",
|
|
27
|
+
"typescript": "^6.0.2",
|
|
28
|
+
"bullmq": "^5.76.6"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"bullmq": "^5.76.6"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@beautinique/be-zod": "^1.0.16",
|
|
35
|
+
"bullmq": "^5.76.6"
|
|
36
|
+
}
|
|
37
|
+
}
|