@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.d.cts CHANGED
@@ -1272,6 +1272,36 @@ 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>;
1292
+ /**
1293
+ * Seed {@link mapFilename} from the CLOUD SHADOW (the last value the robot
1294
+ * pushed for siid 6 piid 3) WITHOUT waking it — so a docked/idle robot can
1295
+ * surface its LAST cleaning map without a fresh clean. Emits the usual
1296
+ * `propertyChanged`/`stateChanged` (so a map-watching consumer re-renders) and
1297
+ * returns the resolved {@link mapFilename} (null when the model has no map or
1298
+ * the shadow carries no map path yet).
1299
+ *
1300
+ * NOTE: the shadow holds the last LIVE-PATH filename; its OSS blob may have
1301
+ * expired, in which case a follow-up {@link fetchLatestMap} rejects — treat
1302
+ * that as "no saved map available".
1303
+ */
1304
+ refreshSavedMapFilename(): Promise<string | null>;
1275
1305
  /**
1276
1306
  * The current room/segment id, derived from the most-recently-decoded map's
1277
1307
  * active-segment set (`sa`). `null` when no map has been fetched or no
package/dist/index.d.ts CHANGED
@@ -1272,6 +1272,36 @@ 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>;
1292
+ /**
1293
+ * Seed {@link mapFilename} from the CLOUD SHADOW (the last value the robot
1294
+ * pushed for siid 6 piid 3) WITHOUT waking it — so a docked/idle robot can
1295
+ * surface its LAST cleaning map without a fresh clean. Emits the usual
1296
+ * `propertyChanged`/`stateChanged` (so a map-watching consumer re-renders) and
1297
+ * returns the resolved {@link mapFilename} (null when the model has no map or
1298
+ * the shadow carries no map path yet).
1299
+ *
1300
+ * NOTE: the shadow holds the last LIVE-PATH filename; its OSS blob may have
1301
+ * expired, in which case a follow-up {@link fetchLatestMap} rejects — treat
1302
+ * that as "no saved map available".
1303
+ */
1304
+ refreshSavedMapFilename(): Promise<string | null>;
1275
1305
  /**
1276
1306
  * The current room/segment id, derived from the most-recently-decoded map's
1277
1307
  * active-segment set (`sa`). `null` when no map has been fetched or no
package/dist/index.js CHANGED
@@ -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,47 @@ 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
+ }
2842
+ /**
2843
+ * Seed {@link mapFilename} from the CLOUD SHADOW (the last value the robot
2844
+ * pushed for siid 6 piid 3) WITHOUT waking it — so a docked/idle robot can
2845
+ * surface its LAST cleaning map without a fresh clean. Emits the usual
2846
+ * `propertyChanged`/`stateChanged` (so a map-watching consumer re-renders) and
2847
+ * returns the resolved {@link mapFilename} (null when the model has no map or
2848
+ * the shadow carries no map path yet).
2849
+ *
2850
+ * NOTE: the shadow holds the last LIVE-PATH filename; its OSS blob may have
2851
+ * expired, in which case a follow-up {@link fetchLatestMap} rejects — treat
2852
+ * that as "no saved map available".
2853
+ */
2854
+ async refreshSavedMapFilename() {
2855
+ if (!this.#caps.canMap) return null;
2856
+ await this.refreshCachedProperties([VACUUM_PROP.MAP_PATH]);
2857
+ return this.mapFilename;
2858
+ }
2811
2859
  /**
2812
2860
  * The current room/segment id, derived from the most-recently-decoded map's
2813
2861
  * active-segment set (`sa`). `null` when no map has been fetched or no