@riktajs/queue 0.1.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.
- package/README.md +476 -0
- package/dist/config/queue.config.d.ts +137 -0
- package/dist/config/queue.config.d.ts.map +1 -0
- package/dist/config/queue.config.js +82 -0
- package/dist/config/queue.config.js.map +1 -0
- package/dist/constants.d.ts +33 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +37 -0
- package/dist/constants.js.map +1 -0
- package/dist/decorators/events.decorator.d.ts +85 -0
- package/dist/decorators/events.decorator.d.ts.map +1 -0
- package/dist/decorators/events.decorator.js +120 -0
- package/dist/decorators/events.decorator.js.map +1 -0
- package/dist/decorators/index.d.ts +8 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +8 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/process.decorator.d.ts +41 -0
- package/dist/decorators/process.decorator.d.ts.map +1 -0
- package/dist/decorators/process.decorator.js +61 -0
- package/dist/decorators/process.decorator.js.map +1 -0
- package/dist/decorators/processor.decorator.d.ts +41 -0
- package/dist/decorators/processor.decorator.d.ts.map +1 -0
- package/dist/decorators/processor.decorator.js +59 -0
- package/dist/decorators/processor.decorator.js.map +1 -0
- package/dist/decorators/queue.decorator.d.ts +35 -0
- package/dist/decorators/queue.decorator.d.ts.map +1 -0
- package/dist/decorators/queue.decorator.js +49 -0
- package/dist/decorators/queue.decorator.js.map +1 -0
- package/dist/events/queue-events.d.ts +32 -0
- package/dist/events/queue-events.d.ts.map +1 -0
- package/dist/events/queue-events.js +103 -0
- package/dist/events/queue-events.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/monitoring/bull-board.d.ts +77 -0
- package/dist/monitoring/bull-board.d.ts.map +1 -0
- package/dist/monitoring/bull-board.js +112 -0
- package/dist/monitoring/bull-board.js.map +1 -0
- package/dist/providers/queue.provider.d.ts +94 -0
- package/dist/providers/queue.provider.d.ts.map +1 -0
- package/dist/providers/queue.provider.js +333 -0
- package/dist/providers/queue.provider.js.map +1 -0
- package/dist/services/queue.service.d.ts +133 -0
- package/dist/services/queue.service.d.ts.map +1 -0
- package/dist/services/queue.service.js +192 -0
- package/dist/services/queue.service.js.map +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/connection.d.ts +47 -0
- package/dist/utils/connection.d.ts.map +1 -0
- package/dist/utils/connection.js +104 -0
- package/dist/utils/connection.js.map +1 -0
- package/dist/utils/validation.d.ts +187 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +156 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants and DI tokens for @riktajs/queue
|
|
3
|
+
*/
|
|
4
|
+
/** Metadata keys for decorator reflection */
|
|
5
|
+
export declare const METADATA_KEY: {
|
|
6
|
+
/** Queue class decorator options */
|
|
7
|
+
readonly QUEUE_OPTIONS: "riktajs:queue:options";
|
|
8
|
+
/** Processor class decorator options */
|
|
9
|
+
readonly PROCESSOR_OPTIONS: "riktajs:queue:processor:options";
|
|
10
|
+
/** Job handler method metadata */
|
|
11
|
+
readonly JOB_HANDLERS: "riktajs:queue:job:handlers";
|
|
12
|
+
/** Event handler method metadata */
|
|
13
|
+
readonly EVENT_HANDLERS: "riktajs:queue:event:handlers";
|
|
14
|
+
};
|
|
15
|
+
/** DI token for the QueueProvider */
|
|
16
|
+
export declare const QUEUE_PROVIDER: unique symbol;
|
|
17
|
+
/** DI token for the QueueService */
|
|
18
|
+
export declare const QUEUE_SERVICE: unique symbol;
|
|
19
|
+
/** DI token for the Redis connection */
|
|
20
|
+
export declare const QUEUE_REDIS_CONNECTION: unique symbol;
|
|
21
|
+
/** DI token for the queue configuration */
|
|
22
|
+
export declare const QUEUE_CONFIG: unique symbol;
|
|
23
|
+
/**
|
|
24
|
+
* Get the DI token for a named queue
|
|
25
|
+
* @param name - The queue name
|
|
26
|
+
*/
|
|
27
|
+
export declare function getQueueToken(name: string): symbol;
|
|
28
|
+
/**
|
|
29
|
+
* Get the DI token for a named worker
|
|
30
|
+
* @param name - The queue name
|
|
31
|
+
*/
|
|
32
|
+
export declare function getWorkerToken(name: string): symbol;
|
|
33
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,eAAO,MAAM,YAAY;IACvB,oCAAoC;;IAEpC,wCAAwC;;IAExC,kCAAkC;;IAElC,oCAAoC;;CAE5B,CAAC;AAEX,qCAAqC;AACrC,eAAO,MAAM,cAAc,eAA+B,CAAC;AAE3D,oCAAoC;AACpC,eAAO,MAAM,aAAa,eAA8B,CAAC;AAEzD,wCAAwC;AACxC,eAAO,MAAM,sBAAsB,eAAuC,CAAC;AAE3E,2CAA2C;AAC3C,eAAO,MAAM,YAAY,eAA6B,CAAC;AAEvD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants and DI tokens for @riktajs/queue
|
|
3
|
+
*/
|
|
4
|
+
/** Metadata keys for decorator reflection */
|
|
5
|
+
export const METADATA_KEY = {
|
|
6
|
+
/** Queue class decorator options */
|
|
7
|
+
QUEUE_OPTIONS: 'riktajs:queue:options',
|
|
8
|
+
/** Processor class decorator options */
|
|
9
|
+
PROCESSOR_OPTIONS: 'riktajs:queue:processor:options',
|
|
10
|
+
/** Job handler method metadata */
|
|
11
|
+
JOB_HANDLERS: 'riktajs:queue:job:handlers',
|
|
12
|
+
/** Event handler method metadata */
|
|
13
|
+
EVENT_HANDLERS: 'riktajs:queue:event:handlers',
|
|
14
|
+
};
|
|
15
|
+
/** DI token for the QueueProvider */
|
|
16
|
+
export const QUEUE_PROVIDER = Symbol.for('QUEUE_PROVIDER');
|
|
17
|
+
/** DI token for the QueueService */
|
|
18
|
+
export const QUEUE_SERVICE = Symbol.for('QUEUE_SERVICE');
|
|
19
|
+
/** DI token for the Redis connection */
|
|
20
|
+
export const QUEUE_REDIS_CONNECTION = Symbol.for('QUEUE_REDIS_CONNECTION');
|
|
21
|
+
/** DI token for the queue configuration */
|
|
22
|
+
export const QUEUE_CONFIG = Symbol.for('QUEUE_CONFIG');
|
|
23
|
+
/**
|
|
24
|
+
* Get the DI token for a named queue
|
|
25
|
+
* @param name - The queue name
|
|
26
|
+
*/
|
|
27
|
+
export function getQueueToken(name) {
|
|
28
|
+
return Symbol.for(`QUEUE:${name}`);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the DI token for a named worker
|
|
32
|
+
* @param name - The queue name
|
|
33
|
+
*/
|
|
34
|
+
export function getWorkerToken(name) {
|
|
35
|
+
return Symbol.for(`WORKER:${name}`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,oCAAoC;IACpC,aAAa,EAAE,uBAAuB;IACtC,wCAAwC;IACxC,iBAAiB,EAAE,iCAAiC;IACpD,kCAAkC;IAClC,YAAY,EAAE,4BAA4B;IAC1C,oCAAoC;IACpC,cAAc,EAAE,8BAA8B;CACtC,CAAC;AAEX,qCAAqC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAE3D,oCAAoC;AACpC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAEzD,wCAAwC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAE3E,2CAA2C;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event decorators for job lifecycle events
|
|
3
|
+
*/
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import type { EventHandlerMeta, QueueEventName } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Decorator for handling job completion events
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* @Processor('my-queue')
|
|
12
|
+
* class MyProcessor {
|
|
13
|
+
* @OnJobComplete()
|
|
14
|
+
* async handleComplete(job: Job, result: unknown) {
|
|
15
|
+
* console.log(`Job ${job.id} completed with:`, result);
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function OnJobComplete(): MethodDecorator;
|
|
21
|
+
/**
|
|
22
|
+
* Decorator for handling job failure events
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* @Processor('my-queue')
|
|
27
|
+
* class MyProcessor {
|
|
28
|
+
* @OnJobFailed()
|
|
29
|
+
* async handleFailed(job: Job, error: Error) {
|
|
30
|
+
* console.error(`Job ${job.id} failed:`, error);
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function OnJobFailed(): MethodDecorator;
|
|
36
|
+
/**
|
|
37
|
+
* Decorator for handling job progress events
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* @Processor('my-queue')
|
|
42
|
+
* class MyProcessor {
|
|
43
|
+
* @OnJobProgress()
|
|
44
|
+
* async handleProgress(job: Job, progress: number | object) {
|
|
45
|
+
* console.log(`Job ${job.id} progress:`, progress);
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function OnJobProgress(): MethodDecorator;
|
|
51
|
+
/**
|
|
52
|
+
* Decorator for handling job stalled events
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* @Processor('my-queue')
|
|
57
|
+
* class MyProcessor {
|
|
58
|
+
* @OnJobStalled()
|
|
59
|
+
* async handleStalled(jobId: string) {
|
|
60
|
+
* console.warn(`Job ${jobId} stalled`);
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function OnJobStalled(): MethodDecorator;
|
|
66
|
+
/**
|
|
67
|
+
* Decorator for handling worker ready events
|
|
68
|
+
*/
|
|
69
|
+
export declare function OnWorkerReady(): MethodDecorator;
|
|
70
|
+
/**
|
|
71
|
+
* Decorator for handling worker error events
|
|
72
|
+
*/
|
|
73
|
+
export declare function OnWorkerError(): MethodDecorator;
|
|
74
|
+
/**
|
|
75
|
+
* Get all event handlers from a processor class
|
|
76
|
+
* @param target - The processor class
|
|
77
|
+
*/
|
|
78
|
+
export declare function getEventHandlers(target: Function): EventHandlerMeta[];
|
|
79
|
+
/**
|
|
80
|
+
* Get event handlers for a specific event
|
|
81
|
+
* @param target - The processor class
|
|
82
|
+
* @param event - The event name
|
|
83
|
+
*/
|
|
84
|
+
export declare function getEventHandlersFor(target: Function, event: QueueEventName): EventHandlerMeta[];
|
|
85
|
+
//# sourceMappingURL=events.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/events.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmCpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAE/C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,IAAI,eAAe,CAE7C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAE/C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,IAAI,eAAe,CAE9C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAE/C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAE/C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,EAAE,CAErE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,cAAc,GACpB,gBAAgB,EAAE,CAEpB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event decorators for job lifecycle events
|
|
3
|
+
*/
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import { METADATA_KEY } from '../constants.js';
|
|
6
|
+
/**
|
|
7
|
+
* Factory function to create event decorators
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
function createEventDecorator(event) {
|
|
11
|
+
return (target, propertyKey, _descriptor) => {
|
|
12
|
+
const methodName = String(propertyKey);
|
|
13
|
+
// Get existing handlers or create new array
|
|
14
|
+
const existingHandlers = Reflect.getMetadata(METADATA_KEY.EVENT_HANDLERS, target.constructor) || [];
|
|
15
|
+
// Add this handler
|
|
16
|
+
const handler = {
|
|
17
|
+
event,
|
|
18
|
+
methodName,
|
|
19
|
+
};
|
|
20
|
+
existingHandlers.push(handler);
|
|
21
|
+
// Store updated handlers
|
|
22
|
+
Reflect.defineMetadata(METADATA_KEY.EVENT_HANDLERS, existingHandlers, target.constructor);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Decorator for handling job completion events
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* @Processor('my-queue')
|
|
31
|
+
* class MyProcessor {
|
|
32
|
+
* @OnJobComplete()
|
|
33
|
+
* async handleComplete(job: Job, result: unknown) {
|
|
34
|
+
* console.log(`Job ${job.id} completed with:`, result);
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export function OnJobComplete() {
|
|
40
|
+
return createEventDecorator('job:completed');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Decorator for handling job failure events
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* @Processor('my-queue')
|
|
48
|
+
* class MyProcessor {
|
|
49
|
+
* @OnJobFailed()
|
|
50
|
+
* async handleFailed(job: Job, error: Error) {
|
|
51
|
+
* console.error(`Job ${job.id} failed:`, error);
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export function OnJobFailed() {
|
|
57
|
+
return createEventDecorator('job:failed');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Decorator for handling job progress events
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* @Processor('my-queue')
|
|
65
|
+
* class MyProcessor {
|
|
66
|
+
* @OnJobProgress()
|
|
67
|
+
* async handleProgress(job: Job, progress: number | object) {
|
|
68
|
+
* console.log(`Job ${job.id} progress:`, progress);
|
|
69
|
+
* }
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export function OnJobProgress() {
|
|
74
|
+
return createEventDecorator('job:progress');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Decorator for handling job stalled events
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* @Processor('my-queue')
|
|
82
|
+
* class MyProcessor {
|
|
83
|
+
* @OnJobStalled()
|
|
84
|
+
* async handleStalled(jobId: string) {
|
|
85
|
+
* console.warn(`Job ${jobId} stalled`);
|
|
86
|
+
* }
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export function OnJobStalled() {
|
|
91
|
+
return createEventDecorator('job:stalled');
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Decorator for handling worker ready events
|
|
95
|
+
*/
|
|
96
|
+
export function OnWorkerReady() {
|
|
97
|
+
return createEventDecorator('worker:ready');
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Decorator for handling worker error events
|
|
101
|
+
*/
|
|
102
|
+
export function OnWorkerError() {
|
|
103
|
+
return createEventDecorator('worker:error');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get all event handlers from a processor class
|
|
107
|
+
* @param target - The processor class
|
|
108
|
+
*/
|
|
109
|
+
export function getEventHandlers(target) {
|
|
110
|
+
return Reflect.getMetadata(METADATA_KEY.EVENT_HANDLERS, target) || [];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get event handlers for a specific event
|
|
114
|
+
* @param target - The processor class
|
|
115
|
+
* @param event - The event name
|
|
116
|
+
*/
|
|
117
|
+
export function getEventHandlersFor(target, event) {
|
|
118
|
+
return getEventHandlers(target).filter(h => h.event === event);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=events.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.decorator.js","sourceRoot":"","sources":["../../src/decorators/events.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;GAGG;AACH,SAAS,oBAAoB,CAAC,KAAqB;IACjD,OAAO,CACL,MAAc,EACd,WAA4B,EAC5B,WAA+B,EAC/B,EAAE;QACF,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;QAEvC,4CAA4C;QAC5C,MAAM,gBAAgB,GACpB,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAE7E,mBAAmB;QACnB,MAAM,OAAO,GAAqB;YAChC,KAAK;YACL,UAAU;SACX,CAAC;QAEF,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE/B,yBAAyB;QACzB,OAAO,CAAC,cAAc,CACpB,YAAY,CAAC,cAAc,EAC3B,gBAAgB,EAChB,MAAM,CAAC,WAAW,CACnB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,oBAAoB,CAAC,eAAe,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,oBAAoB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,oBAAoB,CAAC,aAAa,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAgB;IAC/C,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAgB,EAChB,KAAqB;IAErB,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Process decorator - marks a method as a job handler
|
|
3
|
+
*/
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import type { JobHandlerMeta } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Decorator to define a job handler method
|
|
8
|
+
*
|
|
9
|
+
* @param jobName - The name of the job to handle (default: method name)
|
|
10
|
+
* @returns MethodDecorator
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* @Processor('email-queue')
|
|
15
|
+
* class EmailProcessor {
|
|
16
|
+
* @Process('send')
|
|
17
|
+
* async handleSendEmail(job: Job<EmailData>) {
|
|
18
|
+
* await sendEmail(job.data);
|
|
19
|
+
* return { sent: true };
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* @Process() // Uses method name as job name
|
|
23
|
+
* async welcome(job: Job<WelcomeData>) {
|
|
24
|
+
* // ...
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function Process(jobName?: string): MethodDecorator;
|
|
30
|
+
/**
|
|
31
|
+
* Get all job handlers from a processor class
|
|
32
|
+
* @param target - The processor class
|
|
33
|
+
*/
|
|
34
|
+
export declare function getJobHandlers(target: Function): JobHandlerMeta[];
|
|
35
|
+
/**
|
|
36
|
+
* Check if a method is decorated with @Process
|
|
37
|
+
* @param target - The class
|
|
38
|
+
* @param methodName - The method name
|
|
39
|
+
*/
|
|
40
|
+
export declare function isJobHandler(target: Function, methodName: string): boolean;
|
|
41
|
+
//# sourceMappingURL=process.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/process.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CA4BzD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,cAAc,EAAE,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAG1E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Process decorator - marks a method as a job handler
|
|
3
|
+
*/
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import { METADATA_KEY } from '../constants.js';
|
|
6
|
+
/**
|
|
7
|
+
* Decorator to define a job handler method
|
|
8
|
+
*
|
|
9
|
+
* @param jobName - The name of the job to handle (default: method name)
|
|
10
|
+
* @returns MethodDecorator
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* @Processor('email-queue')
|
|
15
|
+
* class EmailProcessor {
|
|
16
|
+
* @Process('send')
|
|
17
|
+
* async handleSendEmail(job: Job<EmailData>) {
|
|
18
|
+
* await sendEmail(job.data);
|
|
19
|
+
* return { sent: true };
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* @Process() // Uses method name as job name
|
|
23
|
+
* async welcome(job: Job<WelcomeData>) {
|
|
24
|
+
* // ...
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function Process(jobName) {
|
|
30
|
+
return (target, propertyKey, _descriptor) => {
|
|
31
|
+
const methodName = String(propertyKey);
|
|
32
|
+
const name = jobName || methodName;
|
|
33
|
+
// Get existing handlers or create new array
|
|
34
|
+
const existingHandlers = Reflect.getMetadata(METADATA_KEY.JOB_HANDLERS, target.constructor) || [];
|
|
35
|
+
// Add this handler
|
|
36
|
+
const handler = {
|
|
37
|
+
name,
|
|
38
|
+
methodName,
|
|
39
|
+
};
|
|
40
|
+
existingHandlers.push(handler);
|
|
41
|
+
// Store updated handlers
|
|
42
|
+
Reflect.defineMetadata(METADATA_KEY.JOB_HANDLERS, existingHandlers, target.constructor);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get all job handlers from a processor class
|
|
47
|
+
* @param target - The processor class
|
|
48
|
+
*/
|
|
49
|
+
export function getJobHandlers(target) {
|
|
50
|
+
return Reflect.getMetadata(METADATA_KEY.JOB_HANDLERS, target) || [];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if a method is decorated with @Process
|
|
54
|
+
* @param target - The class
|
|
55
|
+
* @param methodName - The method name
|
|
56
|
+
*/
|
|
57
|
+
export function isJobHandler(target, methodName) {
|
|
58
|
+
const handlers = getJobHandlers(target);
|
|
59
|
+
return handlers.some(h => h.methodName === methodName);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=process.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.decorator.js","sourceRoot":"","sources":["../../src/decorators/process.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB;IACtC,OAAO,CACL,MAAc,EACd,WAA4B,EAC5B,WAA+B,EAC/B,EAAE;QACF,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,OAAO,IAAI,UAAU,CAAC;QAEnC,4CAA4C;QAC5C,MAAM,gBAAgB,GACpB,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAE3E,mBAAmB;QACnB,MAAM,OAAO,GAAmB;YAC9B,IAAI;YACJ,UAAU;SACX,CAAC;QAEF,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE/B,yBAAyB;QACzB,OAAO,CAAC,cAAc,CACpB,YAAY,CAAC,YAAY,EACzB,gBAAgB,EAChB,MAAM,CAAC,WAAW,CACnB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAgB;IAC7C,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAgB,EAAE,UAAkB;IAC/D,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Processor decorator - marks a class as a job processor
|
|
3
|
+
*/
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import type { ProcessorOptions } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Decorator to define a job processor for a queue
|
|
8
|
+
*
|
|
9
|
+
* @param queueName - The name of the queue to process
|
|
10
|
+
* @param options - Optional processor configuration
|
|
11
|
+
* @returns ClassDecorator
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* @Processor('email-queue', { concurrency: 5 })
|
|
16
|
+
* class EmailProcessor {
|
|
17
|
+
* @Process('send')
|
|
18
|
+
* async handleSendEmail(job: Job) {
|
|
19
|
+
* // process job
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function Processor(queueName: string, options?: Omit<ProcessorOptions, 'queueName'>): ClassDecorator;
|
|
25
|
+
/**
|
|
26
|
+
* Get processor options from a decorated class
|
|
27
|
+
* @param target - The decorated class
|
|
28
|
+
*/
|
|
29
|
+
export declare function getProcessorOptions(target: Function): ProcessorOptions | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Check if a class is decorated with @Processor
|
|
32
|
+
* @param target - The class to check
|
|
33
|
+
*/
|
|
34
|
+
export declare function isProcessor(target: Function): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Error thrown when @Processor decorator is used incorrectly
|
|
37
|
+
*/
|
|
38
|
+
export declare class ProcessorDecoratorError extends Error {
|
|
39
|
+
constructor(message: string);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=processor.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processor.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/processor.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAC5C,cAAc,CAahB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAElF;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAErD;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Processor decorator - marks a class as a job processor
|
|
3
|
+
*/
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import { METADATA_KEY } from '../constants.js';
|
|
6
|
+
/**
|
|
7
|
+
* Decorator to define a job processor for a queue
|
|
8
|
+
*
|
|
9
|
+
* @param queueName - The name of the queue to process
|
|
10
|
+
* @param options - Optional processor configuration
|
|
11
|
+
* @returns ClassDecorator
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* @Processor('email-queue', { concurrency: 5 })
|
|
16
|
+
* class EmailProcessor {
|
|
17
|
+
* @Process('send')
|
|
18
|
+
* async handleSendEmail(job: Job) {
|
|
19
|
+
* // process job
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function Processor(queueName, options) {
|
|
25
|
+
if (!queueName) {
|
|
26
|
+
throw new ProcessorDecoratorError('Queue name is required for @Processor');
|
|
27
|
+
}
|
|
28
|
+
const processorOptions = {
|
|
29
|
+
queueName,
|
|
30
|
+
...options,
|
|
31
|
+
};
|
|
32
|
+
return (target) => {
|
|
33
|
+
Reflect.defineMetadata(METADATA_KEY.PROCESSOR_OPTIONS, processorOptions, target);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get processor options from a decorated class
|
|
38
|
+
* @param target - The decorated class
|
|
39
|
+
*/
|
|
40
|
+
export function getProcessorOptions(target) {
|
|
41
|
+
return Reflect.getMetadata(METADATA_KEY.PROCESSOR_OPTIONS, target);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if a class is decorated with @Processor
|
|
45
|
+
* @param target - The class to check
|
|
46
|
+
*/
|
|
47
|
+
export function isProcessor(target) {
|
|
48
|
+
return Reflect.hasMetadata(METADATA_KEY.PROCESSOR_OPTIONS, target);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Error thrown when @Processor decorator is used incorrectly
|
|
52
|
+
*/
|
|
53
|
+
export class ProcessorDecoratorError extends Error {
|
|
54
|
+
constructor(message) {
|
|
55
|
+
super(message);
|
|
56
|
+
this.name = 'ProcessorDecoratorError';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=processor.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processor.decorator.js","sourceRoot":"","sources":["../../src/decorators/processor.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,SAAS,CACvB,SAAiB,EACjB,OAA6C;IAE7C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,uBAAuB,CAAC,uCAAuC,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,gBAAgB,GAAqB;QACzC,SAAS;QACT,GAAG,OAAO;KACX,CAAC;IAEF,OAAO,CAAC,MAAgB,EAAE,EAAE;QAC1B,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAgB;IAClD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAAgB;IAC1C,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Queue decorator - marks a class as a queue definition
|
|
3
|
+
*/
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import type { QueueDecoratorOptions } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Decorator to define a queue
|
|
8
|
+
*
|
|
9
|
+
* @param options - Queue configuration options
|
|
10
|
+
* @returns ClassDecorator
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* @Queue({ name: 'email-queue' })
|
|
15
|
+
* class EmailQueue {}
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function Queue(options: QueueDecoratorOptions): ClassDecorator;
|
|
19
|
+
/**
|
|
20
|
+
* Get queue options from a decorated class
|
|
21
|
+
* @param target - The decorated class
|
|
22
|
+
*/
|
|
23
|
+
export declare function getQueueOptions(target: Function): QueueDecoratorOptions | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Check if a class is decorated with @Queue
|
|
26
|
+
* @param target - The class to check
|
|
27
|
+
*/
|
|
28
|
+
export declare function isQueue(target: Function): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown when @Queue decorator is used incorrectly
|
|
31
|
+
*/
|
|
32
|
+
export declare class QueueDecoratorError extends Error {
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=queue.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/queue.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAQpE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,qBAAqB,GAAG,SAAS,CAEnF;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Queue decorator - marks a class as a queue definition
|
|
3
|
+
*/
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import { METADATA_KEY } from '../constants.js';
|
|
6
|
+
/**
|
|
7
|
+
* Decorator to define a queue
|
|
8
|
+
*
|
|
9
|
+
* @param options - Queue configuration options
|
|
10
|
+
* @returns ClassDecorator
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* @Queue({ name: 'email-queue' })
|
|
15
|
+
* class EmailQueue {}
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function Queue(options) {
|
|
19
|
+
if (!options.name) {
|
|
20
|
+
throw new QueueDecoratorError('Queue name is required');
|
|
21
|
+
}
|
|
22
|
+
return (target) => {
|
|
23
|
+
Reflect.defineMetadata(METADATA_KEY.QUEUE_OPTIONS, options, target);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get queue options from a decorated class
|
|
28
|
+
* @param target - The decorated class
|
|
29
|
+
*/
|
|
30
|
+
export function getQueueOptions(target) {
|
|
31
|
+
return Reflect.getMetadata(METADATA_KEY.QUEUE_OPTIONS, target);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Check if a class is decorated with @Queue
|
|
35
|
+
* @param target - The class to check
|
|
36
|
+
*/
|
|
37
|
+
export function isQueue(target) {
|
|
38
|
+
return Reflect.hasMetadata(METADATA_KEY.QUEUE_OPTIONS, target);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Error thrown when @Queue decorator is used incorrectly
|
|
42
|
+
*/
|
|
43
|
+
export class QueueDecoratorError extends Error {
|
|
44
|
+
constructor(message) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.name = 'QueueDecoratorError';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=queue.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.decorator.js","sourceRoot":"","sources":["../../src/decorators/queue.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,KAAK,CAAC,OAA8B;IAClD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,mBAAmB,CAAC,wBAAwB,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,CAAC,MAAgB,EAAE,EAAE;QAC1B,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAgB;IAC9C,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,MAAgB;IACtC,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue events integration with Rikta's EventBus
|
|
3
|
+
*/
|
|
4
|
+
/** Event names for queue events */
|
|
5
|
+
export type QueueEventName = 'job:added' | 'job:completed' | 'job:failed' | 'job:progress' | 'job:stalled' | 'job:delayed' | 'job:removed' | 'worker:ready' | 'worker:closed' | 'worker:error';
|
|
6
|
+
/** Event bus event names with prefix */
|
|
7
|
+
export declare const QUEUE_EVENTS: {
|
|
8
|
+
readonly JOB_ADDED: "queue:job:added";
|
|
9
|
+
readonly JOB_COMPLETED: "queue:job:completed";
|
|
10
|
+
readonly JOB_FAILED: "queue:job:failed";
|
|
11
|
+
readonly JOB_PROGRESS: "queue:job:progress";
|
|
12
|
+
readonly JOB_STALLED: "queue:job:stalled";
|
|
13
|
+
readonly JOB_DELAYED: "queue:job:delayed";
|
|
14
|
+
readonly JOB_REMOVED: "queue:job:removed";
|
|
15
|
+
readonly WORKER_READY: "queue:worker:ready";
|
|
16
|
+
readonly WORKER_CLOSED: "queue:worker:closed";
|
|
17
|
+
readonly WORKER_ERROR: "queue:worker:error";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Map internal event names to EventBus event names
|
|
21
|
+
*/
|
|
22
|
+
export declare function getEventBusEventName(event: QueueEventName): string;
|
|
23
|
+
/**
|
|
24
|
+
* Publish a queue event to the EventBus
|
|
25
|
+
*
|
|
26
|
+
* @param eventBus - Rikta's EventBus instance
|
|
27
|
+
* @param event - The event name
|
|
28
|
+
* @param queueName - The queue name
|
|
29
|
+
* @param args - Event arguments (job, result, error, etc.)
|
|
30
|
+
*/
|
|
31
|
+
export declare function publishQueueEvent(eventBus: unknown, event: QueueEventName, queueName: string, ...args: unknown[]): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=queue-events.d.ts.map
|