@apocaliss92/nodedreame 1.3.1 → 1.5.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 CHANGED
@@ -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,47 @@ 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
+ }
2911
+ /**
2912
+ * Seed {@link mapFilename} from the CLOUD SHADOW (the last value the robot
2913
+ * pushed for siid 6 piid 3) WITHOUT waking it — so a docked/idle robot can
2914
+ * surface its LAST cleaning map without a fresh clean. Emits the usual
2915
+ * `propertyChanged`/`stateChanged` (so a map-watching consumer re-renders) and
2916
+ * returns the resolved {@link mapFilename} (null when the model has no map or
2917
+ * the shadow carries no map path yet).
2918
+ *
2919
+ * NOTE: the shadow holds the last LIVE-PATH filename; its OSS blob may have
2920
+ * expired, in which case a follow-up {@link fetchLatestMap} rejects — treat
2921
+ * that as "no saved map available".
2922
+ */
2923
+ async refreshSavedMapFilename() {
2924
+ if (!this.#caps.canMap) return null;
2925
+ await this.refreshCachedProperties([VACUUM_PROP.MAP_PATH]);
2926
+ return this.mapFilename;
2927
+ }
2880
2928
  /**
2881
2929
  * The current room/segment id, derived from the most-recently-decoded map's
2882
2930
  * active-segment set (`sa`). `null` when no map has been fetched or no