@apocaliss92/nodedreame 1.2.0 → 1.3.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
@@ -1,4 +1,5 @@
1
1
  import { fetch } from 'undici';
2
+ import { z } from 'zod';
2
3
 
3
4
  /** Public name of this library. */
4
5
  declare const LIBRARY_NAME = "nodedreame";
@@ -1794,4 +1795,339 @@ declare class MowerDevice extends BaseDevice {
1794
1795
  }];
1795
1796
  }
1796
1797
 
1797
- export { BaseDevice, type BaseDeviceEvents, type BatchDeviceDataFetcher, type CapabilityResolver, ChargingStatus, type CleanOpts, CleaningMode, type CreateDeviceArgs, DefaultCapabilityResolver, type DeviceCapabilities, type DeviceEvent, DreameApiError, DreameAuthError, type DreameCloudState, type DreameDevice, DreameDeviceOfflineError, DreameError, type DreameRegion, type DreameSession, DreameTransportError, LIBRARY_NAME, MODEL_CAPABILITIES as MOWER_MODEL_CAPABILITIES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapDimensions, type MapFrameType, type MapLayer, type MapLayerType, type MapLowLyingArea, type MapObstacle, type MapPath, type MapPathType, type MapPoint, type MapPose, type MapRestrictedArea, type MapRoom, type MapRoomWall, type MapRun, type MapSegment, type MapStorey, type MapVirtualWall, type MapWallsInfo, type MiotAction, MiotError, type MiotProp, MiotState, type MowerAvailableMap, type MowerCapabilities, MowerCapabilityResolver, MowerChargingStatus, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerZone, Nodreame, type NodreameDeps, type NodreameEvents, type NodreameOptions, type OssFetchInput, type OssFetcherLike, type PropertyChangedEvent, type PropertyResult, type PropertyState, type PropertyWrite, type RenderMowerSvgOptions, type RenderVacuumPngOptions, type StateChangedEvent, SuctionLevel, TaskStatus, MODEL_CAPABILITIES$1 as VACUUM_MODEL_CAPABILITIES, type VacuumCapabilities, VacuumCapabilityResolver, VacuumDevice, type VacuumGetMapInput, type VacuumMap, WaterVolume, getMowerCapabilities, getVacuumCapabilities, renderMowerSvg, renderVacuumPng, resolveCapabilities };
1798
+ declare const DeviceDumpSchema: z.ZodObject<{
1799
+ schemaVersion: z.ZodLiteral<1>;
1800
+ library: z.ZodUnion<[z.ZodLiteral<"nodedreame">, z.ZodLiteral<"nodewitt">]>;
1801
+ libraryVersion: z.ZodString;
1802
+ device: z.ZodObject<{
1803
+ model: z.ZodString;
1804
+ firmware: z.ZodOptional<z.ZodString>;
1805
+ region: z.ZodOptional<z.ZodString>;
1806
+ type: z.ZodOptional<z.ZodString>;
1807
+ }, "strip", z.ZodTypeAny, {
1808
+ model: string;
1809
+ type?: string | undefined;
1810
+ region?: string | undefined;
1811
+ firmware?: string | undefined;
1812
+ }, {
1813
+ model: string;
1814
+ type?: string | undefined;
1815
+ region?: string | undefined;
1816
+ firmware?: string | undefined;
1817
+ }>;
1818
+ observations: z.ZodObject<{
1819
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1820
+ values: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">;
1821
+ unmapped: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">;
1822
+ enum: z.ZodOptional<z.ZodString>;
1823
+ count: z.ZodNumber;
1824
+ firstSeen: z.ZodNumber;
1825
+ lastSeen: z.ZodNumber;
1826
+ }, "strip", z.ZodTypeAny, {
1827
+ values: (string | number | boolean)[];
1828
+ unmapped: (string | number | boolean)[];
1829
+ count: number;
1830
+ firstSeen: number;
1831
+ lastSeen: number;
1832
+ enum?: string | undefined;
1833
+ }, {
1834
+ values: (string | number | boolean)[];
1835
+ unmapped: (string | number | boolean)[];
1836
+ count: number;
1837
+ firstSeen: number;
1838
+ lastSeen: number;
1839
+ enum?: string | undefined;
1840
+ }>>;
1841
+ events: z.ZodArray<z.ZodObject<{
1842
+ at: z.ZodNumber;
1843
+ type: z.ZodString;
1844
+ data: z.ZodOptional<z.ZodUnknown>;
1845
+ }, "strip", z.ZodTypeAny, {
1846
+ at: number;
1847
+ type: string;
1848
+ data?: unknown;
1849
+ }, {
1850
+ at: number;
1851
+ type: string;
1852
+ data?: unknown;
1853
+ }>, "many">;
1854
+ rawFrames: z.ZodOptional<z.ZodArray<z.ZodObject<{
1855
+ at: z.ZodNumber;
1856
+ source: z.ZodString;
1857
+ payload: z.ZodUnknown;
1858
+ }, "strip", z.ZodTypeAny, {
1859
+ at: number;
1860
+ source: string;
1861
+ payload?: unknown;
1862
+ }, {
1863
+ at: number;
1864
+ source: string;
1865
+ payload?: unknown;
1866
+ }>, "many">>;
1867
+ }, "strip", z.ZodTypeAny, {
1868
+ properties: Record<string, {
1869
+ values: (string | number | boolean)[];
1870
+ unmapped: (string | number | boolean)[];
1871
+ count: number;
1872
+ firstSeen: number;
1873
+ lastSeen: number;
1874
+ enum?: string | undefined;
1875
+ }>;
1876
+ events: {
1877
+ at: number;
1878
+ type: string;
1879
+ data?: unknown;
1880
+ }[];
1881
+ rawFrames?: {
1882
+ at: number;
1883
+ source: string;
1884
+ payload?: unknown;
1885
+ }[] | undefined;
1886
+ }, {
1887
+ properties: Record<string, {
1888
+ values: (string | number | boolean)[];
1889
+ unmapped: (string | number | boolean)[];
1890
+ count: number;
1891
+ firstSeen: number;
1892
+ lastSeen: number;
1893
+ enum?: string | undefined;
1894
+ }>;
1895
+ events: {
1896
+ at: number;
1897
+ type: string;
1898
+ data?: unknown;
1899
+ }[];
1900
+ rawFrames?: {
1901
+ at: number;
1902
+ source: string;
1903
+ payload?: unknown;
1904
+ }[] | undefined;
1905
+ }>;
1906
+ catalog: z.ZodObject<{
1907
+ commands: z.ZodOptional<z.ZodArray<z.ZodObject<{
1908
+ name: z.ZodString;
1909
+ siid: z.ZodOptional<z.ZodNumber>;
1910
+ aiid: z.ZodOptional<z.ZodNumber>;
1911
+ }, "strip", z.ZodTypeAny, {
1912
+ name: string;
1913
+ siid?: number | undefined;
1914
+ aiid?: number | undefined;
1915
+ }, {
1916
+ name: string;
1917
+ siid?: number | undefined;
1918
+ aiid?: number | undefined;
1919
+ }>, "many">>;
1920
+ capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1921
+ sensors: z.ZodOptional<z.ZodArray<z.ZodObject<{
1922
+ model: z.ZodString;
1923
+ channel: z.ZodOptional<z.ZodNumber>;
1924
+ }, "strip", z.ZodTypeAny, {
1925
+ model: string;
1926
+ channel?: number | undefined;
1927
+ }, {
1928
+ model: string;
1929
+ channel?: number | undefined;
1930
+ }>, "many">>;
1931
+ }, "strip", z.ZodTypeAny, {
1932
+ commands?: {
1933
+ name: string;
1934
+ siid?: number | undefined;
1935
+ aiid?: number | undefined;
1936
+ }[] | undefined;
1937
+ capabilities?: Record<string, unknown> | undefined;
1938
+ sensors?: {
1939
+ model: string;
1940
+ channel?: number | undefined;
1941
+ }[] | undefined;
1942
+ }, {
1943
+ commands?: {
1944
+ name: string;
1945
+ siid?: number | undefined;
1946
+ aiid?: number | undefined;
1947
+ }[] | undefined;
1948
+ capabilities?: Record<string, unknown> | undefined;
1949
+ sensors?: {
1950
+ model: string;
1951
+ channel?: number | undefined;
1952
+ }[] | undefined;
1953
+ }>;
1954
+ meta: z.ZodObject<{
1955
+ startedAt: z.ZodNumber;
1956
+ durationMs: z.ZodNumber;
1957
+ generatedAt: z.ZodNumber;
1958
+ }, "strip", z.ZodTypeAny, {
1959
+ startedAt: number;
1960
+ durationMs: number;
1961
+ generatedAt: number;
1962
+ }, {
1963
+ startedAt: number;
1964
+ durationMs: number;
1965
+ generatedAt: number;
1966
+ }>;
1967
+ }, "strip", z.ZodTypeAny, {
1968
+ schemaVersion: 1;
1969
+ library: "nodedreame" | "nodewitt";
1970
+ libraryVersion: string;
1971
+ device: {
1972
+ model: string;
1973
+ type?: string | undefined;
1974
+ region?: string | undefined;
1975
+ firmware?: string | undefined;
1976
+ };
1977
+ observations: {
1978
+ properties: Record<string, {
1979
+ values: (string | number | boolean)[];
1980
+ unmapped: (string | number | boolean)[];
1981
+ count: number;
1982
+ firstSeen: number;
1983
+ lastSeen: number;
1984
+ enum?: string | undefined;
1985
+ }>;
1986
+ events: {
1987
+ at: number;
1988
+ type: string;
1989
+ data?: unknown;
1990
+ }[];
1991
+ rawFrames?: {
1992
+ at: number;
1993
+ source: string;
1994
+ payload?: unknown;
1995
+ }[] | undefined;
1996
+ };
1997
+ catalog: {
1998
+ commands?: {
1999
+ name: string;
2000
+ siid?: number | undefined;
2001
+ aiid?: number | undefined;
2002
+ }[] | undefined;
2003
+ capabilities?: Record<string, unknown> | undefined;
2004
+ sensors?: {
2005
+ model: string;
2006
+ channel?: number | undefined;
2007
+ }[] | undefined;
2008
+ };
2009
+ meta: {
2010
+ startedAt: number;
2011
+ durationMs: number;
2012
+ generatedAt: number;
2013
+ };
2014
+ }, {
2015
+ schemaVersion: 1;
2016
+ library: "nodedreame" | "nodewitt";
2017
+ libraryVersion: string;
2018
+ device: {
2019
+ model: string;
2020
+ type?: string | undefined;
2021
+ region?: string | undefined;
2022
+ firmware?: string | undefined;
2023
+ };
2024
+ observations: {
2025
+ properties: Record<string, {
2026
+ values: (string | number | boolean)[];
2027
+ unmapped: (string | number | boolean)[];
2028
+ count: number;
2029
+ firstSeen: number;
2030
+ lastSeen: number;
2031
+ enum?: string | undefined;
2032
+ }>;
2033
+ events: {
2034
+ at: number;
2035
+ type: string;
2036
+ data?: unknown;
2037
+ }[];
2038
+ rawFrames?: {
2039
+ at: number;
2040
+ source: string;
2041
+ payload?: unknown;
2042
+ }[] | undefined;
2043
+ };
2044
+ catalog: {
2045
+ commands?: {
2046
+ name: string;
2047
+ siid?: number | undefined;
2048
+ aiid?: number | undefined;
2049
+ }[] | undefined;
2050
+ capabilities?: Record<string, unknown> | undefined;
2051
+ sensors?: {
2052
+ model: string;
2053
+ channel?: number | undefined;
2054
+ }[] | undefined;
2055
+ };
2056
+ meta: {
2057
+ startedAt: number;
2058
+ durationMs: number;
2059
+ generatedAt: number;
2060
+ };
2061
+ }>;
2062
+ /** Public shared dump type — inferred from the schema so the two never drift. */
2063
+ type DeviceDump = z.infer<typeof DeviceDumpSchema>;
2064
+
2065
+ /** A property decoder: the enum NAME + a membership test for a raw number. */
2066
+ interface KeyDecoder {
2067
+ enumName: string;
2068
+ isMember(raw: number): boolean;
2069
+ }
2070
+ /** Tunables for a {@link Dumper}. All optional. */
2071
+ interface DumperOptions {
2072
+ /** Capture raw event/property frames into `observations.rawFrames`. Default false. */
2073
+ captureRawFrames?: boolean;
2074
+ /** Cap on retained raw frames (ring). Default 500. */
2075
+ maxRawFrames?: number;
2076
+ /** Periodic cloud-shadow refresh interval (ms). Default 30000; 0 disables. */
2077
+ refreshIntervalMs?: number;
2078
+ }
2079
+ /**
2080
+ * The READ-ONLY slice of a device the {@link Dumper} consumes. Declaring it as
2081
+ * an interface lets tests inject a fake with no cast (mirrors `PushLike`). A real
2082
+ * `BaseDevice`/`VacuumDevice`/`MowerDevice` structurally satisfies it. NOTE it
2083
+ * exposes NO action/command method — the dumper literally cannot execute one.
2084
+ */
2085
+ interface DumperDevice {
2086
+ readonly model: string;
2087
+ readonly deviceId: string;
2088
+ readonly capabilities: {
2089
+ list(): readonly string[];
2090
+ has(t: string): boolean;
2091
+ model: string;
2092
+ };
2093
+ on(event: 'propertyChanged', cb: (e: PropertyChangedEvent) => void): this;
2094
+ on(event: 'event', cb: (e: DeviceEvent) => void): this;
2095
+ off(event: 'propertyChanged', cb: (e: PropertyChangedEvent) => void): this;
2096
+ off(event: 'event', cb: (e: DeviceEvent) => void): this;
2097
+ /** Cloud-shadow read; absent on a bare BaseDevice. Feature-detected. */
2098
+ refreshFromCache?(): Promise<void>;
2099
+ }
2100
+ /**
2101
+ * A passive, READ-ONLY observer that records what a Dreame device exposes while
2102
+ * it operates. {@link start} hooks the device's `propertyChanged`/`event` stream,
2103
+ * does an initial + periodic cloud-shadow {@link DumperDevice.refreshFromCache}
2104
+ * read (feature-detected), and snapshots the static catalog at construction.
2105
+ * {@link stop} detaches every listener + clears the timer (idempotent, no leaks).
2106
+ * {@link export} assembles the ANONYMIZED, zod-valid {@link DeviceDump}. The
2107
+ * dumper NEVER executes a device command/action.
2108
+ */
2109
+ declare class Dumper {
2110
+ #private;
2111
+ constructor(device: DumperDevice, catalog: DeviceDump['catalog'], type: string, decoders: Record<string, KeyDecoder>, options?: DumperOptions);
2112
+ /** Attach to the live stream + arm the periodic shadow refresh. Idempotent. */
2113
+ start(): Promise<void>;
2114
+ /** Detach every listener + clear the timer. Idempotent. */
2115
+ stop(): Promise<void>;
2116
+ /** Build the anonymized, schema-valid dump. Works live or after {@link stop}. */
2117
+ export(): DeviceDump;
2118
+ /** Deterministic pretty JSON of {@link export}. */
2119
+ exportJson(): string;
2120
+ }
2121
+ /**
2122
+ * Create a read-only {@link Dumper} for one device. The family-correct decoder
2123
+ * table + catalog + `device.type` are chosen via cast-free `instanceof` checks;
2124
+ * an unknown family records values with no enum/unmapped detection.
2125
+ */
2126
+ declare function createDumper(target: DumperDevice, options?: DumperOptions): Dumper;
2127
+ /**
2128
+ * Fan-out: one {@link Dumper} per discovered device on a {@link Nodreame} client
2129
+ * (read-only). Each `BaseDevice` structurally satisfies {@link DumperDevice}.
2130
+ */
2131
+ declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
2132
+
2133
+ export { BaseDevice, type BaseDeviceEvents, type BatchDeviceDataFetcher, type CapabilityResolver, ChargingStatus, type CleanOpts, CleaningMode, type CreateDeviceArgs, DefaultCapabilityResolver, type DeviceCapabilities, type DeviceDump, type DeviceEvent, DreameApiError, DreameAuthError, type DreameCloudState, type DreameDevice, DreameDeviceOfflineError, DreameError, type DreameRegion, type DreameSession, DreameTransportError, type DumperOptions, LIBRARY_NAME, MODEL_CAPABILITIES as MOWER_MODEL_CAPABILITIES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapDimensions, type MapFrameType, type MapLayer, type MapLayerType, type MapLowLyingArea, type MapObstacle, type MapPath, type MapPathType, type MapPoint, type MapPose, type MapRestrictedArea, type MapRoom, type MapRoomWall, type MapRun, type MapSegment, type MapStorey, type MapVirtualWall, type MapWallsInfo, type MiotAction, MiotError, type MiotProp, MiotState, type MowerAvailableMap, type MowerCapabilities, MowerCapabilityResolver, MowerChargingStatus, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerZone, Nodreame, type NodreameDeps, type NodreameEvents, type NodreameOptions, type OssFetchInput, type OssFetcherLike, type PropertyChangedEvent, type PropertyResult, type PropertyState, type PropertyWrite, type RenderMowerSvgOptions, type RenderVacuumPngOptions, type StateChangedEvent, SuctionLevel, TaskStatus, MODEL_CAPABILITIES$1 as VACUUM_MODEL_CAPABILITIES, type VacuumCapabilities, VacuumCapabilityResolver, VacuumDevice, type VacuumGetMapInput, type VacuumMap, WaterVolume, createClientDumper, createDumper, getMowerCapabilities, getVacuumCapabilities, renderMowerSvg, renderVacuumPng, resolveCapabilities };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { fetch } from 'undici';
2
+ import { z } from 'zod';
2
3
 
