@mega-yfue/eufy-sdk 0.3.0-beta.6 → 0.3.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/index.js +22 -3
- package/dist/index.js.map +2 -2
- package/dist/transport/mqtt/secure-mqtt.d.ts +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2131,6 +2131,13 @@ function isNotAuthorized(err) {
|
|
|
2131
2131
|
var SecureMqtt = class extends EventEmitter {
|
|
2132
2132
|
kind = "smqtt";
|
|
2133
2133
|
client;
|
|
2134
|
+
/**
|
|
2135
|
+
* The in-flight or established connect. A client ID is exclusive at the broker, so a second mqtt.js
|
|
2136
|
+
* client under the same ID evicts the first, which reconnects and evicts it back, forever; `connect()`
|
|
2137
|
+
* therefore hands a later caller this same attempt instead of opening a rival. Cleared when the
|
|
2138
|
+
* attempt fails and on `disconnect()`, so a caller can still retry or deliberately reconnect.
|
|
2139
|
+
*/
|
|
2140
|
+
connecting;
|
|
2134
2141
|
o;
|
|
2135
2142
|
logger;
|
|
2136
2143
|
constructor(opts) {
|
|
@@ -2141,11 +2148,19 @@ var SecureMqtt = class extends EventEmitter {
|
|
|
2141
2148
|
get id() {
|
|
2142
2149
|
return this.o.clientId ?? this.o.credentials.thing_name ?? "";
|
|
2143
2150
|
}
|
|
2151
|
+
/** Connect, joining the attempt in `connecting` when one is already opening or open. */
|
|
2152
|
+
async connect() {
|
|
2153
|
+
this.connecting ??= this.open().catch((error) => {
|
|
2154
|
+
this.connecting = void 0;
|
|
2155
|
+
throw error;
|
|
2156
|
+
});
|
|
2157
|
+
return await this.connecting;
|
|
2158
|
+
}
|
|
2144
2159
|
/**
|
|
2145
2160
|
* Open the broker connection, resolving once it is established. Pinned to a broker instance's IP, or
|
|
2146
2161
|
* to the plain hostname; only the former needs its own TLS shape, see `./bare-ip-tls.ts`.
|
|
2147
2162
|
*/
|
|
2148
|
-
async
|
|
2163
|
+
async open() {
|
|
2149
2164
|
const mqtt = await loadMqtt();
|
|
2150
2165
|
const c = this.o.credentials;
|
|
2151
2166
|
const port = c.endpoint_port ?? 8883;
|
|
@@ -2273,6 +2288,7 @@ var SecureMqtt = class extends EventEmitter {
|
|
|
2273
2288
|
await this.client.publishAsync(topic, body, { qos: opts.qos ?? 1 });
|
|
2274
2289
|
}
|
|
2275
2290
|
async disconnect() {
|
|
2291
|
+
this.connecting = void 0;
|
|
2276
2292
|
await this.client?.endAsync(true);
|
|
2277
2293
|
this.client = void 0;
|
|
2278
2294
|
}
|
|
@@ -11606,10 +11622,13 @@ var SECURITY_PARAMS = {
|
|
|
11606
11622
|
type: "number",
|
|
11607
11623
|
provenance: "apk"
|
|
11608
11624
|
},
|
|
11625
|
+
// Cameras and a HomeBase 3 answer a bare number; a HomeBase S1 Pro (T9000) answers a JSON envelope
|
|
11626
|
+
// (`{"ai_switch":1,"smart_detection":…,"devlist":[…]}`).
|
|
11609
11627
|
1299: {
|
|
11610
11628
|
name: "hbAiDetectType",
|
|
11611
|
-
type: "
|
|
11612
|
-
provenance: "apk"
|
|
11629
|
+
type: "string",
|
|
11630
|
+
provenance: "apk",
|
|
11631
|
+
encoding: "json"
|
|
11613
11632
|
},
|
|
11614
11633
|
1309: {
|
|
11615
11634
|
name: "solarIntensity",
|