@midwayjs/decorator 3.4.0-beta.2 → 3.4.0-beta.5

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.
@@ -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';
@@ -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,6 @@
1
+ export interface KafkaListenerOptions {
2
+ propertyKey?: string;
3
+ topic?: string;
4
+ }
5
+ export declare function KafkaListener(topic: string, options?: KafkaListenerOptions): MethodDecorator;
6
+ //# sourceMappingURL=kafkaListener.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
@@ -115,6 +115,10 @@ export declare namespace FaaSMetadata {
115
115
  * deploy or not
116
116
  */
117
117
  isDeploy?: boolean;
118
+ /**
119
+ * function handler name, like 'index.handler'
120
+ */
121
+ handlerName?: string;
118
122
  }
119
123
  interface TriggerCommonOptions {
120
124
  /**
@@ -187,7 +191,8 @@ export declare namespace FaaSMetadata {
187
191
  export interface TriggerMetadata {
188
192
  type: ServerlessTriggerType;
189
193
  functionName?: string;
190
- methodName: string;
194
+ handlerName?: string;
195
+ methodName?: string;
191
196
  metadata: EventTriggerUnionOptions;
192
197
  }
193
198
  export {};
@@ -203,6 +208,7 @@ export declare class MidwayFrameworkType extends FrameworkType {
203
208
  static FAAS: MidwayFrameworkType;
204
209
  static MS_GRPC: MidwayFrameworkType;
205
210
  static MS_RABBITMQ: MidwayFrameworkType;
211
+ static MS_KAFKA: MidwayFrameworkType;
206
212
  static WS_IO: MidwayFrameworkType;
207
213
  static WS: MidwayFrameworkType;
208
214
  static SERVERLESS_APP: MidwayFrameworkType;
@@ -221,6 +227,7 @@ export declare enum ServerlessTriggerType {
221
227
  LOG = "log",
222
228
  TIMER = "timer",
223
229
  MQ = "mq",
230
+ KAFKA = "kafka",
224
231
  HSF = "hsf",
225
232
  MTOP = "mtop"
226
233
  }
package/dist/interface.js CHANGED
@@ -43,6 +43,7 @@ MidwayFrameworkType.WEB_EXPRESS = new MidwayFrameworkType('@midwayjs/express');
43
43
  MidwayFrameworkType.FAAS = new MidwayFrameworkType('@midwayjs/faas');
44
44
  MidwayFrameworkType.MS_GRPC = new MidwayFrameworkType('@midwayjs/grpc');
45
45
  MidwayFrameworkType.MS_RABBITMQ = new MidwayFrameworkType('@midwayjs/rabbitmq');
46
+ MidwayFrameworkType.MS_KAFKA = new MidwayFrameworkType('@midwayjs/kafka');
46
47
  MidwayFrameworkType.WS_IO = new MidwayFrameworkType('@midwayjs/socketio');
47
48
  MidwayFrameworkType.WS = new MidwayFrameworkType('@midwayjs/ws');
48
49
  MidwayFrameworkType.SERVERLESS_APP = new MidwayFrameworkType('@midwayjs/serverless-app');
@@ -60,6 +61,7 @@ var ServerlessTriggerType;
60
61
  ServerlessTriggerType["LOG"] = "log";
61
62
  ServerlessTriggerType["TIMER"] = "timer";
62
63
  ServerlessTriggerType["MQ"] = "mq";
64
+ ServerlessTriggerType["KAFKA"] = "kafka";
63
65
  ServerlessTriggerType["HSF"] = "hsf";
64
66
  ServerlessTriggerType["MTOP"] = "mtop";
65
67
  })(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.2",
3
+ "version": "3.4.0-beta.5",
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": "a61721d3946b30fd4cac183265edcd99b31ac72b"
39
+ "gitHead": "d84d1c77aed1fd973d002ab65cd0adeadb7924a6"
40
40
  }