@espressif/rainmaker-admin-sdk 1.1.0 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -3,7 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  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.
5
5
 
6
- ## [Unreleased]
6
+ ## [1.1.1] - 2026-09-23
7
+
8
+ Patch release for the simple time series data endpoint. The time range
9
+ becomes optional, as the backend always allowed, and optional query
10
+ parameters that are left undefined are no longer sent as the literal text
11
+ `undefined`. No breaking changes; every existing call keeps working as before.
12
+
13
+ ### Changed
14
+
15
+ - **Simple time series data**
16
+ - `start_time` and `end_time` on `GetSimpleTimeSeriesDataParams` are now
17
+ optional, matching the backend: omitting them queries from the oldest
18
+ record up to now. Existing callers that pass both are unaffected.
19
+
20
+ ### Fixed
21
+
22
+ - **Query parameter serialisation**
23
+ - `ESPRMAPIManager.request()` no longer sends optional query parameters
24
+ that are `undefined` or `null`. Previously `URLSearchParams` turned them
25
+ into the literal text `undefined` / `null`, which the backend rejected
26
+ (for example `start_time=undefined` on `/admin/nodes/simple_tsdata`).
27
+ Numbers and booleans are stringified explicitly, and a params object
28
+ with no remaining entries produces no `?` at all.
7
29
 
8
30
  ## [1.1.0] - 2026-09-18
9
31
 
@@ -77,8 +77,16 @@ class ESPRMAPIManager {
77
77
  const base = requestConfig.baseURL ?? instance.#baseUrl;
78
78
  let requestUrl = `${base}/${requestConfig.url}`;
79
79
  if (requestConfig.params) {
80
- const queryParams = new URLSearchParams(requestConfig.params).toString();
81
- requestUrl += `?${queryParams}`;
80
+ // `URLSearchParams` stringifies every own key, so an optional param
81
+ // left as `undefined` would reach the backend as the literal text
82
+ // "undefined" and fail validation. Drop absent values and let
83
+ // numbers / booleans stringify explicitly.
84
+ const queryEntries = Object.entries(requestConfig.params)
85
+ .filter(([, value]) => value !== undefined && value !== null)
86
+ .map(([key, value]) => [key, String(value)]);
87
+ if (queryEntries.length > 0) {
88
+ requestUrl += `?${new URLSearchParams(queryEntries).toString()}`;
89
+ }
82
90
  }
83
91
  const fetchOptions = {
84
92
  method: requestConfig.method,
@@ -75,8 +75,16 @@ class ESPRMAPIManager {
75
75
  const base = requestConfig.baseURL ?? instance.#baseUrl;
76
76
  let requestUrl = `${base}/${requestConfig.url}`;
77
77
  if (requestConfig.params) {
78
- const queryParams = new URLSearchParams(requestConfig.params).toString();
79
- requestUrl += `?${queryParams}`;
78
+ // `URLSearchParams` stringifies every own key, so an optional param
79
+ // left as `undefined` would reach the backend as the literal text
80
+ // "undefined" and fail validation. Drop absent values and let
81
+ // numbers / booleans stringify explicitly.
82
+ const queryEntries = Object.entries(requestConfig.params)
83
+ .filter(([, value]) => value !== undefined && value !== null)
84
+ .map(([key, value]) => [key, String(value)]);
85
+ if (queryEntries.length > 0) {
86
+ requestUrl += `?${new URLSearchParams(queryEntries).toString()}`;
87
+ }
80
88
  }
81
89
  const fetchOptions = {
82
90
  method: requestConfig.method,
@@ -42,10 +42,16 @@ export interface GetSimpleTimeSeriesDataParams {
42
42
  node_id: string;
43
43
  /** Parameter name to query. */
44
44
  param_name: string;
45
- /** Start of the time range (epoch seconds). */
46
- start_time: number;
47
- /** End of the time range (epoch seconds). */
48
- end_time: number;
45
+ /**
46
+ * Start of the time range (epoch seconds). Omit to start from the oldest
47
+ * stored record. The backend rejects a range whose start is after its end.
48
+ */
49
+ start_time?: number;
50
+ /**
51
+ * End of the time range (epoch seconds). Omit to include records up to
52
+ * the current time.
53
+ */
54
+ end_time?: number;
49
55
  /**
50
56
  * Expected data type of the parameter values (GET query param `type`,
51
57
  * e.g. `int`, `float`).
@@ -53,7 +59,7 @@ export interface GetSimpleTimeSeriesDataParams {
53
59
  type: string;
54
60
  /** ID to start pagination from. */
55
61
  start_id?: string;
56
- /** Maximum number of records to return. */
62
+ /** Maximum number of records to return. The backend caps this at 200. */
57
63
  num_records?: number;
58
64
  }
59
65
  /** Time series data for a single parameter. */
@@ -42,10 +42,16 @@ export interface GetSimpleTimeSeriesDataParams {
42
42
  node_id: string;
43
43
  /** Parameter name to query. */
44
44
  param_name: string;
45
- /** Start of the time range (epoch seconds). */
46
- start_time: number;
47
- /** End of the time range (epoch seconds). */
48
- end_time: number;
45
+ /**
46
+ * Start of the time range (epoch seconds). Omit to start from the oldest
47
+ * stored record. The backend rejects a range whose start is after its end.
48
+ */
49
+ start_time?: number;
50
+ /**
51
+ * End of the time range (epoch seconds). Omit to include records up to
52
+ * the current time.
53
+ */
54
+ end_time?: number;
49
55
  /**
50
56
  * Expected data type of the parameter values (GET query param `type`,
51
57
  * e.g. `int`, `float`).
@@ -53,7 +59,7 @@ export interface GetSimpleTimeSeriesDataParams {
53
59
  type: string;
54
60
  /** ID to start pagination from. */
55
61
  start_id?: string;
56
- /** Maximum number of records to return. */
62
+ /** Maximum number of records to return. The backend caps this at 200. */
57
63
  num_records?: number;
58
64
  }
59
65
  /** Time series data for a single parameter. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@espressif/rainmaker-admin-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Espressif's Rainmaker Admin SDK enables seamless integration of admin applications with the ESP Rainmaker ecosystem.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Espressif Systems (Shanghai) CO LTD",