@midwayjs/decorator 3.4.0-beta.1 → 3.4.0-beta.12
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/decorator/index.d.ts +1 -0
- package/dist/decorator/index.js +1 -0
- package/dist/decorator/microservice/consumer.d.ts +1 -0
- package/dist/decorator/microservice/kafkaListener.d.ts +6 -0
- package/dist/decorator/microservice/kafkaListener.js +13 -0
- package/dist/decorator/microservice/provider.d.ts +0 -1
- package/dist/decorator/microservice/provider.js +1 -10
- package/dist/decorator/ws/webSocketController.d.ts +2 -3
- package/dist/decorator/ws/webSocketController.js +4 -1
- package/dist/decorator/ws/webSocketEvent.d.ts +13 -2
- package/dist/decorator/ws/webSocketEvent.js +4 -2
- package/dist/interface.d.ts +9 -3
- package/dist/interface.js +2 -1
- package/package.json +2 -2
|
@@ -5,6 +5,7 @@ export * from './framework/schedule';
|
|
|
5
5
|
export * from './microservice/consumer';
|
|
6
6
|
export * from './microservice/provider';
|
|
7
7
|
export * from './microservice/rabbitmqListener';
|
|
8
|
+
export * from './microservice/kafkaListener';
|
|
8
9
|
export * from './rpc/hsf';
|
|
9
10
|
export * from './task/queue';
|
|
10
11
|
export * from './task/task';
|
package/dist/decorator/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __exportStar(require("./framework/schedule"), exports);
|
|
|
25
25
|
__exportStar(require("./microservice/consumer"), exports);
|
|
26
26
|
__exportStar(require("./microservice/provider"), exports);
|
|
27
27
|
__exportStar(require("./microservice/rabbitmqListener"), exports);
|
|
28
|
+
__exportStar(require("./microservice/kafkaListener"), exports);
|
|
28
29
|
// rpc
|
|
29
30
|
__exportStar(require("./rpc/hsf"), exports);
|
|
30
31
|
// task
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MSListenerType } from '../../';
|
|
2
2
|
export declare function Consumer(type: MSListenerType.MQTT): ClassDecorator;
|
|
3
3
|
export declare function Consumer(type: MSListenerType.RABBITMQ, options?: any): ClassDecorator;
|
|
4
|
+
export declare function Consumer(type: MSListenerType.KAFKA, options?: any): ClassDecorator;
|
|
4
5
|
//# sourceMappingURL=consumer.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KafkaListener = void 0;
|
|
4
|
+
const __1 = require("../..");
|
|
5
|
+
function KafkaListener(topic, options = {}) {
|
|
6
|
+
return (target, propertyKey) => {
|
|
7
|
+
options.topic = topic;
|
|
8
|
+
options.propertyKey = propertyKey;
|
|
9
|
+
(0, __1.attachPropertyDataToClass)(__1.MS_CONSUMER_KEY, options, target, propertyKey);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
exports.KafkaListener = KafkaListener;
|
|
13
|
+
//# sourceMappingURL=kafkaListener.js.map
|
|
@@ -13,5 +13,4 @@ export declare function GrpcMethod(methodOptions?: {
|
|
|
13
13
|
onEnd?: string;
|
|
14
14
|
}): MethodDecorator;
|
|
15
15
|
export declare function DubboMethod(methodName?: string): MethodDecorator;
|
|
16
|
-
export declare function HSFMethod(methodName?: string): MethodDecorator;
|
|
17
16
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DubboMethod = exports.GrpcMethod = exports.GrpcStreamTypeEnum = exports.Provider = void 0;
|
|
4
4
|
const __1 = require("../../");
|
|
5
5
|
const common_1 = require("../common");
|
|
6
6
|
function Provider(type, metadata = {}) {
|
|
@@ -45,13 +45,4 @@ function DubboMethod(methodName) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
exports.DubboMethod = DubboMethod;
|
|
48
|
-
function HSFMethod(methodName) {
|
|
49
|
-
return (target, propertyName, descriptor) => {
|
|
50
|
-
(0, __1.attachClassMetadata)(__1.MS_HSF_METHOD_KEY, {
|
|
51
|
-
methodName: methodName || propertyName,
|
|
52
|
-
}, target);
|
|
53
|
-
return descriptor;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
exports.HSFMethod = HSFMethod;
|
|
57
48
|
//# sourceMappingURL=provider.js.map
|
|
@@ -2,10 +2,9 @@ import { MiddlewareParamArray } from '../../interface';
|
|
|
2
2
|
export interface WSControllerOption {
|
|
3
3
|
namespace: string;
|
|
4
4
|
routerOptions: {
|
|
5
|
+
connectionMiddleware?: MiddlewareParamArray;
|
|
5
6
|
middleware?: MiddlewareParamArray;
|
|
6
7
|
};
|
|
7
8
|
}
|
|
8
|
-
export declare function WSController(namespace?: string | RegExp, routerOptions?:
|
|
9
|
-
middleware?: MiddlewareParamArray;
|
|
10
|
-
}): ClassDecorator;
|
|
9
|
+
export declare function WSController(namespace?: string | RegExp, routerOptions?: WSControllerOption['routerOptions']): ClassDecorator;
|
|
11
10
|
//# sourceMappingURL=webSocketController.d.ts.map
|
|
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WSController = void 0;
|
|
4
4
|
const common_1 = require("../common");
|
|
5
5
|
const __1 = require("../../");
|
|
6
|
-
function WSController(namespace = '/', routerOptions = {
|
|
6
|
+
function WSController(namespace = '/', routerOptions = {
|
|
7
|
+
middleware: [],
|
|
8
|
+
connectionMiddleware: [],
|
|
9
|
+
}) {
|
|
7
10
|
return (target) => {
|
|
8
11
|
(0, __1.saveModule)(__1.WS_CONTROLLER_KEY, target);
|
|
9
12
|
(0, __1.saveClassMetadata)(__1.WS_CONTROLLER_KEY, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MiddlewareParamArray } from '../../';
|
|
1
2
|
export declare enum WSEventTypeEnum {
|
|
2
3
|
ON_CONNECTION = "ws:onConnection",
|
|
3
4
|
ON_DISCONNECTION = "ws:onDisconnection",
|
|
@@ -24,10 +25,20 @@ export interface WSEventInfo {
|
|
|
24
25
|
* the room name to emit
|
|
25
26
|
*/
|
|
26
27
|
roomName?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* event options, like middleware
|
|
30
|
+
*/
|
|
31
|
+
eventOptions?: {
|
|
32
|
+
middleware?: MiddlewareParamArray;
|
|
33
|
+
};
|
|
27
34
|
}
|
|
28
|
-
export declare function OnWSConnection(
|
|
35
|
+
export declare function OnWSConnection(eventOptions?: {
|
|
36
|
+
middleware?: MiddlewareParamArray;
|
|
37
|
+
}): MethodDecorator;
|
|
29
38
|
export declare function OnWSDisConnection(): MethodDecorator;
|
|
30
|
-
export declare function OnWSMessage(eventName: string
|
|
39
|
+
export declare function OnWSMessage(eventName: string, eventOptions?: {
|
|
40
|
+
middleware?: MiddlewareParamArray;
|
|
41
|
+
}): MethodDecorator;
|
|
31
42
|
export declare function WSEmit(messageName: string, roomName?: string | string[]): MethodDecorator;
|
|
32
43
|
export declare function WSBroadCast(messageName?: string, roomName?: string | string[]): MethodDecorator;
|
|
33
44
|
/**
|
|
@@ -11,11 +11,12 @@ var WSEventTypeEnum;
|
|
|
11
11
|
WSEventTypeEnum["EMIT"] = "ws:Emit";
|
|
12
12
|
WSEventTypeEnum["BROADCAST"] = "ws:broadcast";
|
|
13
13
|
})(WSEventTypeEnum = exports.WSEventTypeEnum || (exports.WSEventTypeEnum = {}));
|
|
14
|
-
function OnWSConnection() {
|
|
14
|
+
function OnWSConnection(eventOptions = {}) {
|
|
15
15
|
return (target, propertyKey, descriptor) => {
|
|
16
16
|
(0, __1.attachClassMetadata)(__1.WS_EVENT_KEY, {
|
|
17
17
|
eventType: WSEventTypeEnum.ON_CONNECTION,
|
|
18
18
|
propertyName: propertyKey,
|
|
19
|
+
eventOptions,
|
|
19
20
|
descriptor,
|
|
20
21
|
}, target.constructor);
|
|
21
22
|
};
|
|
@@ -31,12 +32,13 @@ function OnWSDisConnection() {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
exports.OnWSDisConnection = OnWSDisConnection;
|
|
34
|
-
function OnWSMessage(eventName) {
|
|
35
|
+
function OnWSMessage(eventName, eventOptions = {}) {
|
|
35
36
|
return (target, propertyKey, descriptor) => {
|
|
36
37
|
(0, __1.attachClassMetadata)(__1.WS_EVENT_KEY, {
|
|
37
38
|
eventType: WSEventTypeEnum.ON_MESSAGE,
|
|
38
39
|
messageEventName: eventName,
|
|
39
40
|
propertyName: propertyKey,
|
|
41
|
+
eventOptions,
|
|
40
42
|
descriptor,
|
|
41
43
|
}, target.constructor);
|
|
42
44
|
};
|
package/dist/interface.d.ts
CHANGED
|
@@ -45,8 +45,7 @@ export interface ReflectResult {
|
|
|
45
45
|
}
|
|
46
46
|
export declare enum MSProviderType {
|
|
47
47
|
DUBBO = "dubbo",
|
|
48
|
-
GRPC = "gRPC"
|
|
49
|
-
HSF = "hsf"
|
|
48
|
+
GRPC = "gRPC"
|
|
50
49
|
}
|
|
51
50
|
export declare enum MSListenerType {
|
|
52
51
|
RABBITMQ = "rabbitmq",
|
|
@@ -115,6 +114,10 @@ export declare namespace FaaSMetadata {
|
|
|
115
114
|
* deploy or not
|
|
116
115
|
*/
|
|
117
116
|
isDeploy?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* function handler name, like 'index.handler'
|
|
119
|
+
*/
|
|
120
|
+
handlerName?: string;
|
|
118
121
|
}
|
|
119
122
|
interface TriggerCommonOptions {
|
|
120
123
|
/**
|
|
@@ -187,7 +190,8 @@ export declare namespace FaaSMetadata {
|
|
|
187
190
|
export interface TriggerMetadata {
|
|
188
191
|
type: ServerlessTriggerType;
|
|
189
192
|
functionName?: string;
|
|
190
|
-
|
|
193
|
+
handlerName?: string;
|
|
194
|
+
methodName?: string;
|
|
191
195
|
metadata: EventTriggerUnionOptions;
|
|
192
196
|
}
|
|
193
197
|
export {};
|
|
@@ -203,6 +207,7 @@ export declare class MidwayFrameworkType extends FrameworkType {
|
|
|
203
207
|
static FAAS: MidwayFrameworkType;
|
|
204
208
|
static MS_GRPC: MidwayFrameworkType;
|
|
205
209
|
static MS_RABBITMQ: MidwayFrameworkType;
|
|
210
|
+
static MS_KAFKA: MidwayFrameworkType;
|
|
206
211
|
static WS_IO: MidwayFrameworkType;
|
|
207
212
|
static WS: MidwayFrameworkType;
|
|
208
213
|
static SERVERLESS_APP: MidwayFrameworkType;
|
|
@@ -221,6 +226,7 @@ export declare enum ServerlessTriggerType {
|
|
|
221
226
|
LOG = "log",
|
|
222
227
|
TIMER = "timer",
|
|
223
228
|
MQ = "mq",
|
|
229
|
+
KAFKA = "kafka",
|
|
224
230
|
HSF = "hsf",
|
|
225
231
|
MTOP = "mtop"
|
|
226
232
|
}
|
package/dist/interface.js
CHANGED
|
@@ -17,7 +17,6 @@ var MSProviderType;
|
|
|
17
17
|
(function (MSProviderType) {
|
|
18
18
|
MSProviderType["DUBBO"] = "dubbo";
|
|
19
19
|
MSProviderType["GRPC"] = "gRPC";
|
|
20
|
-
MSProviderType["HSF"] = "hsf";
|
|
21
20
|
})(MSProviderType = exports.MSProviderType || (exports.MSProviderType = {}));
|
|
22
21
|
var MSListenerType;
|
|
23
22
|
(function (MSListenerType) {
|
|
@@ -43,6 +42,7 @@ MidwayFrameworkType.WEB_EXPRESS = new MidwayFrameworkType('@midwayjs/express');
|
|
|
43
42
|
MidwayFrameworkType.FAAS = new MidwayFrameworkType('@midwayjs/faas');
|
|
44
43
|
MidwayFrameworkType.MS_GRPC = new MidwayFrameworkType('@midwayjs/grpc');
|
|
45
44
|
MidwayFrameworkType.MS_RABBITMQ = new MidwayFrameworkType('@midwayjs/rabbitmq');
|
|
45
|
+
MidwayFrameworkType.MS_KAFKA = new MidwayFrameworkType('@midwayjs/kafka');
|
|
46
46
|
MidwayFrameworkType.WS_IO = new MidwayFrameworkType('@midwayjs/socketio');
|
|
47
47
|
MidwayFrameworkType.WS = new MidwayFrameworkType('@midwayjs/ws');
|
|
48
48
|
MidwayFrameworkType.SERVERLESS_APP = new MidwayFrameworkType('@midwayjs/serverless-app');
|
|
@@ -60,6 +60,7 @@ var ServerlessTriggerType;
|
|
|
60
60
|
ServerlessTriggerType["LOG"] = "log";
|
|
61
61
|
ServerlessTriggerType["TIMER"] = "timer";
|
|
62
62
|
ServerlessTriggerType["MQ"] = "mq";
|
|
63
|
+
ServerlessTriggerType["KAFKA"] = "kafka";
|
|
63
64
|
ServerlessTriggerType["HSF"] = "hsf";
|
|
64
65
|
ServerlessTriggerType["MTOP"] = "mtop";
|
|
65
66
|
})(ServerlessTriggerType = exports.ServerlessTriggerType || (exports.ServerlessTriggerType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/decorator",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.12",
|
|
4
4
|
"description": "definition decorator for midway project",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "cb639763ececfc7928221eaafbd515bfd93c6ca1"
|
|
40
40
|
}
|