@jsnw/nestjs-rabbitmq 2.0.0 → 2.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/lib/rabbitmq-core.module.js +86 -111
- package/dist/lib/rabbitmq-explorer.service.js +79 -110
- package/dist/lib/rabbitmq.module.js +41 -80
- package/package.json +1 -1
|
@@ -1,122 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var _, done = false;
|
|
8
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
-
var context = {};
|
|
10
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
-
done = true;
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
28
7
|
};
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
-
}
|
|
34
|
-
return useValue ? value : void 0;
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35
10
|
};
|
|
11
|
+
var RabbitmqCoreModule_1;
|
|
36
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
13
|
exports.RabbitmqCoreModule = void 0;
|
|
38
14
|
const common_1 = require("@nestjs/common");
|
|
15
|
+
const core_1 = require("@nestjs/core");
|
|
39
16
|
const rabbitmq_1 = require("./rabbitmq");
|
|
40
17
|
const rabbitmq_consts_1 = require("./rabbitmq.consts");
|
|
41
18
|
const rabbitmq_storage_1 = require("./rabbitmq.storage");
|
|
42
19
|
const rabbitmq_explorer_service_1 = require("./rabbitmq-explorer.service");
|
|
43
|
-
let RabbitmqCoreModule =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @param {Rabbitmq} rabbit
|
|
109
|
-
*/
|
|
110
|
-
constructor(rabbit) {
|
|
111
|
-
this.rabbit = rabbit;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @return {Promise<void>}
|
|
115
|
-
*/
|
|
116
|
-
async onApplicationShutdown() {
|
|
117
|
-
await this.rabbit.close();
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
return RabbitmqCoreModule = _classThis;
|
|
121
|
-
})();
|
|
20
|
+
let RabbitmqCoreModule = RabbitmqCoreModule_1 = class RabbitmqCoreModule {
|
|
21
|
+
rabbit;
|
|
22
|
+
/**
|
|
23
|
+
* @param {RabbitmqOptions} options
|
|
24
|
+
* @return {DynamicModule}
|
|
25
|
+
*/
|
|
26
|
+
static forRoot(options) {
|
|
27
|
+
const optionsProvider = this.createOptionsProvider(options), rabbitmqProvider = this.createRabbitmqProvider();
|
|
28
|
+
return {
|
|
29
|
+
module: RabbitmqCoreModule_1,
|
|
30
|
+
imports: [],
|
|
31
|
+
providers: [
|
|
32
|
+
optionsProvider,
|
|
33
|
+
rabbitmqProvider
|
|
34
|
+
],
|
|
35
|
+
exports: [
|
|
36
|
+
rabbitmqProvider
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param {RabbitmqOptions} options
|
|
42
|
+
* @return {ValueProvider}
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
static createOptionsProvider(options) {
|
|
46
|
+
return {
|
|
47
|
+
provide: rabbitmq_consts_1.RABBITMQ_OPTIONS_TOKEN,
|
|
48
|
+
useValue: options
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @return {FactoryProvider}
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
static createRabbitmqProvider() {
|
|
56
|
+
return {
|
|
57
|
+
provide: rabbitmq_1.Rabbitmq,
|
|
58
|
+
useFactory: (options) => {
|
|
59
|
+
const rabbitmq = new rabbitmq_1.Rabbitmq(options);
|
|
60
|
+
if (options.exchanges && options.exchanges.length > 0)
|
|
61
|
+
rabbitmq_storage_1.RabbitmqStorage.addExchanges(options.exchanges);
|
|
62
|
+
if (options.queues && options.queues.length > 0)
|
|
63
|
+
rabbitmq_storage_1.RabbitmqStorage.addQueues(options.queues);
|
|
64
|
+
return rabbitmq;
|
|
65
|
+
},
|
|
66
|
+
inject: [
|
|
67
|
+
rabbitmq_consts_1.RABBITMQ_OPTIONS_TOKEN
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @param {Rabbitmq} rabbit
|
|
73
|
+
*/
|
|
74
|
+
constructor(rabbit) {
|
|
75
|
+
this.rabbit = rabbit;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @return {Promise<void>}
|
|
79
|
+
*/
|
|
80
|
+
async onApplicationShutdown() {
|
|
81
|
+
await this.rabbit.close();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
122
84
|
exports.RabbitmqCoreModule = RabbitmqCoreModule;
|
|
85
|
+
exports.RabbitmqCoreModule = RabbitmqCoreModule = RabbitmqCoreModule_1 = __decorate([
|
|
86
|
+
(0, common_1.Global)(),
|
|
87
|
+
(0, common_1.Module)({
|
|
88
|
+
imports: [
|
|
89
|
+
core_1.DiscoveryModule
|
|
90
|
+
],
|
|
91
|
+
providers: [
|
|
92
|
+
core_1.Reflector,
|
|
93
|
+
rabbitmq_explorer_service_1.RabbitmqExplorerService
|
|
94
|
+
]
|
|
95
|
+
}),
|
|
96
|
+
__metadata("design:paramtypes", [rabbitmq_1.Rabbitmq])
|
|
97
|
+
], RabbitmqCoreModule);
|
|
@@ -1,120 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var _, done = false;
|
|
8
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
-
var context = {};
|
|
10
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
-
done = true;
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
28
7
|
};
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
-
}
|
|
34
|
-
return useValue ? value : void 0;
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35
10
|
};
|
|
36
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
12
|
exports.RabbitmqExplorerService = void 0;
|
|
38
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@nestjs/core");
|
|
15
|
+
const rabbitmq_1 = require("./rabbitmq");
|
|
39
16
|
const rabbitmq_storage_1 = require("./rabbitmq.storage");
|
|
40
17
|
const rabbitmq_consts_1 = require("./rabbitmq.consts");
|
|
41
|
-
let RabbitmqExplorerService =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
...this.discoveryService.getProviders(),
|
|
90
|
-
...this.discoveryService.getControllers()
|
|
91
|
-
];
|
|
92
|
-
for (const wrapper of wrappers) {
|
|
93
|
-
const { instance } = wrapper;
|
|
94
|
-
if (!instance || typeof instance !== 'object')
|
|
95
|
-
continue;
|
|
96
|
-
const prototype = Object.getPrototypeOf(instance);
|
|
97
|
-
if (!prototype)
|
|
98
|
-
continue;
|
|
99
|
-
const methodNames = this.metadataScanner.getAllMethodNames(prototype);
|
|
100
|
-
for (const methodName of methodNames)
|
|
101
|
-
await this.registerIfSubscriber(instance, methodName);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* @param {any} instance
|
|
106
|
-
* @param {string} methodName
|
|
107
|
-
* @return {Promise<void>}
|
|
108
|
-
* @private
|
|
109
|
-
*/
|
|
110
|
-
async registerIfSubscriber(instance, methodName) {
|
|
111
|
-
const methodRef = instance[methodName];
|
|
112
|
-
const metadata = this.reflector.get(rabbitmq_consts_1.RABBITMQ_SUBSCRIPTION_METADATA, methodRef);
|
|
113
|
-
if (!metadata)
|
|
114
|
-
return;
|
|
115
|
-
await this.rabbitmq.subscribe(metadata, { instance, methodName });
|
|
18
|
+
let RabbitmqExplorerService = class RabbitmqExplorerService {
|
|
19
|
+
discoveryService;
|
|
20
|
+
metadataScanner;
|
|
21
|
+
reflector;
|
|
22
|
+
rabbitmq;
|
|
23
|
+
constructor(discoveryService, metadataScanner, reflector, rabbitmq) {
|
|
24
|
+
this.discoveryService = discoveryService;
|
|
25
|
+
this.metadataScanner = metadataScanner;
|
|
26
|
+
this.reflector = reflector;
|
|
27
|
+
this.rabbitmq = rabbitmq;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @return {Promise<void>}
|
|
31
|
+
*/
|
|
32
|
+
async onApplicationBootstrap() {
|
|
33
|
+
await this.setupInfrastructure();
|
|
34
|
+
await this.discoverSubscribers();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @return {Promise<void>}
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
async setupInfrastructure() {
|
|
41
|
+
const exchanges = rabbitmq_storage_1.RabbitmqStorage.getExchanges(), queues = rabbitmq_storage_1.RabbitmqStorage.getQueues();
|
|
42
|
+
if (exchanges.length > 0)
|
|
43
|
+
await Promise.all(exchanges.map(exchange => this.rabbitmq.declareExchange(exchange)));
|
|
44
|
+
if (queues.length > 0)
|
|
45
|
+
await Promise.all(queues.map(queue => this.rabbitmq.declareQueue(queue)));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @return {Promise<void>}
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
async discoverSubscribers() {
|
|
52
|
+
const wrappers = [
|
|
53
|
+
...this.discoveryService.getProviders(),
|
|
54
|
+
...this.discoveryService.getControllers()
|
|
55
|
+
];
|
|
56
|
+
for (const wrapper of wrappers) {
|
|
57
|
+
const { instance } = wrapper;
|
|
58
|
+
if (!instance || typeof instance !== 'object')
|
|
59
|
+
continue;
|
|
60
|
+
const prototype = Object.getPrototypeOf(instance);
|
|
61
|
+
if (!prototype)
|
|
62
|
+
continue;
|
|
63
|
+
const methodNames = this.metadataScanner.getAllMethodNames(prototype);
|
|
64
|
+
for (const methodName of methodNames)
|
|
65
|
+
await this.registerIfSubscriber(instance, methodName);
|
|
116
66
|
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @param {any} instance
|
|
70
|
+
* @param {string} methodName
|
|
71
|
+
* @return {Promise<void>}
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
async registerIfSubscriber(instance, methodName) {
|
|
75
|
+
const methodRef = instance[methodName];
|
|
76
|
+
const metadata = this.reflector.get(rabbitmq_consts_1.RABBITMQ_SUBSCRIPTION_METADATA, methodRef);
|
|
77
|
+
if (!metadata)
|
|
78
|
+
return;
|
|
79
|
+
await this.rabbitmq.subscribe(metadata, { instance, methodName });
|
|
80
|
+
}
|
|
81
|
+
};
|
|
120
82
|
exports.RabbitmqExplorerService = RabbitmqExplorerService;
|
|
83
|
+
exports.RabbitmqExplorerService = RabbitmqExplorerService = __decorate([
|
|
84
|
+
(0, common_1.Injectable)(),
|
|
85
|
+
__metadata("design:paramtypes", [core_1.DiscoveryService,
|
|
86
|
+
core_1.MetadataScanner,
|
|
87
|
+
core_1.Reflector,
|
|
88
|
+
rabbitmq_1.Rabbitmq])
|
|
89
|
+
], RabbitmqExplorerService);
|
|
@@ -1,89 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var _, done = false;
|
|
8
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
-
var context = {};
|
|
10
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
-
done = true;
|
|
28
|
-
};
|
|
29
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
-
var useValue = arguments.length > 2;
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
-
}
|
|
34
|
-
return useValue ? value : void 0;
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35
7
|
};
|
|
8
|
+
var RabbitmqModule_1;
|
|
36
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
10
|
exports.RabbitmqModule = void 0;
|
|
38
11
|
const common_1 = require("@nestjs/common");
|
|
39
12
|
const rabbitmq_core_module_1 = require("./rabbitmq-core.module");
|
|
40
13
|
const rabbitmq_storage_1 = require("./rabbitmq.storage");
|
|
41
|
-
let RabbitmqModule =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @param {(RabbitmqExchange | RabbitmqQueue)[] | {exchanges?: RabbitmqExchange[], queues?: RabbitmqQueue[]}} declarations
|
|
69
|
-
* @return {DynamicModule}
|
|
70
|
-
*/
|
|
71
|
-
static forFeature(declarations) {
|
|
72
|
-
if (declarations) {
|
|
73
|
-
if (Array.isArray(declarations) && declarations.length > 0)
|
|
74
|
-
rabbitmq_storage_1.RabbitmqStorage.addAny(declarations);
|
|
75
|
-
if ('exchanges' in declarations && Array.isArray(declarations.exchanges) && declarations.exchanges.length > 0)
|
|
76
|
-
rabbitmq_storage_1.RabbitmqStorage.addExchanges(declarations.exchanges);
|
|
77
|
-
if ('queues' in declarations && Array.isArray(declarations.queues) && declarations.queues.length > 0)
|
|
78
|
-
rabbitmq_storage_1.RabbitmqStorage.addQueues(declarations.queues);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
module: RabbitmqModule,
|
|
82
|
-
providers: [],
|
|
83
|
-
exports: []
|
|
84
|
-
};
|
|
14
|
+
let RabbitmqModule = RabbitmqModule_1 = class RabbitmqModule {
|
|
15
|
+
/**
|
|
16
|
+
* @param {RabbitmqOptions} options
|
|
17
|
+
* @return {DynamicModule}
|
|
18
|
+
*/
|
|
19
|
+
static forRoot(options) {
|
|
20
|
+
return {
|
|
21
|
+
module: RabbitmqModule_1,
|
|
22
|
+
imports: [
|
|
23
|
+
rabbitmq_core_module_1.RabbitmqCoreModule.forRoot(options)
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @param {(RabbitmqExchange | RabbitmqQueue)[] | {exchanges?: RabbitmqExchange[], queues?: RabbitmqQueue[]}} declarations
|
|
29
|
+
* @return {DynamicModule}
|
|
30
|
+
*/
|
|
31
|
+
static forFeature(declarations) {
|
|
32
|
+
if (declarations) {
|
|
33
|
+
if (Array.isArray(declarations) && declarations.length > 0)
|
|
34
|
+
rabbitmq_storage_1.RabbitmqStorage.addAny(declarations);
|
|
35
|
+
if ('exchanges' in declarations && Array.isArray(declarations.exchanges) && declarations.exchanges.length > 0)
|
|
36
|
+
rabbitmq_storage_1.RabbitmqStorage.addExchanges(declarations.exchanges);
|
|
37
|
+
if ('queues' in declarations && Array.isArray(declarations.queues) && declarations.queues.length > 0)
|
|
38
|
+
rabbitmq_storage_1.RabbitmqStorage.addQueues(declarations.queues);
|
|
85
39
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
40
|
+
return {
|
|
41
|
+
module: RabbitmqModule_1,
|
|
42
|
+
providers: [],
|
|
43
|
+
exports: []
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
89
47
|
exports.RabbitmqModule = RabbitmqModule;
|
|
48
|
+
exports.RabbitmqModule = RabbitmqModule = RabbitmqModule_1 = __decorate([
|
|
49
|
+
(0, common_1.Module)({})
|
|
50
|
+
], RabbitmqModule);
|