@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.d.cts
CHANGED
|
@@ -1272,6 +1272,23 @@ declare class VacuumDevice extends BaseDevice<VacuumDeviceEvents> {
|
|
|
1272
1272
|
refreshFromCache(): Promise<void>;
|
|
1273
1273
|
/** The most-recently-decoded map, or `null` until {@link getMap} succeeds. */
|
|
1274
1274
|
get lastMap(): VacuumMap | null;
|
|
1275
|
+
/**
|
|
1276
|
+
* The OSS object name of the latest map frame the robot advertised via its
|
|
1277
|
+
* PATH push (siid 6 piid 3), or `null` when none has been observed yet (the
|
|
1278
|
+
* robot has not uploaded a map since connect). This is the `filename` to pass
|
|
1279
|
+
* to {@link getMap} — or just call {@link fetchLatestMap}.
|
|
1280
|
+
*/
|
|
1281
|
+
get mapFilename(): string | null;
|
|
1282
|
+
/**
|
|
1283
|
+
* Convenience: fetch + decode the LATEST map frame the robot advertised,
|
|
1284
|
+
* reading {@link mapFilename} and delegating to {@link getMap}. Returns `null`
|
|
1285
|
+
* when no map filename has been observed yet (vs throwing) so a consumer can
|
|
1286
|
+
* poll it safely; once a filename is present it behaves exactly like
|
|
1287
|
+
* {@link getMap} (capability-gated on `canMap`, caches {@link lastMap}, emits
|
|
1288
|
+
* `'map'`). The `fetcher`/`key`/`iv`/`host`/`timeoutMs`/`signal` overrides are
|
|
1289
|
+
* forwarded verbatim.
|
|
1290
|
+
*/
|
|
1291
|
+
fetchLatestMap(opts?: Omit<VacuumGetMapInput, 'filename'>): Promise<VacuumMap | null>;
|
|
1275
1292
|
/**
|
|
1276
1293
|
* The current room/segment id, derived from the most-recently-decoded map's
|
|
1277
1294
|
* active-segment set (`sa`). `null` when no map has been fetched or no
|
package/dist/index.d.ts
CHANGED
|
@@ -1272,6 +1272,23 @@ declare class VacuumDevice extends BaseDevice<VacuumDeviceEvents> {
|
|
|
1272
1272
|
refreshFromCache(): Promise<void>;
|
|
1273
1273
|
/** The most-recently-decoded map, or `null` until {@link getMap} succeeds. */
|
|
1274
1274
|
get lastMap(): VacuumMap | null;
|
|
1275
|
+
/**
|
|
1276
|
+
* The OSS object name of the latest map frame the robot advertised via its
|
|
1277
|
+
* PATH push (siid 6 piid 3), or `null` when none has been observed yet (the
|
|
1278
|
+
* robot has not uploaded a map since connect). This is the `filename` to pass
|
|
1279
|
+
* to {@link getMap} — or just call {@link fetchLatestMap}.
|
|
1280
|
+
*/
|
|
1281
|
+
get mapFilename(): string | null;
|
|
1282
|
+
/**
|
|
1283
|
+
* Convenience: fetch + decode the LATEST map frame the robot advertised,
|
|
1284
|
+
* reading {@link mapFilename} and delegating to {@link getMap}. Returns `null`
|
|
1285
|
+
* when no map filename has been observed yet (vs throwing) so a consumer can
|
|
1286
|
+
* poll it safely; once a filename is present it behaves exactly like
|
|
1287
|
+
* {@link getMap} (capability-gated on `canMap`, caches {@link lastMap}, emits
|
|
1288
|
+
* `'map'`). The `fetcher`/`key`/`iv`/`host`/`timeoutMs`/`signal` overrides are
|
|
1289
|
+
* forwarded verbatim.
|
|
1290
|
+
*/
|
|
1291
|
+
fetchLatestMap(opts?: Omit<VacuumGetMapInput, 'filename'>): Promise<VacuumMap | null>;
|
|
1275
1292
|
/**
|
|
1276
1293
|
* The current room/segment id, derived from the most-recently-decoded map's
|
|
1277
1294
|
* active-segment set (`sa`). `null` when no map has been fetched or no
|
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.3.
|
|
3
|
+
var LIBRARY_VERSION = "1.3.1";
|
|
4
4
|
|
|
5
5
|
// src/transport/errors.ts
|
|
6
6
|
var DreameError = class extends Error {
|
|
@@ -1152,7 +1152,14 @@ var VACUUM_PROP = {
|
|
|
1152
1152
|
/** VERIFIED r2532a 2026-05-03 — task progress percentage 0..100. */
|
|
1153
1153
|
TASK_PROGRESS_PCT: { siid: 4, piid: 63 },
|
|
1154
1154
|
/** VERIFIED r2532a — mop-drying progress (minutes ticking during MopDrying). */
|
|
1155
|
-
DRYING_PROGRESS: { siid: 4, piid: 64 }
|
|
1155
|
+
DRYING_PROGRESS: { siid: 4, piid: 64 },
|
|
1156
|
+
/**
|
|
1157
|
+
* Map "PATH" push — the OSS object name of the latest map frame the robot
|
|
1158
|
+
* uploaded (the value passed to {@link VacuumDevice.getMap}). Arrives via the
|
|
1159
|
+
* MQTT push during/after cleaning; NOT in `DEFAULT_PROPS` because it is not
|
|
1160
|
+
* polled (it is pushed). Read it through {@link VacuumDevice.mapFilename}.
|
|
1161
|
+
*/
|
|
1162
|
+
MAP_PATH: { siid: 6, piid: 3 }
|
|
1156
1163
|
};
|
|
1157
1164
|
var VACUUM_ACTION = {
|
|
1158
1165
|
/** ASSUMED Tasshack — start cleaning. */
|
|
@@ -2808,6 +2815,30 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
|
|
|
2808
2815
|
get lastMap() {
|
|
2809
2816
|
return this.#lastMap;
|
|
2810
2817
|
}
|
|
2818
|
+
/**
|
|
2819
|
+
* The OSS object name of the latest map frame the robot advertised via its
|
|
2820
|
+
* PATH push (siid 6 piid 3), or `null` when none has been observed yet (the
|
|
2821
|
+
* robot has not uploaded a map since connect). This is the `filename` to pass
|
|
2822
|
+
* to {@link getMap} — or just call {@link fetchLatestMap}.
|
|
2823
|
+
*/
|
|
2824
|
+
get mapFilename() {
|
|
2825
|
+
const v = this.getProperty(VACUUM_PROP.MAP_PATH.siid, VACUUM_PROP.MAP_PATH.piid)?.value;
|
|
2826
|
+
return typeof v === "string" && v.length > 0 ? v : null;
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* Convenience: fetch + decode the LATEST map frame the robot advertised,
|
|
2830
|
+
* reading {@link mapFilename} and delegating to {@link getMap}. Returns `null`
|
|
2831
|
+
* when no map filename has been observed yet (vs throwing) so a consumer can
|
|
2832
|
+
* poll it safely; once a filename is present it behaves exactly like
|
|
2833
|
+
* {@link getMap} (capability-gated on `canMap`, caches {@link lastMap}, emits
|
|
2834
|
+
* `'map'`). The `fetcher`/`key`/`iv`/`host`/`timeoutMs`/`signal` overrides are
|
|
2835
|
+
* forwarded verbatim.
|
|
2836
|
+
*/
|
|
2837
|
+
async fetchLatestMap(opts = {}) {
|
|
2838
|
+
const filename = this.mapFilename;
|
|
2839
|
+
if (filename === null) return null;
|
|
2840
|
+
return this.getMap({ filename, ...opts });
|
|
2841
|
+
}
|
|
2811
2842
|
/**
|
|
2812
2843
|
* The current room/segment id, derived from the most-recently-decoded map's
|
|
2813
2844
|
* active-segment set (`sa`). `null` when no map has been fetched or no
|
|
@@ -4089,6 +4120,10 @@ var REDACTED = "[redacted]";
|
|
|
4089
4120
|
var SENSITIVE_KEY_FRAGMENTS = [
|
|
4090
4121
|
// identity / secrets
|
|
4091
4122
|
"did",
|
|
4123
|
+
// `deviceid` is listed explicitly: the bare `did` fragment does NOT match
|
|
4124
|
+
// `deviceid` (the substring `did` is absent from `d-e-v-i-c-e-i-d`), yet
|
|
4125
|
+
// base-device sets the real `did` as `deviceId` on raw payloads (FIX 1).
|
|
4126
|
+
"deviceid",
|
|
4092
4127
|
"uid",
|
|
4093
4128
|
"token",
|
|
4094
4129
|
// accessToken, refreshToken, refresh_token, token_type stripped too (safe)
|
|
@@ -4127,14 +4162,24 @@ var SENSITIVE_KEY_FRAGMENTS = [
|
|
|
4127
4162
|
"areaname",
|
|
4128
4163
|
"segmentname",
|
|
4129
4164
|
"segment_name",
|
|
4165
|
+
// room/zone/map names are user-set PII (FIX 3).
|
|
4166
|
+
"zone_name",
|
|
4167
|
+
"zonename",
|
|
4168
|
+
"map_name",
|
|
4169
|
+
"mapname",
|
|
4130
4170
|
// map binary / geometry (location-revealing)
|
|
4131
4171
|
"map_info",
|
|
4132
4172
|
"mapinfo",
|
|
4133
4173
|
"mapblob",
|
|
4134
4174
|
// free-text device names that may carry PII. NOTE: the bare fragment `name` is
|
|
4135
4175
|
// intentionally NOT listed — it would over-match the catalog's command `name`
|
|
4136
|
-
// field (an enum-derived, non-sensitive label).
|
|
4137
|
-
//
|
|
4176
|
+
// field (an enum-derived, non-sensitive label like `START`). ACCEPTED
|
|
4177
|
+
// TRADE-OFF: a bare `{ name: "..." }` in an event argument is NOT scrubbed by
|
|
4178
|
+
// key. This is mitigated in practice by (a) the value-sanitizer below
|
|
4179
|
+
// (sanitizeStringValue, applied to EVERY string scalar — it catches OSS
|
|
4180
|
+
// paths / URLs / tokens regardless of key), and (b) the specific
|
|
4181
|
+
// customName/deviceName/nickName/zoneName/mapName fragments which cover the
|
|
4182
|
+
// realistic PII-bearing name cases.
|
|
4138
4183
|
"customname",
|
|
4139
4184
|
"devicename",
|
|
4140
4185
|
"nickname"
|
|
@@ -4150,6 +4195,21 @@ function isSensitiveKey(key2) {
|
|
|
4150
4195
|
function isPlainObject(v) {
|
|
4151
4196
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4152
4197
|
}
|
|
4198
|
+
var RISKY_VALUE_PATTERNS = [
|
|
4199
|
+
/:\/\//,
|
|
4200
|
+
// any URL scheme (https://, mqtts://, …) — signed URLs carry tokens
|
|
4201
|
+
/ali_dreame\//i,
|
|
4202
|
+
// OSS object path embedding uid/did
|
|
4203
|
+
/[A-Za-z0-9_-]{32,}/,
|
|
4204
|
+
// a long opaque token run (base64/hex secrets)
|
|
4205
|
+
/\b(did|uid|token)\s*=/i,
|
|
4206
|
+
// query-param secrets (?did=…&token=…)
|
|
4207
|
+
/access/i
|
|
4208
|
+
// accessKey / access-token / x-access-key style markers
|
|
4209
|
+
];
|
|
4210
|
+
function sanitizeStringValue(s) {
|
|
4211
|
+
return RISKY_VALUE_PATTERNS.some((re) => re.test(s)) ? REDACTED : s;
|
|
4212
|
+
}
|
|
4153
4213
|
function redact(value) {
|
|
4154
4214
|
if (Array.isArray(value)) {
|
|
4155
4215
|
return value.map((v) => redact(v));
|
|
@@ -4161,6 +4221,9 @@ function redact(value) {
|
|
|
4161
4221
|
}
|
|
4162
4222
|
return out;
|
|
4163
4223
|
}
|
|
4224
|
+
if (typeof value === "string") {
|
|
4225
|
+
return sanitizeStringValue(value);
|
|
4226
|
+
}
|
|
4164
4227
|
return value;
|
|
4165
4228
|
}
|
|
4166
4229
|
|