@midwayjs/mqtt 3.19.2 → 4.0.0-alpha.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.
@@ -21,11 +21,12 @@ let MQTTConfiguration = class MQTTConfiguration {
21
21
  await this.factory.stop();
22
22
  }
23
23
  };
24
+ exports.MQTTConfiguration = MQTTConfiguration;
24
25
  __decorate([
25
26
  (0, core_1.Inject)(),
26
27
  __metadata("design:type", framework_1.MidwayMQTTFramework)
27
28
  ], MQTTConfiguration.prototype, "framework", void 0);
28
- MQTTConfiguration = __decorate([
29
+ exports.MQTTConfiguration = MQTTConfiguration = __decorate([
29
30
  (0, core_1.Configuration)({
30
31
  namespace: 'mqtt',
31
32
  importConfigs: [
@@ -48,5 +49,4 @@ MQTTConfiguration = __decorate([
48
49
  ],
49
50
  })
50
51
  ], MQTTConfiguration);
51
- exports.MQTTConfiguration = MQTTConfiguration;
52
52
  //# sourceMappingURL=configuration.js.map
package/dist/decorator.js CHANGED
@@ -5,8 +5,8 @@ const core_1 = require("@midwayjs/core");
5
5
  exports.MQTT_DECORATOR_KEY = 'rpc:mqtt';
6
6
  function MqttSubscriber(subscriberName) {
7
7
  return target => {
8
- (0, core_1.saveModule)(exports.MQTT_DECORATOR_KEY, target);
9
- (0, core_1.saveClassMetadata)(exports.MQTT_DECORATOR_KEY, subscriberName, target);
8
+ core_1.DecoratorManager.saveModule(exports.MQTT_DECORATOR_KEY, target);
9
+ core_1.MetadataManager.defineMetadata(exports.MQTT_DECORATOR_KEY, subscriberName, target);
10
10
  (0, core_1.Scope)(core_1.ScopeEnum.Request)(target);
11
11
  (0, core_1.Provide)()(target);
12
12
  };
package/dist/framework.js CHANGED
@@ -30,10 +30,10 @@ let MidwayMQTTFramework = class MidwayMQTTFramework extends core_1.BaseFramework
30
30
  this.mqttLogger.info('[midway-mqtt] Not found consumer config, skip init consumer');
31
31
  }
32
32
  // find subscriber
33
- const mqttSubscriberModules = (0, core_1.listModule)(decorator_1.MQTT_DECORATOR_KEY);
33
+ const mqttSubscriberModules = core_1.DecoratorManager.listModule(decorator_1.MQTT_DECORATOR_KEY);
34
34
  const mqttSubscriberMap = {};
35
35
  for (const subscriberModule of mqttSubscriberModules) {
36
- const subscriberName = (0, core_1.getClassMetadata)(decorator_1.MQTT_DECORATOR_KEY, subscriberModule);
36
+ const subscriberName = core_1.MetadataManager.getOwnMetadata(decorator_1.MQTT_DECORATOR_KEY, subscriberModule);
37
37
  mqttSubscriberMap[subscriberName] = subscriberModule;
38
38
  }
39
39
  for (const customKey in sub) {
@@ -101,15 +101,15 @@ let MidwayMQTTFramework = class MidwayMQTTFramework extends core_1.BaseFramework
101
101
  return Object.values(this.subscriberMap);
102
102
  }
103
103
  getFrameworkName() {
104
- return 'midway:mqtt';
104
+ return 'mqtt';
105
105
  }
106
106
  };
107
+ exports.MidwayMQTTFramework = MidwayMQTTFramework;
107
108
  __decorate([
108
109
  (0, core_1.Logger)('mqttLogger'),
109
110
  __metadata("design:type", Object)
110
111
  ], MidwayMQTTFramework.prototype, "mqttLogger", void 0);
111
- MidwayMQTTFramework = __decorate([
112
+ exports.MidwayMQTTFramework = MidwayMQTTFramework = __decorate([
112
113
  (0, core_1.Framework)()
113
114
  ], MidwayMQTTFramework);
114
- exports.MidwayMQTTFramework = MidwayMQTTFramework;
115
115
  //# sourceMappingURL=framework.js.map
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { IConfigurationOptions, IMidwayApplication, IMidwayContext, NextFunction as BaseNextFunction, ServiceFactoryConfigOption } from '@midwayjs/core';
3
4
  import type { IClientOptions, IClientSubscribeOptions, IClientSubscribeProperties, ISubscriptionMap, IPublishPacket } from 'mqtt';
4
5
  export interface MqttSubscriberOptions {
package/dist/service.js CHANGED
@@ -36,6 +36,7 @@ let MqttProducerFactory = class MqttProducerFactory extends core_1.ServiceFactor
36
36
  this.logger.info('[midway-mqtt] producer: %s is close', name);
37
37
  }
38
38
  };
39
+ exports.MqttProducerFactory = MqttProducerFactory;
39
40
  __decorate([
40
41
  (0, core_1.Logger)('mqttLogger'),
41
42
  __metadata("design:type", Object)
@@ -50,11 +51,10 @@ __decorate([
50
51
  __metadata("design:paramtypes", []),
51
52
  __metadata("design:returntype", Promise)
52
53
  ], MqttProducerFactory.prototype, "init", null);
53
- MqttProducerFactory = __decorate([
54
+ exports.MqttProducerFactory = MqttProducerFactory = __decorate([
54
55
  (0, core_1.Provide)(),
55
56
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
56
57
  ], MqttProducerFactory);
57
- exports.MqttProducerFactory = MqttProducerFactory;
58
58
  let DefaultMqttProducer = class DefaultMqttProducer {
59
59
  async init() {
60
60
  this.instance = this.mqttProducerFactory.get(this.mqttProducerFactory.getDefaultClientName() || 'default');
@@ -63,6 +63,7 @@ let DefaultMqttProducer = class DefaultMqttProducer {
63
63
  }
64
64
  }
65
65
  };
66
+ exports.DefaultMqttProducer = DefaultMqttProducer;
66
67
  __decorate([
67
68
  (0, core_1.Inject)(),
68
69
  __metadata("design:type", MqttProducerFactory)
@@ -73,10 +74,9 @@ __decorate([
73
74
  __metadata("design:paramtypes", []),
74
75
  __metadata("design:returntype", Promise)
75
76
  ], DefaultMqttProducer.prototype, "init", null);
76
- DefaultMqttProducer = __decorate([
77
+ exports.DefaultMqttProducer = DefaultMqttProducer = __decorate([
77
78
  (0, core_1.Provide)(),
78
79
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
79
80
  ], DefaultMqttProducer);
80
- exports.DefaultMqttProducer = DefaultMqttProducer;
81
81
  (0, core_1.delegateTargetAllPrototypeMethod)(DefaultMqttProducer, mqtt_1.MqttClient);
82
82
  //# sourceMappingURL=service.js.map
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@midwayjs/mqtt",
3
- "version": "3.19.2",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "Midway Framework for mqtt",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
- "test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
10
- "cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit",
9
+ "test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
10
+ "cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
11
11
  "lint:fix": "../../node_modules/.bin/mwts fix"
12
12
  },
13
13
  "keywords": [
@@ -23,8 +23,8 @@
23
23
  ],
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@midwayjs/core": "^3.19.0",
27
- "@midwayjs/mock": "^3.19.2"
26
+ "@midwayjs/core": "^4.0.0-alpha.1",
27
+ "@midwayjs/mock": "^4.0.0-alpha.1"
28
28
  },
29
29
  "dependencies": {
30
30
  "mqtt": "5.10.3"
@@ -37,5 +37,5 @@
37
37
  "engines": {
38
38
  "node": ">=16"
39
39
  },
40
- "gitHead": "57fd034be94897fb819b0d9ef776de0b9923ab0f"
40
+ "gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
41
41
  }