@dongdev/fca-unofficial 2.0.26 → 2.0.27
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ const uuid = require("uuid");
|
|
|
4
4
|
"use strict";
|
|
5
5
|
module.exports = function createListenMqtt(deps) {
|
|
6
6
|
const { WebSocket, mqtt, HttpsProxyAgent, buildStream, buildProxy,
|
|
7
|
-
topics, parseDelta, getTaskResponseData, logger
|
|
7
|
+
topics, parseDelta, getTaskResponseData, logger, emitAuth
|
|
8
8
|
} = deps;
|
|
9
9
|
|
|
10
10
|
return function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
|
|
@@ -14,9 +14,12 @@ const markDelivery = require("./core/markDelivery");
|
|
|
14
14
|
const getTaskResponseData = require("./core/getTaskResponseData");
|
|
15
15
|
const createEmitAuth = require("./core/emitAuth");
|
|
16
16
|
const parseDelta = createParseDelta({ markDelivery, parseAndCheckLogin });
|
|
17
|
-
|
|
18
|
-
const getSeqIDFactory = createGetSeqID({ parseAndCheckLogin, listenMqtt, logger });
|
|
17
|
+
// Create emitAuth first so it can be injected into both factories
|
|
19
18
|
const emitAuth = createEmitAuth({ logger });
|
|
19
|
+
// Pass emitAuth into connectMqtt so errors there can signal auth state
|
|
20
|
+
const listenMqtt = createListenMqtt({ WebSocket, mqtt, HttpsProxyAgent, buildStream, buildProxy, topics, parseDelta, getTaskResponseData, logger, emitAuth });
|
|
21
|
+
// Inject emitAuth into getSeqID so its catch handler can notify properly
|
|
22
|
+
const getSeqIDFactory = createGetSeqID({ parseAndCheckLogin, listenMqtt, logger, emitAuth });
|
|
20
23
|
|
|
21
24
|
const MQTT_DEFAULTS = { cycleMs: 60 * 60 * 1000, reconnectDelayMs: 2000, autoReconnect: true, reconnectAfterStop: false };
|
|
22
25
|
function mqttConf(ctx, overrides) {
|