@midwayjs/rabbitmq 3.5.3 → 3.7.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/dist/configuration.js +3 -3
- package/dist/framework.d.ts +1 -2
- package/dist/framework.js +12 -7
- package/dist/interface.d.ts +1 -2
- package/dist/mq.d.ts +1 -1
- package/package.json +5 -6
package/dist/configuration.js
CHANGED
|
@@ -10,17 +10,17 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.RabbitMQConfiguration = void 0;
|
|
13
|
-
const
|
|
13
|
+
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const framework_1 = require("./framework");
|
|
15
15
|
let RabbitMQConfiguration = class RabbitMQConfiguration {
|
|
16
16
|
async onReady() { }
|
|
17
17
|
};
|
|
18
18
|
__decorate([
|
|
19
|
-
(0,
|
|
19
|
+
(0, core_1.Inject)(),
|
|
20
20
|
__metadata("design:type", framework_1.MidwayRabbitMQFramework)
|
|
21
21
|
], RabbitMQConfiguration.prototype, "framework", void 0);
|
|
22
22
|
RabbitMQConfiguration = __decorate([
|
|
23
|
-
(0,
|
|
23
|
+
(0, core_1.Configuration)({
|
|
24
24
|
namespace: 'rabbitMQ',
|
|
25
25
|
importConfigs: [
|
|
26
26
|
{
|
package/dist/framework.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MidwayFrameworkType } from '@midwayjs/
|
|
2
|
-
import { BaseFramework } from '@midwayjs/core';
|
|
1
|
+
import { MidwayFrameworkType, BaseFramework } from '@midwayjs/core';
|
|
3
2
|
import { IMidwayRabbitMQApplication, IMidwayRabbitMQConfigurationOptions, IMidwayRabbitMQContext } from './interface';
|
|
4
3
|
export declare class MidwayRabbitMQFramework extends BaseFramework<IMidwayRabbitMQApplication, IMidwayRabbitMQContext, IMidwayRabbitMQConfigurationOptions> {
|
|
5
4
|
app: IMidwayRabbitMQApplication;
|
package/dist/framework.js
CHANGED
|
@@ -7,7 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.MidwayRabbitMQFramework = void 0;
|
|
10
|
-
const decorator_1 = require("@midwayjs/decorator");
|
|
11
10
|
const core_1 = require("@midwayjs/core");
|
|
12
11
|
const mq_1 = require("./mq");
|
|
13
12
|
let MidwayRabbitMQFramework = class MidwayRabbitMQFramework extends core_1.BaseFramework {
|
|
@@ -41,16 +40,16 @@ let MidwayRabbitMQFramework = class MidwayRabbitMQFramework extends core_1.BaseF
|
|
|
41
40
|
await this.app.close();
|
|
42
41
|
}
|
|
43
42
|
getFrameworkType() {
|
|
44
|
-
return
|
|
43
|
+
return core_1.MidwayFrameworkType.MS_RABBITMQ;
|
|
45
44
|
}
|
|
46
45
|
async loadSubscriber() {
|
|
47
46
|
// create channel
|
|
48
|
-
const subscriberModules = (0,
|
|
49
|
-
const metadata = (0,
|
|
50
|
-
return metadata.type ===
|
|
47
|
+
const subscriberModules = (0, core_1.listModule)(core_1.MS_CONSUMER_KEY, module => {
|
|
48
|
+
const metadata = (0, core_1.getClassMetadata)(core_1.MS_CONSUMER_KEY, module);
|
|
49
|
+
return metadata.type === core_1.MSListenerType.RABBITMQ;
|
|
51
50
|
});
|
|
52
51
|
for (const module of subscriberModules) {
|
|
53
|
-
const data = (0,
|
|
52
|
+
const data = (0, core_1.listPropertyDataFromClass)(core_1.MS_CONSUMER_KEY, module);
|
|
54
53
|
for (const methodBindListeners of data) {
|
|
55
54
|
// 循环绑定的方法和监听的配置信息
|
|
56
55
|
for (const listenerOptions of methodBindListeners) {
|
|
@@ -63,6 +62,12 @@ let MidwayRabbitMQFramework = class MidwayRabbitMQFramework extends core_1.BaseF
|
|
|
63
62
|
},
|
|
64
63
|
};
|
|
65
64
|
this.app.createAnonymousContext(ctx);
|
|
65
|
+
const isPassed = await this.app
|
|
66
|
+
.getFramework()
|
|
67
|
+
.runGuard(ctx, module, listenerOptions.propertyKey);
|
|
68
|
+
if (!isPassed) {
|
|
69
|
+
throw new core_1.MidwayInvokeForbiddenError(listenerOptions.propertyKey, module);
|
|
70
|
+
}
|
|
66
71
|
const ins = await ctx.requestContext.getAsync(module);
|
|
67
72
|
const fn = await this.applyMiddleware(async (ctx) => {
|
|
68
73
|
return await ins[listenerOptions.propertyKey].call(ins, data);
|
|
@@ -86,7 +91,7 @@ let MidwayRabbitMQFramework = class MidwayRabbitMQFramework extends core_1.BaseF
|
|
|
86
91
|
}
|
|
87
92
|
};
|
|
88
93
|
MidwayRabbitMQFramework = __decorate([
|
|
89
|
-
(0,
|
|
94
|
+
(0, core_1.Framework)()
|
|
90
95
|
], MidwayRabbitMQFramework);
|
|
91
96
|
exports.MidwayRabbitMQFramework = MidwayRabbitMQFramework;
|
|
92
97
|
//# sourceMappingURL=framework.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IConfigurationOptions, IMidwayApplication, IMidwayContext, NextFunction as BaseNextFunction } from '@midwayjs/core';
|
|
1
|
+
import { IConfigurationOptions, IMidwayApplication, IMidwayContext, NextFunction as BaseNextFunction, RabbitMQListenerOptions } from '@midwayjs/core';
|
|
2
2
|
import { ConsumeMessage, Options } from 'amqplib/properties';
|
|
3
|
-
import { RabbitMQListenerOptions } from '@midwayjs/decorator';
|
|
4
3
|
import type { ConfirmChannel, Channel, Options as AmqpOptions } from 'amqplib';
|
|
5
4
|
export interface IRabbitMQApplication {
|
|
6
5
|
connect(...args: any[]): Promise<void>;
|
package/dist/mq.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as amqp from 'amqp-connection-manager';
|
|
6
6
|
import { IRabbitMQApplication } from './interface';
|
|
7
7
|
import { ConsumeMessage } from 'amqplib/properties';
|
|
8
|
-
import { RabbitMQListenerOptions } from '@midwayjs/
|
|
8
|
+
import { RabbitMQListenerOptions } from '@midwayjs/core';
|
|
9
9
|
import type { Channel } from 'amqplib';
|
|
10
10
|
import { ILogger } from '@midwayjs/logger';
|
|
11
11
|
import { EventEmitter } from 'events';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/rabbitmq",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Midway Framework for rabbitmq",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -24,16 +24,15 @@
|
|
|
24
24
|
],
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@midwayjs/
|
|
28
|
-
"@midwayjs/mock": "^3.5.3",
|
|
27
|
+
"@midwayjs/mock": "^3.7.0",
|
|
29
28
|
"@types/amqplib": "0.8.2",
|
|
30
29
|
"amqplib": "0.10.3",
|
|
31
30
|
"fs-extra": "10.0.1"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"@midwayjs/core": "^3.
|
|
33
|
+
"@midwayjs/core": "^3.7.0",
|
|
35
34
|
"@midwayjs/logger": "^2.15.0",
|
|
36
|
-
"amqp-connection-manager": "4.1.
|
|
35
|
+
"amqp-connection-manager": "4.1.9"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
38
|
"@types/amqplib": "*",
|
|
@@ -47,5 +46,5 @@
|
|
|
47
46
|
"engines": {
|
|
48
47
|
"node": ">=12"
|
|
49
48
|
},
|
|
50
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "99386083ee26b386fd508b9c892091c914e77535"
|
|
51
50
|
}
|