@apocaliss92/nodedreame 1.11.2 → 1.11.3
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.cjs +9 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/support/version.ts
|
|
2
2
|
var LIBRARY_NAME = "nodedreame";
|
|
3
|
-
var LIBRARY_VERSION = "1.11.
|
|
3
|
+
var LIBRARY_VERSION = "1.11.3";
|
|
4
4
|
|
|
5
5
|
// src/transport/errors.ts
|
|
6
6
|
var DreameError = class extends Error {
|
|
@@ -58,8 +58,11 @@ function buildRlcHeader(region, lang, country) {
|
|
|
58
58
|
function randomMqttClientId() {
|
|
59
59
|
return "p_" + randomBytes(8).toString("hex");
|
|
60
60
|
}
|
|
61
|
+
var MAX_REQUEST_ID = 16777215;
|
|
62
|
+
var nextRequestId = Math.floor(Math.random() * 100) + 1;
|
|
61
63
|
function randomRequestId() {
|
|
62
|
-
|
|
64
|
+
nextRequestId = nextRequestId >= MAX_REQUEST_ID ? 1 : nextRequestId + 1;
|
|
65
|
+
return nextRequestId;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
// src/auth/config.ts
|
|
@@ -258,7 +261,7 @@ var OAuthTokenResponseSchema = z.object({
|
|
|
258
261
|
error: z.string().optional(),
|
|
259
262
|
error_description: z.string().optional(),
|
|
260
263
|
code: z.number().optional(),
|
|
261
|
-
msg: z.string().
|
|
264
|
+
msg: z.string().nullish()
|
|
262
265
|
}).passthrough();
|
|
263
266
|
var RawDeviceSchema = z.object({
|
|
264
267
|
did: z.union([z.string(), z.number()]).optional(),
|
|
@@ -273,7 +276,7 @@ var RawDeviceSchema = z.object({
|
|
|
273
276
|
}).passthrough();
|
|
274
277
|
var DeviceListResponseSchema = z.object({
|
|
275
278
|
code: z.number().optional(),
|
|
276
|
-
msg: z.string().
|
|
279
|
+
msg: z.string().nullish(),
|
|
277
280
|
data: z.object({
|
|
278
281
|
page: z.object({ records: z.array(RawDeviceSchema).optional() }).partial().optional(),
|
|
279
282
|
records: z.array(RawDeviceSchema).optional()
|
|
@@ -293,12 +296,12 @@ var CachedPropEntrySchema = z.object({
|
|
|
293
296
|
}).passthrough();
|
|
294
297
|
var CachedPropsResponseSchema = z.object({
|
|
295
298
|
code: z.number().optional(),
|
|
296
|
-
msg: z.string().
|
|
299
|
+
msg: z.string().nullish(),
|
|
297
300
|
data: z.array(CachedPropEntrySchema).optional()
|
|
298
301
|
}).passthrough();
|
|
299
302
|
var SendCommandResponseSchema = z.object({
|
|
300
303
|
code: z.number().optional(),
|
|
301
|
-
msg: z.string().
|
|
304
|
+
msg: z.string().nullish(),
|
|
302
305
|
data: z.object({ result: z.unknown().optional() }).passthrough().optional(),
|
|
303
306
|
result: z.unknown().optional()
|
|
304
307
|
}).passthrough();
|