From 10b0239384aab40095dab96173918ba3e9849017 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Wed, 28 Aug 2024 12:31:25 -0700 Subject: [PATCH] Mqtt js upgrade (#562) Co-authored-by: Bret Ambrose Co-authored-by: Vera Xia --- lib/browser/mqtt.ts | 20 ++- lib/browser/mqtt5.spec.ts | 4 +- lib/browser/mqtt5.ts | 19 +- lib/browser/mqtt5_utils.spec.ts | 73 ++++++-- lib/browser/mqtt5_utils.ts | 47 +++-- lib/common/mqtt_shared.ts | 15 ++ package-lock.json | 303 +++++++++++++++++++++----------- package.json | 4 +- test/mqtt5.ts | 8 +- 9 files changed, 335 insertions(+), 158 deletions(-) diff --git a/lib/browser/mqtt.ts b/lib/browser/mqtt.ts index 5d379e4c2..946e9efed 100644 --- a/lib/browser/mqtt.ts +++ b/lib/browser/mqtt.ts @@ -13,6 +13,7 @@ */ import * as mqtt from "mqtt"; +import * as mqtt_packet from "mqtt-packet"; import * as WebsocketUtils from "./ws"; import * as auth from "./auth"; import { Trie, TrieOp, Node as TrieNode } from "./trie"; @@ -36,7 +37,7 @@ import { OnConnectionFailedResult, OnConnectionClosedResult } from "../common/mqtt"; -import { normalize_payload } from "../common/mqtt_shared"; +import {normalize_payload, normalize_payload_to_buffer} from "../common/mqtt_shared"; export { QoS, Payload, MqttRequest, MqttSubscribeRequest, MqttWill, OnMessageCallback, MqttConnectionConnected, MqttConnectionDisconnected, @@ -310,7 +311,7 @@ export class MqttClientConnection extends BufferedEventEmitter { const will = this.config.will ? { topic: this.config.will.topic, - payload: normalize_payload(this.config.will.payload), + payload: normalize_payload_to_buffer(this.config.will.payload), qos: this.config.will.qos, retain: this.config.will.retain, } : undefined; @@ -576,7 +577,18 @@ export class MqttClientConnection extends BufferedEventEmitter { return this.on_error(error); } const sub = (packet as mqtt.ISubscriptionGrant[])[0]; - resolve({ topic: sub.topic, qos: sub.qos }); + + /* + * 128 is not modeled in QoS, either on our side nor mqtt-js's side. + * We have always passed this 128 to the user and it is not reasonable to extend + * our output type with 128 since it's also our input type and we don't want anyone + * to pass 128 to us. + * + * The 5 client solves this by making the output type a completely separate enum. + * + * By doing this cast, we make the type checker ignore this edge case. + */ + resolve({ topic: sub.topic, qos: sub.qos as QoS }); }); }); } @@ -603,7 +615,7 @@ export class MqttClientConnection extends BufferedEventEmitter { } resolve({ packet_id: packet - ? (packet as mqtt.IUnsubackPacket).messageId + ? (packet as mqtt_packet.IUnsubackPacket).messageId : undefined, }); }); diff --git a/lib/browser/mqtt5.spec.ts b/lib/browser/mqtt5.spec.ts index 1ba3eb9b8..c14401b02 100644 --- a/lib/browser/mqtt5.spec.ts +++ b/lib/browser/mqtt5.spec.ts @@ -10,7 +10,7 @@ import url from "url"; import {HttpsProxyAgent} from "https-proxy-agent"; import * as auth from "./auth"; -jest.setTimeout(10000); +jest.setTimeout(1000000); function createBrowserSpecificTestConfig (testType: test_utils.SuccessfulConnectionTestType) : mqtt5.Mqtt5ClientConfig { @@ -405,7 +405,7 @@ test_utils.conditional_test(test_utils.ClientEnvironmentalConfig.hasIotCoreEnvir await test_utils.testNegotiatedSettings(forcedRejoinClient, true); }); -test_utils.conditional_test(test_utils.ClientEnvironmentalConfig.hasIotCoreEnvironment())('Sub - Pub QoS 0 - Unsub', async () => { +test('Sub - Pub QoS 0 - Unsub', async () => { let topic : string = `test/${uuid()}`; let testPayload : Buffer = Buffer.from("Derp", "utf-8"); diff --git a/lib/browser/mqtt5.ts b/lib/browser/mqtt5.ts index 90371b833..df7691733 100644 --- a/lib/browser/mqtt5.ts +++ b/lib/browser/mqtt5.ts @@ -16,6 +16,7 @@ import {BufferedEventEmitter} from "../common/event"; import * as mqtt from "mqtt"; /* The mqtt-js external dependency */ +import * as mqtt_packet from "mqtt-packet"; import * as mqtt5 from "../common/mqtt5"; import {OutboundTopicAliasBehaviorType} from "../common/mqtt5"; import * as mqtt5_packet from "../common/mqtt5_packet" @@ -445,15 +446,19 @@ export class Mqtt5Client extends BufferedEventEmitter implements mqtt5.IMqtt5Cli let subMap: mqtt.ISubscriptionMap = mqtt_utils.transform_crt_subscribe_to_mqtt_js_subscription_map(packet); let subOptions: mqtt.IClientSubscribeOptions = mqtt_utils.transform_crt_subscribe_to_mqtt_js_subscribe_options(packet); - // @ts-ignore - this.browserClient.subscribe(subMap, subOptions, (error, grants) => { + this.browserClient.subscribe(subMap, subOptions, (error, grants, suback) => { if (error) { reject(error); return; } - const suback: mqtt5_packet.SubackPacket = mqtt_utils.transform_mqtt_js_subscription_grants_to_crt_suback(grants); - resolve(suback); + if (suback) { + const crtSubackFromMqttjsSuback = mqtt_utils.transform_mqtt_js_suback_to_crt_suback(suback); + resolve(crtSubackFromMqttjsSuback); + } else { + const crtSubackFromGrants: mqtt5_packet.SubackPacket = mqtt_utils.transform_mqtt_js_subscription_grants_to_crt_suback(grants ?? []); + resolve(crtSubackFromGrants); + } }); } catch (err) { reject(err); @@ -505,7 +510,7 @@ export class Mqtt5Client extends BufferedEventEmitter implements mqtt5.IMqtt5Cli }; resolve(unsuback); } else { - const unsuback: mqtt5_packet.UnsubackPacket = mqtt_utils.transform_mqtt_js_unsuback_to_crt_unsuback(packet as mqtt.IUnsubackPacket); + const unsuback: mqtt5_packet.UnsubackPacket = mqtt_utils.transform_mqtt_js_unsuback_to_crt_unsuback(packet as mqtt_packet.IUnsubackPacket); resolve(unsuback); } }); @@ -607,7 +612,7 @@ export class Mqtt5Client extends BufferedEventEmitter implements mqtt5.IMqtt5Cli }) } - const puback: mqtt5_packet.PubackPacket = mqtt_utils.transform_mqtt_js_puback_to_crt_puback(completionPacket as mqtt.IPubackPacket); + const puback: mqtt5_packet.PubackPacket = mqtt_utils.transform_mqtt_js_puback_to_crt_puback(completionPacket as mqtt_packet.IPubackPacket); resolve(puback); break; @@ -889,4 +894,4 @@ export class Mqtt5Client extends BufferedEventEmitter implements mqtt5.IMqtt5Cli this.emit(Mqtt5Client.MESSAGE_RECEIVED, messageReceivedEvent); }, 0); } -} \ No newline at end of file +} diff --git a/lib/browser/mqtt5_utils.spec.ts b/lib/browser/mqtt5_utils.spec.ts index 56d5c6d13..2712caaa8 100644 --- a/lib/browser/mqtt5_utils.spec.ts +++ b/lib/browser/mqtt5_utils.spec.ts @@ -4,10 +4,12 @@ */ import * as mqtt from "mqtt"; +import * as mqtt_packet from "mqtt-packet"; import * as mqtt5 from "./mqtt5"; import {InboundTopicAliasBehaviorType, OutboundTopicAliasBehaviorType} from "./mqtt5"; import * as mqtt5_utils from "./mqtt5_utils"; import * as mqtt_shared from "../common/mqtt_shared"; +import {normalize_payload_to_buffer} from "../common/mqtt_shared"; test('MQTT.JS User Properties to CRT User Properties undefined', async () => { @@ -17,7 +19,7 @@ test('MQTT.JS User Properties to CRT User Properties undefined', async () => { }); test('MQTT.JS User Properties to CRT User Properties single', async () => { - let mqttJsUserProperties : mqtt.UserProperties = { + let mqttJsUserProperties : mqtt_packet.UserProperties = { prop1 : "value1", prop2 : "value2" } @@ -40,7 +42,7 @@ test('MQTT.JS User Properties to CRT User Properties single', async () => { }); test('MQTT.JS User Properties to CRT User Properties multi', async () => { - let mqttJsUserProperties : mqtt.UserProperties = { + let mqttJsUserProperties : mqtt_packet.UserProperties = { prop1 : "value1", prop2 : ["value2_1", "value2_2", "value2_3"] } @@ -71,7 +73,7 @@ test('MQTT.JS User Properties to CRT User Properties multi', async () => { }); test('CRT User Properties to MQTT.js User Properties undefined', async () => { - let mqttJsUserProperties : mqtt.UserProperties | undefined = mqtt5_utils.transform_crt_user_properties_to_mqtt_js_user_properties(undefined); + let mqttJsUserProperties : mqtt_packet.UserProperties | undefined = mqtt5_utils.transform_crt_user_properties_to_mqtt_js_user_properties(undefined); expect(mqttJsUserProperties).toBeUndefined(); }); @@ -82,7 +84,7 @@ test('CRT User Properties to MQTT.js User Properties single', async () => { { name : "prop2", value: "value2"} ] - let mqttJsUserProperties : mqtt.UserProperties | undefined = mqtt5_utils.transform_crt_user_properties_to_mqtt_js_user_properties(crtUserProperties); + let mqttJsUserProperties : mqtt_packet.UserProperties | undefined = mqtt5_utils.transform_crt_user_properties_to_mqtt_js_user_properties(crtUserProperties); expect(mqttJsUserProperties).toEqual( { @@ -99,9 +101,9 @@ test('CRT User Properties to MQTT.js User Properties single', async () => { { name : "prop2", value: "value2_3"} ] - let mqttJsUserProperties : mqtt.UserProperties | undefined = mqtt5_utils.transform_crt_user_properties_to_mqtt_js_user_properties(crtUserProperties); + let mqttJsUserProperties : mqtt_packet.UserProperties | undefined = mqtt5_utils.transform_crt_user_properties_to_mqtt_js_user_properties(crtUserProperties); expect(mqttJsUserProperties).toBeDefined(); - let definedProperties : mqtt.UserProperties = mqttJsUserProperties ?? {}; + let definedProperties : mqtt_packet.UserProperties = mqttJsUserProperties ?? {}; const {prop1 : propOne, prop2: propTwo, ...rest} = definedProperties; @@ -415,7 +417,7 @@ test('create_mqtt_js_client_config_from_crt_client_config maximal, minimal will' expectedOptions["password"] = myPassword; expectedOptions["will"] = { topic : "Ohno", - payload : "", + payload : normalize_payload_to_buffer(""), qos : mqtt5.QoS.AtLeastOnce, retain : false } @@ -638,8 +640,6 @@ test('transform_crt_subscribe_to_mqtt_js_subscription_map', async() => { }); }); -//function transform_crt_subscribe_to_mqtt_js_subscribe_options(subscribe: mqtt5.SubscribePacket) : mqtt.IClientSubscribeOptions - test('transform_crt_subscribe_to_mqtt_js_subscribe_options minimal', async() => { let subscribe : mqtt5.SubscribePacket = { subscriptions: [ @@ -692,7 +692,7 @@ test('transform_mqtt_js_subscription_grants_to_crt_suback', async() => { }, { topic: "a/different/topic", - qos: mqtt5.SubackReasonCode.NotAuthorized, + qos: mqtt5.SubackReasonCode.UnspecifiedError, nl: true, rap: true, rh: 2 @@ -703,7 +703,45 @@ test('transform_mqtt_js_subscription_grants_to_crt_suback', async() => { expect(suback).toEqual({ type: mqtt5.PacketType.Suback, - reasonCodes: [2, mqtt5.SubackReasonCode.NotAuthorized] + reasonCodes: [2, mqtt5.SubackReasonCode.UnspecifiedError] + }); +}); + +test('transform_mqtt_js_suback_to_crt_suback - minimal', async() => { + let mqttJsSuback : mqtt_packet.ISubackPacket = { + cmd: "suback", + granted: [1] + }; + + let suback : mqtt5.SubackPacket = mqtt5_utils.transform_mqtt_js_suback_to_crt_suback(mqttJsSuback); + + expect(suback).toEqual({ + type: mqtt5.PacketType.Suback, + reasonCodes: [mqtt5.SubackReasonCode.GrantedQoS1] + }); +}); + +test('transform_mqtt_js_suback_to_crt_suback - maximal', async() => { + let mqttJsSuback : mqtt_packet.ISubackPacket = { + cmd: "suback", + granted: [2, 128], + properties : { + reasonString: "Misadventure", + userProperties: { + world: ["hello"] + } + } + }; + + let suback : mqtt5.SubackPacket = mqtt5_utils.transform_mqtt_js_suback_to_crt_suback(mqttJsSuback); + + expect(suback).toEqual({ + type: mqtt5.PacketType.Suback, + reasonCodes: [mqtt5.SubackReasonCode.GrantedQoS2, mqtt5.SubackReasonCode.UnspecifiedError], + reasonString: "Misadventure", + userProperties: [ + {name: "world", value: "hello"} + ] }); }); @@ -827,7 +865,7 @@ test('transform_mqtt_js_publish_to_crt_publish maximal', async() => { }); test('transform_mqtt_js_puback_to_crt_puback minimal', async() => { - let mqttJsPuback : mqtt.IPubackPacket = { + let mqttJsPuback : mqtt_packet.IPubackPacket = { cmd: 'puback' }; @@ -840,7 +878,7 @@ test('transform_mqtt_js_puback_to_crt_puback minimal', async() => { }); test('transform_mqtt_js_puback_to_crt_puback maximal', async() => { - let mqttJsPuback : mqtt.IPubackPacket = { + let mqttJsPuback : mqtt_packet.IPubackPacket = { cmd: 'puback', reasonCode: mqtt5.PubackReasonCode.NotAuthorized, properties: { @@ -893,9 +931,9 @@ test('transform_crt_unsubscribe_to_mqtt_js_unsubscribe_options maximal', async() }); test('transform_mqtt_js_unsuback_to_crt_unsuback minimal', async() => { - let mqttJsUnsuback : mqtt.IUnsubackPacket = { + let mqttJsUnsuback : mqtt_packet.IUnsubackPacket = { cmd: 'unsuback', - reasonCode: mqtt5.UnsubackReasonCode.NoSubscriptionExisted + granted: [mqtt5.UnsubackReasonCode.NoSubscriptionExisted] }; let crtUnsuback : mqtt5.UnsubackPacket = mqtt5_utils.transform_mqtt_js_unsuback_to_crt_unsuback(mqttJsUnsuback); @@ -907,10 +945,9 @@ test('transform_mqtt_js_unsuback_to_crt_unsuback minimal', async() => { }); test('transform_mqtt_js_unsuback_to_crt_unsuback maximal', async() => { - let mqttJsUnsuback : mqtt.IUnsubackPacket = { + let mqttJsUnsuback : mqtt_packet.IUnsubackPacket = { cmd: 'unsuback', - // @ts-ignore - reasonCode: [mqtt5.UnsubackReasonCode.NoSubscriptionExisted, mqtt5.UnsubackReasonCode.ImplementationSpecificError], + granted: [mqtt5.UnsubackReasonCode.NoSubscriptionExisted, mqtt5.UnsubackReasonCode.ImplementationSpecificError], properties: { reasonString: "Dunno", userProperties: { diff --git a/lib/browser/mqtt5_utils.ts b/lib/browser/mqtt5_utils.ts index 6470acab7..066a8f93c 100644 --- a/lib/browser/mqtt5_utils.ts +++ b/lib/browser/mqtt5_utils.ts @@ -5,6 +5,7 @@ */ import * as mqtt from "mqtt"; +import * as mqtt_packet from "mqtt-packet"; import * as mqtt_shared from "../common/mqtt_shared"; import * as mqtt5 from "./mqtt5"; import * as utils from "../common/utils"; @@ -97,7 +98,7 @@ function create_mqtt_js_will_from_crt_config(connectProperties? : mqtt5.ConnectP let will : any = { topic: crtWill.topicName, - payload: crtWill.payload ?? "", + payload: crtWill.payload ?? mqtt_shared.normalize_payload_to_buffer(""), qos: crtWill.qos, retain: crtWill.retain ?? false }; @@ -251,7 +252,7 @@ export function create_mqtt_js_client_config_from_crt_client_config(crtConfig : } /** @internal */ -export function transform_crt_user_properties_to_mqtt_js_user_properties(userProperties?: mqtt5.UserProperty[]) : mqtt.UserProperties | undefined { +export function transform_crt_user_properties_to_mqtt_js_user_properties(userProperties?: mqtt5.UserProperty[]) : mqtt_packet.UserProperties | undefined { if (!userProperties) { return undefined; } @@ -274,7 +275,7 @@ export function transform_crt_user_properties_to_mqtt_js_user_properties(userPro } /** @internal */ -export function transform_mqtt_js_user_properties_to_crt_user_properties(userProperties?: mqtt.UserProperties) : mqtt5.UserProperty[] | undefined { +export function transform_mqtt_js_user_properties_to_crt_user_properties(userProperties?: mqtt_packet.UserProperties) : mqtt5.UserProperty[] | undefined { if (!userProperties) { return undefined; } @@ -401,6 +402,25 @@ export function transform_crt_subscribe_to_mqtt_js_subscribe_options(subscribe: return options; } +/** @internal **/ +export function transform_mqtt_js_suback_to_crt_suback(mqttJsSuback: mqtt_packet.ISubackPacket) : mqtt5.SubackPacket { + if (!mqttJsSuback) { + throw new CrtError("transform_mqtt_js_suback_to_crt_suback: mqttJsSuback not defined"); + } + + let crtSuback : mqtt5.SubackPacket = { + type: mqtt5.PacketType.Suback, + reasonCodes : mqttJsSuback.granted.map((value, index, array) : mqtt5.SubackReasonCode => { return value as mqtt5.SubackReasonCode; }), + }; + + if (mqttJsSuback.properties) { + utils.set_defined_property(crtSuback, "reasonString", mqttJsSuback.properties?.reasonString); + utils.set_defined_property(crtSuback, "userProperties", transform_mqtt_js_user_properties_to_crt_user_properties(mqttJsSuback.properties?.userProperties)); + } + + return crtSuback; +} + /** @internal **/ export function transform_mqtt_js_subscription_grants_to_crt_suback(subscriptionsGranted: mqtt.ISubscriptionGrant[]) : mqtt5.SubackPacket { @@ -490,7 +510,7 @@ export function transform_mqtt_js_publish_to_crt_publish(publish: mqtt.IPublishP let subIdsType : string = typeof subIds; if (subIds) { if (subIdsType == 'number') { - crtPublish["subscriptionIdentifiers"] = [subIds]; + crtPublish["subscriptionIdentifiers"] = [subIds as number]; } else if (Array.isArray(subIds)) { crtPublish["subscriptionIdentifiers"] = subIds; } @@ -501,7 +521,7 @@ export function transform_mqtt_js_publish_to_crt_publish(publish: mqtt.IPublishP } /** @internal **/ -export function transform_mqtt_js_puback_to_crt_puback(puback: mqtt.IPubackPacket) : mqtt5.PubackPacket { +export function transform_mqtt_js_puback_to_crt_puback(puback: mqtt_packet.IPubackPacket) : mqtt5.PubackPacket { if (puback == null || puback == undefined) { throw new CrtError("transform_mqtt_js_puback_to_crt_puback: puback not defined"); @@ -521,7 +541,7 @@ export function transform_mqtt_js_puback_to_crt_puback(puback: mqtt.IPubackPacke } /** @internal **/ -export function transform_crt_unsubscribe_to_mqtt_js_unsubscribe_options(unsubscribe: mqtt5.UnsubscribePacket) : Object { +export function transform_crt_unsubscribe_to_mqtt_js_unsubscribe_options(unsubscribe: mqtt5.UnsubscribePacket) : any { if (unsubscribe == null || unsubscribe == undefined) { throw new CrtError("transform_crt_unsubscribe_to_mqtt_js_unsubscribe_options: unsubscribe not defined"); @@ -542,26 +562,15 @@ export function transform_crt_unsubscribe_to_mqtt_js_unsubscribe_options(unsubsc } /** @internal **/ -export function transform_mqtt_js_unsuback_to_crt_unsuback(packet: mqtt.IUnsubackPacket) : mqtt5.UnsubackPacket { +export function transform_mqtt_js_unsuback_to_crt_unsuback(packet: mqtt_packet.IUnsubackPacket) : mqtt5.UnsubackPacket { if (packet == null || packet == undefined) { throw new CrtError("transform_mqtt_js_unsuback_to_crt_unsuback: packet not defined"); } - let reasonCodes : number | number[] | undefined = packet.reasonCode; - - let codes : number[]; - if (Array.isArray(reasonCodes)) { - codes = reasonCodes; - } else if (typeof reasonCodes == 'number') { - codes = [reasonCodes]; - } else { - codes = []; - } - let crtUnsuback : mqtt5.UnsubackPacket = { type: mqtt5.PacketType.Unsuback, - reasonCodes : codes + reasonCodes : packet.granted } if (packet.properties) { diff --git a/lib/common/mqtt_shared.ts b/lib/common/mqtt_shared.ts index 1ebea5437..f10e11919 100644 --- a/lib/common/mqtt_shared.ts +++ b/lib/common/mqtt_shared.ts @@ -43,5 +43,20 @@ export function normalize_payload(payload: any): Buffer | string { throw new TypeError("payload parameter must be a string, object, or DataView."); } +/** + * Converts payload to Buffer only, regardless of the supplied type + * @param payload The payload to convert + * @internal + */ +export function normalize_payload_to_buffer(payload: any): Buffer { + let normalized = normalize_payload(payload); + if (typeof normalized === 'string') { + // pass string through + return Buffer.from(normalized); + } + + return normalized; +} + /** @internal */ export const DEFAULT_KEEP_ALIVE : number = 1200; diff --git a/package-lock.json b/package-lock.json index c25668ee0..d45723268 100644 --- a/package-lock.json +++ b/package-lock.json @@ -406,6 +406,14 @@ "@babel/helper-plugin-utils": "^7.24.7" } }, + "@babel/runtime": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.0.tgz", + "integrity": "sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==", + "requires": { + "regenerator-runtime": "^0.14.0" + } + }, "@babel/template": { "version": "7.25.0", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", @@ -882,10 +890,9 @@ } }, "@types/node": { - "version": "10.17.60", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", - "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==", - "dev": true + "version": "14.18.63", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz", + "integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==" }, "@types/prettier": { "version": "2.6.0", @@ -902,6 +909,22 @@ "@types/node": "*" } }, + "@types/readable-stream": { + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.15.tgz", + "integrity": "sha512-oAZ3kw+kJFkEqyh7xORZOku1YAKvsFTogRY8kVl4vHpEKiDkfnSA/My8haRE7fvmix5Zyy+1pwzOi7yycGLBJw==", + "requires": { + "@types/node": "*", + "safe-buffer": "~5.1.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, "@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -954,6 +977,14 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, "acorn": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", @@ -1221,7 +1252,8 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "base64-js": { "version": "1.5.1", @@ -1232,6 +1264,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, "requires": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -1242,6 +1275,7 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -1251,6 +1285,7 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -1263,6 +1298,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1491,18 +1527,15 @@ "dev": true }, "commist": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/commist/-/commist-1.1.0.tgz", - "integrity": "sha512-rraC8NXWOEjhADbZe9QBNzLAN5Q3fsTPQtBV+fEVj6xKIgDgNiEVE6ZNfHpZOqfQ21YUzfVNUXLOEZquYvQPPg==", - "requires": { - "leven": "^2.1.0", - "minimist": "^1.1.0" - } + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/commist/-/commist-3.2.0.tgz", + "integrity": "sha512-4PIMoPniho+LqXmpS5d3NuGYncG6XWlkBSVGiWycL22dd42OYdUGil2CWuzklaJoNxyxUSpO4MKIBU94viWNAw==" }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "concat-stream": { "version": "2.0.0", @@ -1790,6 +1823,11 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, "events": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", @@ -1875,6 +1913,15 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "fast-unique-numbers": { + "version": "8.0.13", + "resolved": "https://registry.npmjs.org/fast-unique-numbers/-/fast-unique-numbers-8.0.13.tgz", + "integrity": "sha512-7OnTFAVPefgw2eBJ1xj2PGGR9FwYzSUso9decayHgCDX4sJkHLdcsYTytTg+tYv+wKF3U8gJuSBz2jJpQV4u/g==", + "requires": { + "@babel/runtime": "^7.23.8", + "tslib": "^2.6.2" + } + }, "fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -2027,7 +2074,8 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "fsevents": { "version": "2.3.3", @@ -2099,6 +2147,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -2214,25 +2263,9 @@ } }, "help-me": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/help-me/-/help-me-3.0.0.tgz", - "integrity": "sha512-hx73jClhyk910sidBB7ERlnhMlFsJJIBqSVMFDwPN8o2v9nmp5KgLq1Xz1Bf1fCMMZ6mPrX159iG0VLy/fPMtQ==", - "requires": { - "glob": "^7.1.6", - "readable-stream": "^3.6.0" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", + "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==" }, "homedir-polyfill": { "version": "1.0.3", @@ -2319,6 +2352,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -3241,11 +3275,6 @@ "integrity": "sha512-RE2g0b5VGZsOCFOCgP7omTRYFqydmZkBwl5oNnQ1lDYC57uyO9KqNnNVxT7COSHTxrRCWVcAVOcbjk+tvh/rgQ==", "dev": true }, - "leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==" - }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -3280,12 +3309,9 @@ "dev": true }, "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" }, "lunr": { "version": "2.3.9", @@ -3401,6 +3427,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3468,65 +3495,109 @@ "dev": true }, "mqtt": { - "version": "4.3.8", - "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-4.3.8.tgz", - "integrity": "sha512-2xT75uYa0kiPEF/PE0VPdavmEkoBzMT/UL9moid0rAvlCtV48qBwxD62m7Ld/4j8tSkIO1E/iqRl/S72SEOhOw==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.10.0.tgz", + "integrity": "sha512-2qpkUi5Ftp8cBX4sPCh/yr4ULBfLFQkjlhTGVpilHznOlsmDWIligmT1anSaJ1FqiH29RONNZJXhcJQaFwddgQ==", "requires": { - "commist": "^1.0.0", + "@types/readable-stream": "^4.0.5", + "@types/ws": "^8.5.9", + "commist": "^3.2.0", "concat-stream": "^2.0.0", - "debug": "^4.1.1", - "duplexify": "^4.1.1", - "help-me": "^3.0.0", - "inherits": "^2.0.3", - "lru-cache": "^6.0.0", - "minimist": "^1.2.5", - "mqtt-packet": "^6.8.0", - "number-allocator": "^1.0.9", - "pump": "^3.0.0", - "readable-stream": "^3.6.0", + "debug": "^4.3.4", + "help-me": "^5.0.0", + "lru-cache": "^10.0.1", + "minimist": "^1.2.8", + "mqtt-packet": "^9.0.0", + "number-allocator": "^1.0.14", + "readable-stream": "^4.4.2", "reinterval": "^1.1.0", "rfdc": "^1.3.0", - "split2": "^3.1.0", - "ws": "^7.5.5", - "xtend": "^4.0.2" + "split2": "^4.2.0", + "worker-timers": "^7.1.4", + "ws": "^8.17.1" }, "dependencies": { - "duplexify": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.3.tgz", - "integrity": "sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==", + "@types/ws": { + "version": "8.5.12", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", + "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==", "requires": { - "end-of-stream": "^1.4.1", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1", - "stream-shift": "^1.0.2" + "@types/node": "*" } }, + "events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" + }, "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" } }, - "ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==" + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } } } }, "mqtt-packet": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-6.10.0.tgz", - "integrity": "sha512-ja8+mFKIHdB1Tpl6vac+sktqy3gA8t9Mduom1BA75cI+R9AHnZOiaBQwpGiWnaVJLDGRdNhQmFaAqd7tkKSMGA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-9.0.0.tgz", + "integrity": "sha512-8v+HkX+fwbodsWAZIZTI074XIoxVBOmPeggQuDFCGg1SqNcC+uoRMWu7J6QlJPqIUIJXmjNYYHxBBLr1Y/Df4w==", "requires": { - "bl": "^4.0.2", - "debug": "^4.1.1", + "bl": "^6.0.8", + "debug": "^4.3.4", "process-nextick-args": "^2.0.1" + }, + "dependencies": { + "bl": { + "version": "6.0.14", + "resolved": "https://registry.npmjs.org/bl/-/bl-6.0.14.tgz", + "integrity": "sha512-TJfbvGdL7KFGxTsEbsED7avqpFdY56q9IW0/aiytyheJzxST/+Io6cx/4Qx0K2/u0BPRDs65mjaQzYvMZeNocQ==", + "requires": { + "@types/readable-stream": "^4.0.0", + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^4.2.0" + } + }, + "events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" + }, + "readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "requires": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + } } }, "ms": { @@ -3680,7 +3751,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true }, "path-key": { "version": "3.1.1", @@ -3793,6 +3865,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -3897,6 +3970,11 @@ } } }, + "regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "reinterval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/reinterval/-/reinterval-1.1.0.tgz", @@ -4142,24 +4220,9 @@ } }, "split2": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", - "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", - "requires": { - "readable-stream": "^3.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==" }, "sprintf-js": { "version": "1.0.3", @@ -4852,6 +4915,37 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, + "worker-timers": { + "version": "7.1.8", + "resolved": "https://registry.npmjs.org/worker-timers/-/worker-timers-7.1.8.tgz", + "integrity": "sha512-R54psRKYVLuzff7c1OTFcq/4Hue5Vlz4bFtNEIarpSiCYhpifHU3aIQI29S84o1j87ePCYqbmEJPqwBTf+3sfw==", + "requires": { + "@babel/runtime": "^7.24.5", + "tslib": "^2.6.2", + "worker-timers-broker": "^6.1.8", + "worker-timers-worker": "^7.0.71" + } + }, + "worker-timers-broker": { + "version": "6.1.8", + "resolved": "https://registry.npmjs.org/worker-timers-broker/-/worker-timers-broker-6.1.8.tgz", + "integrity": "sha512-FUCJu9jlK3A8WqLTKXM9E6kAmI/dR1vAJ8dHYLMisLNB/n3GuaFIjJ7pn16ZcD1zCOf7P6H62lWIEBi+yz/zQQ==", + "requires": { + "@babel/runtime": "^7.24.5", + "fast-unique-numbers": "^8.0.13", + "tslib": "^2.6.2", + "worker-timers-worker": "^7.0.71" + } + }, + "worker-timers-worker": { + "version": "7.0.71", + "resolved": "https://registry.npmjs.org/worker-timers-worker/-/worker-timers-worker-7.0.71.tgz", + "integrity": "sha512-ks/5YKwZsto1c2vmljroppOKCivB/ma97g9y77MAAz2TBBjPPgpoOiS1qYQKIgvGTr2QYPT3XhJWIB6Rj2MVPQ==", + "requires": { + "@babel/runtime": "^7.24.5", + "tslib": "^2.6.2" + } + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -4927,7 +5021,8 @@ "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "yargs": { "version": "17.7.2", diff --git a/package.json b/package.json index a3753627f..7042149a6 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "devDependencies": { "@types/crypto-js": "^3.1.43", "@types/jest": "^27.0.1", - "@types/node": "^10.17.54", + "@types/node": "^14.18.63", "@types/prettier": "2.6.0", "@types/puppeteer": "^5.4.7", "@types/uuid": "^3.4.13", @@ -54,7 +54,7 @@ "axios": "^1.7.4", "buffer": "^6.0.3", "crypto-js": "^4.2.0", - "mqtt": "^4.3.8", + "mqtt": "^5.9.1", "process": "^0.11.10" } } diff --git a/test/mqtt5.ts b/test/mqtt5.ts index 3109c1129..e49332bb6 100644 --- a/test/mqtt5.ts +++ b/test/mqtt5.ts @@ -379,12 +379,14 @@ export async function subPubUnsubTest(client: mqtt5.Mqtt5Client, qos: mqtt5.QoS, await connectionSuccess; - await client.subscribe({ + const suback = await client.subscribe({ subscriptions: [ { qos : mqtt5.QoS.AtLeastOnce, topicFilter: topic } ] }); + expect(suback.reasonCodes).toEqual([mqtt5.QoS.AtLeastOnce]) + await client.publish({ topicName: topic, qos: qos, @@ -393,10 +395,12 @@ export async function subPubUnsubTest(client: mqtt5.Mqtt5Client, qos: mqtt5.QoS, await messageReceived; - await client.unsubscribe({ + const unsuback = await client.unsubscribe({ topicFilters: [ topic ] }); + expect(unsuback.reasonCodes).toEqual([mqtt5.UnsubackReasonCode.Success]) + await client.publish({ topicName: topic, qos: mqtt5.QoS.AtLeastOnce,