@anchan828/nest-cloud-run-queue-worker 1.0.6 → 1.0.9
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/decorators.d.ts +1 -0
- package/dist/decorators.js +5 -10
- package/dist/explorer.service.js +9 -7
- package/dist/interfaces.d.ts +4 -2
- package/package.json +4 -4
package/dist/decorators.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { QueueWorkerName } from "@anchan828/nest-cloud-run-queue-common";
|
|
|
8
8
|
* @returns {ClassDecorator}
|
|
9
9
|
*/
|
|
10
10
|
export declare function QueueWorker(name: QueueWorkerName, priority?: number): ClassDecorator;
|
|
11
|
+
export declare function QueueWorker(names: QueueWorkerName[], priority?: number): ClassDecorator;
|
|
11
12
|
/**
|
|
12
13
|
* Define worker processor
|
|
13
14
|
*
|
package/dist/decorators.js
CHANGED
|
@@ -3,16 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.QueueWorkerProcess = exports.QueueWorker = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @param {number} [priority=0] Highest priority is 0, and lower the larger integer you use.
|
|
12
|
-
* @returns {ClassDecorator}
|
|
13
|
-
*/
|
|
14
|
-
function QueueWorker(name, priority = 0) {
|
|
15
|
-
return (0, common_1.SetMetadata)(constants_1.QUEUE_WORKER_DECORATOR, { name, priority });
|
|
6
|
+
function QueueWorker(names, priority = 0) {
|
|
7
|
+
return (0, common_1.SetMetadata)(constants_1.QUEUE_WORKER_DECORATOR, {
|
|
8
|
+
names: Array.isArray(names) ? names : [names],
|
|
9
|
+
priority,
|
|
10
|
+
});
|
|
16
11
|
}
|
|
17
12
|
exports.QueueWorker = QueueWorker;
|
|
18
13
|
/**
|
package/dist/explorer.service.js
CHANGED
|
@@ -32,13 +32,15 @@ let QueueWorkerExplorerService = class QueueWorkerExplorerService {
|
|
|
32
32
|
.getProviders()
|
|
33
33
|
.filter((instanceWrapper) => { var _a; return (_a = instanceWrapper.instance) === null || _a === void 0 ? void 0 : _a.constructor; })) {
|
|
34
34
|
const args = Reflect.getMetadata(constants_1.QUEUE_WORKER_DECORATOR, classInstanceWrapper.instance.constructor);
|
|
35
|
-
if (args) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
if (args && Array.isArray(args.names)) {
|
|
36
|
+
for (const name of args.names) {
|
|
37
|
+
metadata.push({
|
|
38
|
+
instance: classInstanceWrapper.instance,
|
|
39
|
+
name,
|
|
40
|
+
priority: args.priority || 0,
|
|
41
|
+
processors: [],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
return metadata;
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -35,9 +35,11 @@ export interface QueueWorkerModuleOptions extends ModuleOptions {
|
|
|
35
35
|
export declare type QueueWorkerModuleAsyncOptions = ModuleAsyncOptions<Omit<QueueWorkerModuleOptions, "workerController">> & Pick<QueueWorkerModuleOptions, "workerController">;
|
|
36
36
|
export declare type QueueWorkerModuleOptionsFactory = ModuleOptionsFactory<Omit<QueueWorkerModuleOptions, "workerController">> & Pick<QueueWorkerModuleOptions, "workerController">;
|
|
37
37
|
export declare type QueueWorkerProcessor = <T>(message: T, rawMessage: QueueWorkerRawMessage) => Promise<void> | void;
|
|
38
|
-
export interface QueueWorkerMetadata
|
|
38
|
+
export interface QueueWorkerMetadata {
|
|
39
39
|
instance: Injectable;
|
|
40
40
|
processors: QueueWorkerProcessorMetadata[];
|
|
41
|
+
name: QueueWorkerName;
|
|
42
|
+
priority: number;
|
|
41
43
|
}
|
|
42
44
|
export interface QueueWorkerProcessorMetadata extends QueueWorkerProcessDecoratorArgs {
|
|
43
45
|
processor: QueueWorkerProcessor;
|
|
@@ -51,7 +53,7 @@ export declare type QueueWorkerExtraConfig = {
|
|
|
51
53
|
postProcessor?: (name: string, ...args: Parameters<QueueWorkerProcessor>) => void | Promise<void>;
|
|
52
54
|
};
|
|
53
55
|
export interface QueueWorkerDecoratorArgs {
|
|
54
|
-
|
|
56
|
+
names: QueueWorkerName[];
|
|
55
57
|
/**
|
|
56
58
|
* Highest priority is 0, and lower the larger integer you use.
|
|
57
59
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anchan828/nest-cloud-run-queue-worker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "https://github.com/anchan828/nest-cloud-run-queue/tree/master/packages/worker#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"watch": "tsc -w"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@anchan828/nest-cloud-run-queue-common": "^1.0.
|
|
36
|
+
"@anchan828/nest-cloud-run-queue-common": "^1.0.9",
|
|
37
37
|
"class-validator": "0.13.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@nestjs/common": "8.4.
|
|
40
|
+
"@nestjs/common": "8.4.5",
|
|
41
41
|
"rxjs": "7.5.5"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "990587e24aa5c8e83a3c9334f66b4f71c522b99a"
|
|
50
50
|
}
|