Version 4.0.0
The majority of changes in this release deal with simplifying TuyAPI's code for better readability and maintainability, as well as simplifying the interface.
✅ Non-Breaking Changes:
- Only necessary files are now bundled for publishing on NPM, resulting in a smaller overall package size.
- Both the TuyaCipher and MessageParser classes were converted to ES6 classes.
.get()
and.set()
will now both emit an event and return a Promise simultaneously, no extra options needed. In practice, this means TuyAPI gets out of your way and lets you decide if you want to use the synchronous-style callbacks or event-based programming (or both) with less friction.- Debug statements were cleaned up, so hopefully the output of
DEBUG=* ...
is a little less overwhelming and easier to understand. - Added argument checks to functions so they throw an error if called incorrectly.
🚨 Breaking Changes
.resolveId()
was renamed to.find()
, as the function can now resolve either a missing ID or missing IP. For compatibility purposes,.resolveId()
now wraps.find()
; but.resolveId()
is deprecated and will be removed in v5.0.0..resolveIds()
was removed. It previously wrapped.resolveId()
for compatibility purposes.- The persistent connection option has been removed, as a persistent connection is now the default. This means that you must call
.connect()
before interacting with a device, and.disconnect()
when you want your script to exit.