# Changelog

All notable changes to this project will be documented in this file.  
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and follows the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [v3.4.0]

### Added

- **Wi-Fi Reset Support**
  - Added an API to reset Wi-Fi credentials on the device.

- **Provisioning Retry Support**
  - Added support for retrying the provisioning flow after an authentication failure.


## [v3.3.0]

### Added

- **Simple Time Series Aggregates**
  - Added APIs to retrieve aggregated time series data for device and custom parameters.
  - Added hourly, daily, weekly, and monthly aggregation windows with live, single-date, and date-range query modes.
  - Added support for cumulative parameter aggregates.

### Changed

- **Simple Time Series APIs**
  - Widened supported parameter data types to include `object` and `array`.

- **Time Series Aggregation Validation**
  - Restricted `bool` and `string` parameters to `raw`, `latest`, and `count` aggregation methods.
  - Rejected the `latest` aggregation when combined with `month` or `year` intervals.

### Fixed

- **Simple Time Series APIs**
  - Corrected the parameter data type field in simple time series requests so they match the backend contract.

## [v3.2.1]

### Added

- **Configurable Claim Base URL**

  - Added optional `claimUrl` to `ESPRMBase.configure()` for configuring the base URL used by claim requests.

## [v3.2.0]

### Added

- **User Files Management**
  - Added support for uploading and downloading user files using presigned URLs.
  - Introduced APIs to list, update, and delete user files.
  - Added support for configuring file visibility as public or private.

- **Command Response APIs**
  - Added APIs to create, fetch, list, and cancel command response requests.
  - Exposed command response APIs on both `ESPRMUser` and `ESPRMNode`.
  - Added request status polling and cancellation support on command response request objects.

- **OAuth Code Token Exchange**
  - Added `ESPRMAuth.loginWithOauthCode(code, options?)` for exchanging a pre-obtained OAuth authorization code for user tokens.
  - Added support for the `wechatTokenOnly` option for WeChat-specific token exchange flows.

### Changed

- **OAuth Login**
  - Refactored `loginWithOauth` to internally reuse `loginWithOauthCode` while preserving its existing API and behavior.

- **User Event Callbacks**
  - Converted `ESPRMUser` event callbacks to static callbacks for consistent event handling across user instances.

## [v3.1.0]

### Added

- **Helper Utilities Export:**
  - Exposed ESPRMHelpers as a public entry point, making the SDK's internal helpers — response transformers, token/UUID utilities, type guards, node and group operations, claiming, and transport helpers — importable directly.

## [v3.0.1]

### Fixed

- **Node Parsing:**
  - Isolated per-node transform failures so a single malformed node no longer drops the entire `getUserNodes` response.
  - Added guards for missing `config`, `status.connectivity`, `devices`, `services`, and `params` fields on partial cloud payloads.
  - Nodes missing `config` are now skipped and reported via `console.warn` instead of throwing.

## [v3.0.0]

### Fixed

- **Automation Action Interface:**

  - Updated to support multiple device parameters in a single payload, improving backend API call efficiency.

## [v2.3.0]

### Added

- **Challenge-Response Provisioning (Default)**:

  - Introduced a more secure challenge-response–based provisioning flow, now set as the default method for device onboarding.
  - Added support to override the default provisioning method by specifying a provisioning type.

### Fixed

- **Duplicate Notification Channel Registration**:

  - Resolved an issue where notification channels could be registered multiple times by ensuring channels are registered only once.

## [v2.2.2]

### Added

- Channel-based subscription system with ESPSubscriptionManager and ESPSubscriptionChannelInterface.
- NotificationSubscriptionChannel for unified update handling.
- Architectural separation of device discovery and control.

### Enhanced

- Extended subscription and transport models for multi-protocol support.

## [v2.2.1]

### Added

- **Assume Role API with MQTT & Video Stream Support**
  - Introduced an assume role API enabling authenticated access for MQTT operations and secure video streaming workflows.

### **Enhanced**

- **Assisted Claiming for Camera Devices**
  - Updated the assisted claiming flow for video-capable device onboarding requirements.

## [v2.1.1]

### Added

- **Custom Parameter Time Series APIs**:
  - Introduced support for explicitly specifying a **custom parameter name** for time series queries on parameters **outside the node configuration**.

### Fixed

- **Time Series Parameter Name Resolution**:
  - Corrected parameter name value formatting to align with backend API expectations.

