@midwayjs/mqtt 4.0.0-beta.7 → 4.0.0-beta.8
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 +2 -0
- package/dist/decorator.js +2 -2
- package/dist/framework.d.ts +0 -1
- package/dist/framework.js +2 -5
- package/dist/interface.d.ts +0 -2
- package/dist/service.js +4 -0
- package/package.json +4 -4
package/dist/configuration.js
CHANGED
|
@@ -14,6 +14,8 @@ const core_1 = require("@midwayjs/core");
|
|
|
14
14
|
const framework_1 = require("./framework");
|
|
15
15
|
const service_1 = require("./service");
|
|
16
16
|
let MQTTConfiguration = class MQTTConfiguration {
|
|
17
|
+
framework;
|
|
18
|
+
factory;
|
|
17
19
|
async onReady(container) {
|
|
18
20
|
this.factory = await container.getAsync(service_1.MqttProducerFactory);
|
|
19
21
|
}
|
package/dist/decorator.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MQTT_DECORATOR_KEY = void 0;
|
|
4
|
+
exports.MqttSubscriber = MqttSubscriber;
|
|
4
5
|
const core_1 = require("@midwayjs/core");
|
|
5
6
|
exports.MQTT_DECORATOR_KEY = 'rpc:mqtt';
|
|
6
7
|
function MqttSubscriber(subscriberName) {
|
|
@@ -11,5 +12,4 @@ function MqttSubscriber(subscriberName) {
|
|
|
11
12
|
(0, core_1.Provide)()(target);
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
|
-
exports.MqttSubscriber = MqttSubscriber;
|
|
15
15
|
//# sourceMappingURL=decorator.js.map
|
package/dist/framework.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { BaseFramework } from '@midwayjs/core';
|
|
|
2
2
|
import { IMidwayMQTTApplication, IMidwayMQTTConfigurationOptions, IMidwayMQTTContext, IMqttSubscriber, MqttSubscriberOptions } from './interface';
|
|
3
3
|
import { IClientOptions, MqttClient } from 'mqtt';
|
|
4
4
|
export declare class MidwayMQTTFramework extends BaseFramework<IMidwayMQTTApplication, IMidwayMQTTContext, IMidwayMQTTConfigurationOptions> {
|
|
5
|
-
app: IMidwayMQTTApplication;
|
|
6
5
|
protected subscriberMap: Map<string, MqttClient>;
|
|
7
6
|
protected frameworkLoggerName: string;
|
|
8
7
|
configure(): any;
|
package/dist/framework.js
CHANGED
|
@@ -11,11 +11,8 @@ const core_1 = require("@midwayjs/core");
|
|
|
11
11
|
const mqtt_1 = require("mqtt");
|
|
12
12
|
const decorator_1 = require("./decorator");
|
|
13
13
|
let MidwayMQTTFramework = class MidwayMQTTFramework extends core_1.BaseFramework {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.subscriberMap = new Map();
|
|
17
|
-
this.frameworkLoggerName = 'mqttLogger';
|
|
18
|
-
}
|
|
14
|
+
subscriberMap = new Map();
|
|
15
|
+
frameworkLoggerName = 'mqttLogger';
|
|
19
16
|
configure() {
|
|
20
17
|
return this.configService.getConfiguration('mqtt');
|
|
21
18
|
}
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { IConfigurationOptions, IMidwayApplication, IMidwayContext, NextFunction as BaseNextFunction, ServiceFactoryConfigOption } from '@midwayjs/core';
|
|
4
2
|
import type { IClientOptions, IClientSubscribeOptions, IClientSubscribeProperties, ISubscriptionMap, IPublishPacket } from 'mqtt';
|
|
5
3
|
export interface MqttSubscriberOptions {
|
package/dist/service.js
CHANGED
|
@@ -13,6 +13,8 @@ exports.DefaultMqttProducer = exports.MqttProducerFactory = void 0;
|
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const mqtt_1 = require("mqtt");
|
|
15
15
|
let MqttProducerFactory = class MqttProducerFactory extends core_1.ServiceFactory {
|
|
16
|
+
logger;
|
|
17
|
+
pubConfig;
|
|
16
18
|
getName() {
|
|
17
19
|
return 'mqtt';
|
|
18
20
|
}
|
|
@@ -58,6 +60,8 @@ exports.MqttProducerFactory = MqttProducerFactory = __decorate([
|
|
|
58
60
|
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
59
61
|
], MqttProducerFactory);
|
|
60
62
|
let DefaultMqttProducer = class DefaultMqttProducer {
|
|
63
|
+
mqttProducerFactory;
|
|
64
|
+
instance;
|
|
61
65
|
async init() {
|
|
62
66
|
this.instance = this.mqttProducerFactory.get(this.mqttProducerFactory.getDefaultClientName() || 'default');
|
|
63
67
|
if (!this.instance) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/mqtt",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.8",
|
|
4
4
|
"description": "Midway Framework for mqtt",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@midwayjs/core": "^4.0.0-beta.
|
|
27
|
-
"@midwayjs/mock": "^4.0.0-beta.
|
|
26
|
+
"@midwayjs/core": "^4.0.0-beta.8",
|
|
27
|
+
"@midwayjs/mock": "^4.0.0-beta.8"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"mqtt": "5.14.1"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=20"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "355e55949fdd132b0bdcb4830222a0a027e92ded"
|
|
41
41
|
}
|