@apocaliss92/nodedreame 1.3.0 → 1.4.0
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 +67 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +67 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -69,7 +69,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
69
69
|
|
|
70
70
|
// src/support/version.ts
|
|
71
71
|
var LIBRARY_NAME = "nodedreame";
|
|
72
|
-
var LIBRARY_VERSION = "1.3.
|
|
72
|
+
var LIBRARY_VERSION = "1.3.1";
|
|
73
73
|
|
|
74
74
|
// src/transport/errors.ts
|
|
75
75
|
var DreameError = class extends Error {
|
|
@@ -1221,7 +1221,14 @@ var VACUUM_PROP = {
|
|
|
1221
1221
|
/** VERIFIED r2532a 2026-05-03 — task progress percentage 0..100. */
|
|
1222
1222
|
TASK_PROGRESS_PCT: { siid: 4, piid: 63 },
|
|
1223
1223
|
/** VERIFIED r2532a — mop-drying progress (minutes ticking during MopDrying). */
|
|
1224
|
-
DRYING_PROGRESS: { siid: 4, piid: 64 }
|
|
1224
|
+
DRYING_PROGRESS: { siid: 4, piid: 64 },
|
|
1225
|
+
/**
|
|
1226
|
+
* Map "PATH" push — the OSS object name of the latest map frame the robot
|
|
1227
|
+
* uploaded (the value passed to {@link VacuumDevice.getMap}). Arrives via the
|
|
1228
|
+
* MQTT push during/after cleaning; NOT in `DEFAULT_PROPS` because it is not
|
|
1229
|
+
* polled (it is pushed). Read it through {@link VacuumDevice.mapFilename}.
|
|
1230
|
+
*/
|
|
1231
|
+
MAP_PATH: { siid: 6, piid: 3 }
|
|
1225
1232
|
};
|
|
1226
1233
|
var VACUUM_ACTION = {
|
|
1227
1234
|
/** ASSUMED Tasshack — start cleaning. */
|
|
@@ -2877,6 +2884,30 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
|
|
|
2877
2884
|
get lastMap() {
|
|
2878
2885
|
return this.#lastMap;
|
|
2879
2886
|
}
|
|
2887
|
+
/**
|
|
2888
|
+
* The OSS object name of the latest map frame the robot advertised via its
|
|
2889
|
+
* PATH push (siid 6 piid 3), or `null` when none has been observed yet (the
|
|
2890
|
+
* robot has not uploaded a map since connect). This is the `filename` to pass
|
|
2891
|
+
* to {@link getMap} — or just call {@link fetchLatestMap}.
|
|
2892
|
+
*/
|
|
2893
|
+
get mapFilename() {
|
|
2894
|
+
const v = this.getProperty(VACUUM_PROP.MAP_PATH.siid, VACUUM_PROP.MAP_PATH.piid)?.value;
|
|
2895
|
+
return typeof v === "string" && v.length > 0 ? v : null;
|
|
2896
|
+
}
|
|
2897
|
+
/**
|
|
2898
|
+
* Convenience: fetch + decode the LATEST map frame the robot advertised,
|
|
2899
|
+
* reading {@link mapFilename} and delegating to {@link getMap}. Returns `null`
|
|
2900
|
+
* when no map filename has been observed yet (vs throwing) so a consumer can
|
|
2901
|
+
* poll it safely; once a filename is present it behaves exactly like
|
|
2902
|
+
* {@link getMap} (capability-gated on `canMap`, caches {@link lastMap}, emits
|
|
2903
|
+
* `'map'`). The `fetcher`/`key`/`iv`/`host`/`timeoutMs`/`signal` overrides are
|
|
2904
|
+
* forwarded verbatim.
|
|
2905
|
+
*/
|
|
2906
|
+
async fetchLatestMap(opts = {}) {
|
|
2907
|
+
const filename = this.mapFilename;
|
|
2908
|
+
if (filename === null) return null;
|
|
2909
|
+
return this.getMap({ filename, ...opts });
|
|
2910
|
+
}
|
|
2880
2911
|
/**
|
|
2881
2912
|
* The current room/segment id, derived from the most-recently-decoded map's
|
|
2882
2913
|
* active-segment set (`sa`). `null` when no map has been fetched or no
|
|
@@ -4158,6 +4189,10 @@ var REDACTED = "[redacted]";
|
|
|
4158
4189
|
var SENSITIVE_KEY_FRAGMENTS = [
|
|
4159
4190
|
// identity / secrets
|
|
4160
4191
|
"did",
|
|
4192
|
+
// `deviceid` is listed explicitly: the bare `did` fragment does NOT match
|
|
4193
|
+
// `deviceid` (the substring `did` is absent from `d-e-v-i-c-e-i-d`), yet
|
|
4194
|
+
// base-device sets the real `did` as `deviceId` on raw payloads (FIX 1).
|
|
4195
|
+
"deviceid",
|
|
4161
4196
|
"uid",
|
|
4162
4197
|
"token",
|
|
4163
4198
|
// accessToken, refreshToken, refresh_token, token_type stripped too (safe)
|
|
@@ -4196,14 +4231,24 @@ var SENSITIVE_KEY_FRAGMENTS = [
|
|
|
4196
4231
|
"areaname",
|
|
4197
4232
|
"segmentname",
|
|
4198
4233
|
"segment_name",
|
|
4234
|
+
// room/zone/map names are user-set PII (FIX 3).
|
|
4235
|
+
"zone_name",
|
|
4236
|
+
"zonename",
|
|
4237
|
+
"map_name",
|
|
4238
|
+
"mapname",
|
|
4199
4239
|
// map binary / geometry (location-revealing)
|
|
4200
4240
|
"map_info",
|
|
4201
4241
|
"mapinfo",
|
|
4202
4242
|
"mapblob",
|
|
4203
4243
|
// free-text device names that may carry PII. NOTE: the bare fragment `name` is
|
|
4204
4244
|
// intentionally NOT listed — it would over-match the catalog's command `name`
|
|
4205
|
-
// field (an enum-derived, non-sensitive label).
|
|
4206
|
-
//
|
|
4245
|
+
// field (an enum-derived, non-sensitive label like `START`). ACCEPTED
|
|
4246
|
+
// TRADE-OFF: a bare `{ name: "..." }` in an event argument is NOT scrubbed by
|
|
4247
|
+
// key. This is mitigated in practice by (a) the value-sanitizer below
|
|
4248
|
+
// (sanitizeStringValue, applied to EVERY string scalar — it catches OSS
|
|
4249
|
+
// paths / URLs / tokens regardless of key), and (b) the specific
|
|
4250
|
+
// customName/deviceName/nickName/zoneName/mapName fragments which cover the
|
|
4251
|
+
// realistic PII-bearing name cases.
|
|
4207
4252
|
"customname",
|
|
4208
4253
|
"devicename",
|
|
4209
4254
|
"nickname"
|
|
@@ -4219,6 +4264,21 @@ function isSensitiveKey(key2) {
|
|
|
4219
4264
|
function isPlainObject(v) {
|
|
4220
4265
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4221
4266
|
}
|
|
4267
|
+
var RISKY_VALUE_PATTERNS = [
|
|
4268
|
+
/:\/\//,
|
|
4269
|
+
// any URL scheme (https://, mqtts://, …) — signed URLs carry tokens
|
|
4270
|
+
/ali_dreame\//i,
|
|
4271
|
+
// OSS object path embedding uid/did
|
|
4272
|
+
/[A-Za-z0-9_-]{32,}/,
|
|
4273
|
+
// a long opaque token run (base64/hex secrets)
|
|
4274
|
+
/\b(did|uid|token)\s*=/i,
|
|
4275
|
+
// query-param secrets (?did=…&token=…)
|
|
4276
|
+
/access/i
|
|
4277
|
+
// accessKey / access-token / x-access-key style markers
|
|
4278
|
+
];
|
|
4279
|
+
function sanitizeStringValue(s) {
|
|
4280
|
+
return RISKY_VALUE_PATTERNS.some((re) => re.test(s)) ? REDACTED : s;
|
|
4281
|
+
}
|
|
4222
4282
|
function redact(value) {
|
|
4223
4283
|
if (Array.isArray(value)) {
|
|
4224
4284
|
return value.map((v) => redact(v));
|
|
@@ -4230,6 +4290,9 @@ function redact(value) {
|
|
|
4230
4290
|
}
|
|
4231
4291
|
return out;
|
|
4232
4292
|
}
|
|
4293
|
+
if (typeof value === "string") {
|
|
4294
|
+
return sanitizeStringValue(value);
|
|
4295
|
+
}
|
|
4233
4296
|
return value;
|
|
4234
4297
|
}
|
|
4235
4298
|
|