## [v2.1.0]

### Added

- **Assisted Claiming Support**:
  - Introduced assisted claiming flow.

### Enhanced

- **Node Config Information**:
  - Extended node config info to support additional parameters for greater flexibility.

## [v2.0.5]

### Fixed

- **Group Node Mapping & Metadata Alignment**:
  - Corrected the mapping of `nodeIds` to `nodes` in `ESPRMGroupInterface` during group and subgroup creation.
  - Aligned `metadata` field with backend API.

## [v2.0.4]

### Enhanced

- **Update Automation API**: Modified Update Automation API to support node change in events params.

## [v2.0.3]

### Added

- **Provisioning Enhancement**: Automatically add new node to group specified by groupId during provisioning.

### Fixed

- **Group Creation**: Add isPrimaryUser flag to newly created groups.

## [v2.0.2]

### Fixed

- **Transport Config Validation**: Fixed transport config validation logic.

## [v2.0.1]

### Changed

- **Node Parameters**: Converted abstract class to an interface.
  - Enhances compatibility with state management libraries
  - Simplifies extension and integration.

## [v2.0.0]

### Added

- **Adapter-based OAuth Login**: Introduced adapter-based OAuth login functionality for more flexible authentication flows.
- **Primary Parameter Retrieval**: Added API to fetch the primary parameter of an `ESPRMDevice`.
- **Provisioning Enhancements**:
  - Added BLE and location permission adapter support.
  - Introduced customer-id-based BLE device search on the user instance.
  - Added node ID retrieval support in the provisioning flow.
- **Device & Service Parameter Enhancements**:
  - Added support for `valid_strs` with validation.
  - Introduced `bounds` support for service parameters.
  - Added setter and getter support for service parameters.

### Changed

- **Provision Adapter**:
  - Fixed response type for the `connect` method.
- **Device & Service Parameter Classes**:
  - Restructured classes for better maintainability and extensibility.

### Fixed

- **Notification Validation**: Corrected an incorrect validation condition for notification data.

---

## [v1.1.0]

### Added

- **Automation Operations**: Comprehensive automation management capabilities with support for daylight-based and weather-based triggers.

- **Time Series Operations**: Advanced time series data retrieval and analysis with configurable aggregation intervals and filtering options.

- **OTA Operations**: Over-the-Air firmware update management for ESP devices with remote update capabilities and status monitoring.

- **Provisioning Hooks**: Enhanced device onboarding process with support for custom provisioning flows, user-node mapping, and network credential configuration.

## [v1.0.1] - 2025-04-01

### Added

- Post-unauthorized call handling logic.
- Custom data related APIs.
- Set timezone related APIs.

### Changed

- **Refactored `ESPRMBase` Class and Static APIs**:

  - Refactored **ESPRMBase** class to ensure cleaner and more efficient static API structure.

- **Provisioning Manager API Refactor**:

  - Moved **provision manager** APIs to the user level for better access control.

- **Import/Export Refinements**:

  - Improved **import/export** logic for augmented methods and classes to improve extensibility.

- Reduced circular dependencies.

## [v1.0.0] - 2025-01-27

### Added

This is the **initial release** of `@espressif/rainmaker-base-sdk`, designed to accelerate app development by providing a unified API for interacting with the **ESP RainMaker** platform.

#### Core Features:

- **Provisioning & Discovery**:

  - Supports device provisioning and discovery using **native modules** with **customizable adapter interfaces**.

- **Local & Cloud Communication**:

  - Allows seamless device control over **local transport** with an **automatic fallback** to **cloud communication** for updates and retrieval of the latest parameters.

- **Cross-Platform Compatibility**:

  - Designed to work with **React Native** and other cross-platform frameworks.

- **Extensible & Modular Design**:

  - Includes separate **modules** for:
    - **Auth Management**: Handle authentication/authorization related APIs.
    - **User Management**: Handle user related operations.
    - **Device Management**: Manage device interactions, including state updates and control.
    - **Group Management**: Organize and control multiple devices as groups.

- **Native Module Support**:
  - Provides **adapter interfaces** for both **iOS and Android**, ensuring seamless integration with mobile applications.

This release lays the foundation for future enhancements, allowing developers to build apps that integrate seamlessly with **ESP RainMaker** while maintaining **scalability** and **flexibility**.