3
4
  /** Public name of this library. */
4
5
  declare const LIBRARY_NAME = "nodedreame";
@@ -1794,4 +1795,339 @@ declare class MowerDevice extends BaseDevice {
1794
1795
  }];
1795
1796
  }
1796
1797
 
1797
- export { BaseDevice, type BaseDeviceEvents, type BatchDeviceDataFetcher, type CapabilityResolver, ChargingStatus, type CleanOpts, CleaningMode, type CreateDeviceArgs, DefaultCapabilityResolver, type DeviceCapabilities, type DeviceEvent, DreameApiError, DreameAuthError, type DreameCloudState, type DreameDevice, DreameDeviceOfflineError, DreameError, type DreameRegion, type DreameSession, DreameTransportError, LIBRARY_NAME, MODEL_CAPABILITIES as MOWER_MODEL_CAPABILITIES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapDimensions, type MapFrameType, type MapLayer, type MapLayerType, type MapLowLyingArea, type MapObstacle, type MapPath, type MapPathType, type MapPoint, type MapPose, type MapRestrictedArea, type MapRoom, type MapRoomWall, type MapRun, type MapSegment, type MapStorey, type MapVirtualWall, type MapWallsInfo, type MiotAction, MiotError, type MiotProp, MiotState, type MowerAvailableMap, type MowerCapabilities, MowerCapabilityResolver, MowerChargingStatus, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerZone, Nodreame, type NodreameDeps, type NodreameEvents, type NodreameOptions, type OssFetchInput, type OssFetcherLike, type PropertyChangedEvent, type PropertyResult, type PropertyState, type PropertyWrite, type RenderMowerSvgOptions, type RenderVacuumPngOptions, type StateChangedEvent, SuctionLevel, TaskStatus, MODEL_CAPABILITIES$1 as VACUUM_MODEL_CAPABILITIES, type VacuumCapabilities, VacuumCapabilityResolver, VacuumDevice, type VacuumGetMapInput, type VacuumMap, WaterVolume, getMowerCapabilities, getVacuumCapabilities, renderMowerSvg, renderVacuumPng, resolveCapabilities };
1798
+ declare const DeviceDumpSchema: z.ZodObject<{
1799
+ schemaVersion: z.ZodLiteral<1>;
1800
+ library: z.ZodUnion<[z.ZodLiteral<"nodedreame">, z.ZodLiteral<"nodewitt">]>;
1801
+ libraryVersion: z.ZodString;
1802
+ device: z.ZodObject<{
1803
+ model: z.ZodString;
1804
+ firmware: z.ZodOptional<z.ZodString>;
1805
+ region: z.ZodOptional<z.ZodString>;
1806
+ type: z.ZodOptional<z.ZodString>;
1807
+ }, "strip", z.ZodTypeAny, {
1808
+ model: string;
1809
+ type?: string | undefined;
1810
+ region?: string | undefined;
1811
+ firmware?: string | undefined;
1812
+ }, {
1813
+ model: string;
1814
+ type?: string | undefined;
1815
+ region?: string | undefined;
1816
+ firmware?: string | undefined;
1817
+ }>;
1818
+ observations: z.ZodObject<{
1819
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1820
+ values: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">;
1821
+ unmapped: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">;
1822
+ enum: z.ZodOptional<z.ZodString>;
1823
+ count: z.ZodNumber;
1824
+ firstSeen: z.ZodNumber;
1825
+ lastSeen: z.ZodNumber;
1826
+ }, "strip", z.ZodTypeAny, {
1827
+ values: (string | number | boolean)[];
1828
+ unmapped: (string | number | boolean)[];
1829
+ count: number;
1830
+ firstSeen: number;
1831
+ lastSeen: number;
1832
+ enum?: string | undefined;
1833
+ }, {
1834
+ values: (string | number | boolean)[];
1835
+ unmapped: (string | number | boolean)[];
1836
+ count: number;
1837
+ firstSeen: number;
1838
+ lastSeen: number;
1839
+ enum?: string | undefined;
1840
+ }>>;
1841
+ events: z.ZodArray<z.ZodObject<{
1842
+ at: z.ZodNumber;
1843
+ type: z.ZodString;
1844
+ data: z.ZodOptional<z.ZodUnknown>;
1845
+ }, "strip", z.ZodTypeAny, {
1846
+ at: number;
1847
+ type: string;
1848
+ data?: unknown;
1849
+ }, {
1850
+ at: number;
1851
+ type: string;
1852
+ data?: unknown;
1853
+ }>, "many">;
1854
+ rawFrames: z.ZodOptional<z.ZodArray<z.ZodObject<{
1855
+ at: z.ZodNumber;
1856
+ source: z.ZodString;
1857
+ payload: z.ZodUnknown;
1858
+ }, "strip", z.ZodTypeAny, {
1859
+ at: number;
1860
+ source: string;
1861
+ payload?: unknown;
1862
+ }, {
1863
+ at: number;
1864
+ source: string;
1865
+ payload?: unknown;
1866
+ }>, "many">>;
1867
+ }, "strip", z.ZodTypeAny, {
1868
+ properties: Record<string, {
1869
+ values: (string | number | boolean)[];
1870
+ unmapped: (string | number | boolean)[];
1871
+ count: number;
1872
+ firstSeen: number;
1873
+ lastSeen: number;
1874
+ enum?: string | undefined;
1875
+ }>;
1876
+ events: {
1877
+ at: number;
1878
+ type: string;
1879
+ data?: unknown;
1880
+ }[];
1881
+ rawFrames?: {
1882
+ at: number;
1883
+ source: string;
1884
+ payload?: unknown;
1885
+ }[] | undefined;
1886
+ }, {
1887
+ properties: Record<string, {
1888
+ values: (string | number | boolean)[];
1889
+ unmapped: (string | number | boolean)[];
1890
+ count: number;
1891
+ firstSeen: number;
1892
+ lastSeen: number;
1893
+ enum?: string | undefined;
1894
+ }>;
1895
+ events: {
1896
+ at: number;
1897
+ type: string;
1898
+ data?: unknown;
1899
+ }[];
1900
+ rawFrames?: {
1901
+ at: number;
1902
+ source: string;
1903
+ payload?: unknown;
1904
+ }[] | undefined;
1905
+ }>;
1906
+ catalog: z.ZodObject<{
1907
+ commands: z.ZodOptional<z.ZodArray<z.ZodObject<{
1908
+ name: z.ZodString;
1909
+ siid: z.ZodOptional<z.ZodNumber>;
1910
+ aiid: z.ZodOptional<z.ZodNumber>;
1911
+ }, "strip", z.ZodTypeAny, {
1912
+ name: string;
1913
+ siid?: number | undefined;
1914
+ aiid?: number | undefined;
1915
+ }, {
1916
+ name: string;
1917
+ siid?: number | undefined;
1918
+ aiid?: number | undefined;
1919
+ }>, "many">>;
1920
+ capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1921
+ sensors: z.ZodOptional<z.ZodArray<z.ZodObject<{
1922
+ model: z.ZodString;
1923
+ channel: z.ZodOptional<z.ZodNumber>;
1924
+ }, "strip", z.ZodTypeAny, {
1925
+ model: string;
1926
+ channel?: number | undefined;
1927
+ }, {
1928
+ model: string;
1929
+ channel?: number | undefined;
1930
+ }>, "many">>;
1931
+ }, "strip", z.ZodTypeAny, {
1932
+ commands?: {
1933
+ name: string;
1934
+ siid?: number | undefined;
1935
+ aiid?: number | undefined;
1936
+ }[] | undefined;
1937
+ capabilities?: Record<string, unknown> | undefined;
1938
+ sensors?: {
1939
+ model: string;
1940
+ channel?: number | undefined;
1941
+ }[] | undefined;
1942
+ }, {
1943
+ commands?: {
1944
+ name: string;
1945
+ siid?: number | undefined;
1946
+ aiid?: number | undefined;
1947
+ }[] | undefined;
1948
+ capabilities?: Record<string, unknown> | undefined;
1949
+ sensors?: {
1950
+ model: string;
1951
+ channel?: number | undefined;
1952
+ }[] | undefined;
1953
+ }>;
1954
+ meta: z.ZodObject<{
1955
+ startedAt: z.ZodNumber;
1956
+ durationMs: z.ZodNumber;
1957
+ generatedAt: z.ZodNumber;
1958
+ }, "strip", z.ZodTypeAny, {
1959
+ startedAt: number;
1960
+ durationMs: number;
1961
+ generatedAt: number;
1962
+ }, {
1963
+ startedAt: number;
1964
+ durationMs: number;
1965
+ generatedAt: number;
1966
+ }>;
1967
+ }, "strip", z.ZodTypeAny, {
1968
+ schemaVersion: 1;
1969
+ library: "nodedreame" | "nodewitt";
1970
+ libraryVersion: string;
1971
+ device: {
1972
+ model: string;
1973
+ type?: string | undefined;
1974
+ region?: string | undefined;
1975
+ firmware?: string | undefined;
1976
+ };
1977
+ observations: {
1978
+ properties: Record<string, {
1979
+ values: (string | number | boolean)[];
1980
+ unmapped: (string | number | boolean)[];
1981
+ count: number;
1982
+ firstSeen: number;
1983
+ lastSeen: number;
1984
+ enum?: string | undefined;
1985
+ }>;
1986
+ events: {
1987
+ at: number;
1988
+ type: string;
1989
+ data?: unknown;
1990
+ }[];
1991
+ rawFrames?: {
1992
+ at: number;
1993
+ source: string;
1994
+ payload?: unknown;
1995
+ }[] | undefined;
1996
+ };
1997
+ catalog: {
1998
+ commands?: {
1999
+ name: string;
2000
+ siid?: number | undefined;
2001
+ aiid?: number | undefined;
2002
+ }[] | undefined;
2003
+ capabilities?: Record<string, unknown> | undefined;
2004
+ sensors?: {
2005
+ model: string;
2006
+ channel?: number | undefined;
2007
+ }[] | undefined;
2008
+ };
2009
+ meta: {
2010
+ startedAt: number;
2011
+ durationMs: number;
2012
+ generatedAt: number;
2013
+ };
2014
+ }, {
2015
+ schemaVersion: 1;
2016
+ library: "nodedreame" | "nodewitt";
2017
+ libraryVersion: string;
2018
+ device: {
2019
+ model: string;
2020
+ type?: string | undefined;
2021
+ region?: string | undefined;
2022
+ firmware?: string | undefined;
2023
+ };
2024
+ observations: {
2025
+ properties: Record<string, {
2026
+ values: (string | number | boolean)[];
2027
+ unmapped: (string | number | boolean)[];
2028
+ count: number;
2029
+ firstSeen: number;
2030
+ lastSeen: number;
2031
+ enum?: string | undefined;
2032
+ }>;
2033
+ events: {
2034
+ at: number;
2035
+ type: string;
2036
+ data?: unknown;
2037
+ }[];
2038
+ rawFrames?: {
2039
+ at: number;
2040
+ source: string;
2041
+ payload?: unknown;
2042
+ }[] | undefined;
2043
+ };
2044
+ catalog: {
2045
+ commands?: {
2046
+ name: string;
2047
+ siid?: number | undefined;
2048
+ aiid?: number | undefined;
2049
+ }[] | undefined;
2050
+ capabilities?: Record<string, unknown> | undefined;
2051
+ sensors?: {
2052
+ model: string;
2053
+ channel?: number | undefined;
2054
+ }[] | undefined;
2055
+ };
2056
+ meta: {
2057
+ startedAt: number;
2058
+ durationMs: number;
2059
+ generatedAt: number;
2060
+ };
2061
+ }>;
2062
+ /** Public shared dump type — inferred from the schema so the two never drift. */
2063
+ type DeviceDump = z.infer<typeof DeviceDumpSchema>;
2064
+
2065
+ /** A property decoder: the enum NAME + a membership test for a raw number. */
2066
+ interface KeyDecoder {
2067
+ enumName: string;
2068
+ isMember(raw: number): boolean;
2069
+ }
2070
+ /** Tunables for a {@link Dumper}. All optional. */
2071
+ interface DumperOptions {
2072
+ /** Capture raw event/property frames into `observations.rawFrames`. Default false. */
2073
+ captureRawFrames?: boolean;
2074
+ /** Cap on retained raw frames (ring). Default 500. */
2075
+ maxRawFrames?: number;
2076
+ /** Periodic cloud-shadow refresh interval (ms). Default 30000; 0 disables. */
2077
+ refreshIntervalMs?: number;
2078
+ }
2079
+ /**
2080
+ * The READ-ONLY slice of a device the {@link Dumper} consumes. Declaring it as
2081
+ * an interface lets tests inject a fake with no cast (mirrors `PushLike`). A real
2082
+ * `BaseDevice`/`VacuumDevice`/`MowerDevice` structurally satisfies it. NOTE it
2083
+ * exposes NO action/command method — the dumper literally cannot execute one.
2084
+ */
2085
+ interface DumperDevice {
2086
+ readonly model: string;
2087
+ readonly deviceId: string;
2088
+ readonly capabilities: {
2089
+ list(): readonly string[];
2090
+ has(t: string): boolean;
2091
+ model: string;
2092
+ };
2093
+ on(event: 'propertyChanged', cb: (e: PropertyChangedEvent) => void): this;
2094
+ on(event: 'event', cb: (e: DeviceEvent) => void): this;
2095
+ off(event: 'propertyChanged', cb: (e: PropertyChangedEvent) => void): this;
2096
+ off(event: 'event', cb: (e: DeviceEvent) => void): this;
2097
+ /** Cloud-shadow read; absent on a bare BaseDevice. Feature-detected. */
2098
+ refreshFromCache?(): Promise<void>;
2099
+ }
2100
+ /**
2101
+ * A passive, READ-ONLY observer that records what a Dreame device exposes while
2102
+ * it operates. {@link start} hooks the device's `propertyChanged`/`event` stream,
2103
+ * does an initial + periodic cloud-shadow {@link DumperDevice.refreshFromCache}
2104
+ * read (feature-detected), and snapshots the static catalog at construction.
2105
+ * {@link stop} detaches every listener + clears the timer (idempotent, no leaks).
2106
+ * {@link export} assembles the ANONYMIZED, zod-valid {@link DeviceDump}. The
2107
+ * dumper NEVER executes a device command/action.
2108
+ */
2109
+ declare class Dumper {
2110
+ #private;
2111
+ constructor(device: DumperDevice, catalog: DeviceDump['catalog'], type: string, decoders: Record<string, KeyDecoder>, options?: DumperOptions);
2112
+ /** Attach to the live stream + arm the periodic shadow refresh. Idempotent. */
2113
+ start(): Promise<void>;
2114
+ /** Detach every listener + clear the timer. Idempotent. */
2115
+ stop(): Promise<void>;
2116
+ /** Build the anonymized, schema-valid dump. Works live or after {@link stop}. */
2117
+ export(): DeviceDump;
2118
+ /** Deterministic pretty JSON of {@link export}. */
2119
+ exportJson(): string;
2120
+ }
2121
+ /**
2122
+ * Create a read-only {@link Dumper} for one device. The family-correct decoder
2123
+ * table + catalog + `device.type` are chosen via cast-free `instanceof` checks;
2124
+ * an unknown family records values with no enum/unmapped detection.
2125
+ */
2126
+ declare function createDumper(target: DumperDevice, options?: DumperOptions): Dumper;
2127
+ /**
2128
+ * Fan-out: one {@link Dumper} per discovered device on a {@link Nodreame} client
2129
+ * (read-only). Each `BaseDevice` structurally satisfies {@link DumperDevice}.
2130
+ */
2131
+ declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
2132
+
2133
+ export { BaseDevice, type BaseDeviceEvents, type BatchDeviceDataFetcher, type CapabilityResolver, ChargingStatus, type CleanOpts, CleaningMode, type CreateDeviceArgs, DefaultCapabilityResolver, type DeviceCapabilities, type DeviceDump, type DeviceEvent, DreameApiError, DreameAuthError, type DreameCloudState, type DreameDevice, DreameDeviceOfflineError, DreameError, type DreameRegion, type DreameSession, DreameTransportError, type DumperOptions, LIBRARY_NAME, MODEL_CAPABILITIES as MOWER_MODEL_CAPABILITIES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapDimensions, type MapFrameType, type MapLayer, type MapLayerType, type MapLowLyingArea, type MapObstacle, type MapPath, type MapPathType, type MapPoint, type MapPose, type MapRestrictedArea, type MapRoom, type MapRoomWall, type MapRun, type MapSegment, type MapStorey, type MapVirtualWall, type MapWallsInfo, type MiotAction, MiotError, type MiotProp, MiotState, type MowerAvailableMap, type MowerCapabilities, MowerCapabilityResolver, MowerChargingStatus, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerZone, Nodreame, type NodreameDeps, type NodreameEvents, type NodreameOptions, type OssFetchInput, type OssFetcherLike, type PropertyChangedEvent, type PropertyResult, type PropertyState, type PropertyWrite, type RenderMowerSvgOptions, type RenderVacuumPngOptions, type StateChangedEvent, SuctionLevel, TaskStatus, MODEL_CAPABILITIES$1 as VACUUM_MODEL_CAPABILITIES, type VacuumCapabilities, VacuumCapabilityResolver, VacuumDevice, type VacuumGetMapInput, type VacuumMap, WaterVolume, createClientDumper, createDumper, getMowerCapabilities, getVacuumCapabilities, renderMowerSvg, renderVacuumPng, resolveCapabilities };