@espressif/rainmaker-admin-sdk 1.0.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +107 -1
  2. package/dist/cjs/entries/ESPRMAdminOTAImage.cjs +1 -0
  3. package/dist/cjs/entries/ESPRMAdminOTAJob.cjs +2 -1
  4. package/dist/cjs/index.cjs +3 -1
  5. package/dist/cjs/methods/ESPRMAdminOTAImage/ArchiveImage.cjs +10 -1
  6. package/dist/cjs/methods/ESPRMAdminOTAImage/DeleteImage.cjs +4 -3
  7. package/dist/cjs/methods/ESPRMAdminOTAImage/DeletePackage.cjs +25 -0
  8. package/dist/cjs/methods/ESPRMAdminOTAImage/deleteParams.cjs +21 -0
  9. package/dist/cjs/methods/ESPRMAdminOTAJob/ArchiveJob.cjs +24 -0
  10. package/dist/cjs/methods/ESPRMAdminOTAJob/{DeleteJob.cjs → CancelJob.cjs} +4 -4
  11. package/dist/cjs/methods/ESPRMAdminOTAJob/RetriggerJob.cjs +2 -2
  12. package/dist/cjs/services/ESPRMAPIManager.cjs +10 -2
  13. package/dist/cjs/utils/constants.cjs +2 -1
  14. package/dist/cjs/utils/error/errorMessages.cjs +1 -0
  15. package/dist/esm/entries/ESPRMAdminOTAImage.js +1 -0
  16. package/dist/esm/entries/ESPRMAdminOTAJob.js +2 -1
  17. package/dist/esm/index.js +3 -1
  18. package/dist/esm/methods/ESPRMAdminOTAImage/ArchiveImage.js +10 -1
  19. package/dist/esm/methods/ESPRMAdminOTAImage/DeleteImage.js +4 -3
  20. package/dist/esm/methods/ESPRMAdminOTAImage/DeletePackage.js +23 -0
  21. package/dist/esm/methods/ESPRMAdminOTAImage/deleteParams.js +19 -0
  22. package/dist/esm/methods/ESPRMAdminOTAJob/ArchiveJob.js +22 -0
  23. package/dist/esm/methods/ESPRMAdminOTAJob/{DeleteJob.js → CancelJob.js} +4 -4
  24. package/dist/esm/methods/ESPRMAdminOTAJob/RetriggerJob.js +2 -2
  25. package/dist/esm/services/ESPRMAPIManager.js +10 -2
  26. package/dist/esm/utils/constants.js +2 -1
  27. package/dist/esm/utils/error/errorMessages.js +1 -0
  28. package/dist/types/methods/ESPRMAdminOTAImage/ArchiveImage.d.ts +6 -3
  29. package/dist/types/methods/ESPRMAdminOTAImage/DeleteImage.d.ts +6 -2
  30. package/dist/types/methods/ESPRMAdminOTAImage/DeletePackage.d.ts +22 -0
  31. package/dist/types/methods/ESPRMAdminOTAImage/deleteParams.d.ts +13 -0
  32. package/dist/types/methods/ESPRMAdminOTAImage/index.d.ts +1 -0
  33. package/dist/types/methods/ESPRMAdminOTAJob/ArchiveJob.d.ts +22 -0
  34. package/dist/types/methods/ESPRMAdminOTAJob/CancelJob.d.ts +21 -0
  35. package/dist/types/methods/ESPRMAdminOTAJob/RetriggerJob.d.ts +9 -5
  36. package/dist/types/methods/ESPRMAdminOTAJob/index.d.ts +2 -1
  37. package/dist/types/types/input.d.ts +1 -1
  38. package/dist/types/types/ota.d.ts +95 -10
  39. package/dist/types/types/output.d.ts +1 -1
  40. package/dist/types/types/time_series.d.ts +11 -5
  41. package/dist/types/utils/constants.d.ts +2 -1
  42. package/dist/types/utils/error/errorMessages.d.ts +1 -0
  43. package/dist/types-cjs/methods/ESPRMAdminOTAImage/ArchiveImage.d.cts +6 -3
  44. package/dist/types-cjs/methods/ESPRMAdminOTAImage/DeleteImage.d.cts +6 -2
  45. package/dist/types-cjs/methods/ESPRMAdminOTAImage/DeletePackage.d.cts +22 -0
  46. package/dist/types-cjs/methods/ESPRMAdminOTAImage/deleteParams.d.cts +13 -0
  47. package/dist/types-cjs/methods/ESPRMAdminOTAImage/index.d.cts +1 -0
  48. package/dist/types-cjs/methods/ESPRMAdminOTAJob/ArchiveJob.d.cts +22 -0
  49. package/dist/types-cjs/methods/ESPRMAdminOTAJob/CancelJob.d.cts +21 -0
  50. package/dist/types-cjs/methods/ESPRMAdminOTAJob/RetriggerJob.d.cts +9 -5
  51. package/dist/types-cjs/methods/ESPRMAdminOTAJob/index.d.cts +2 -1
  52. package/dist/types-cjs/types/input.d.cts +1 -1
  53. package/dist/types-cjs/types/ota.d.cts +95 -10
  54. package/dist/types-cjs/types/output.d.cts +1 -1
  55. package/dist/types-cjs/types/time_series.d.cts +11 -5
  56. package/dist/types-cjs/utils/constants.d.cts +2 -1
  57. package/dist/types-cjs/utils/error/errorMessages.d.cts +1 -0
  58. package/package.json +1 -1
  59. package/dist/types/methods/ESPRMAdminOTAJob/DeleteJob.d.ts +0 -17
  60. package/dist/types-cjs/methods/ESPRMAdminOTAJob/DeleteJob.d.cts +0 -17
@@ -26,16 +26,31 @@ export interface GetOTAImagesParams {
26
26
  type?: string;
27
27
  /** Filter by node model. */
28
28
  model?: string;
29
- /** Filter by firmware version. */
29
+ /**
30
+ * Filter by firmware version.
31
+ *
32
+ * @deprecated Ignored by the backend, which has no `fw_version` filter on this endpoint.
33
+ */
30
34
  fw_version?: string;
31
35
  /** Maximum number of records to return. */
32
36
  num_records?: string;
33
37
  /** Image ID to start pagination from. */
34
38
  start_id?: string;
35
- /** Substring filter for image name. */
39
+ /**
40
+ * Substring filter for image name, as the string `"true"`. Applies to `image_name`
41
+ * only; without it the name lookup is an exact match.
42
+ */
36
43
  contains?: string;
37
- /** Filter by archived status. */
44
+ /**
45
+ * Return only archived images. Honoured by the unfiltered listing only — the
46
+ * `ota_image_id`, `image_name`, `type` and `model` lookups span both states.
47
+ */
38
48
  archived?: boolean;
49
+ /**
50
+ * Return archived and unarchived images alike. Same listing-only caveat as
51
+ * `archived`, and takes precedence over it.
52
+ */
53
+ all?: boolean;
39
54
  }
40
55
  /** Parameters for archiving or unarchiving an OTA image. */
41
56
  export interface ArchiveOTAImageParams {
@@ -44,6 +59,16 @@ export interface ArchiveOTAImageParams {
44
59
  /** Whether to archive (true) or unarchive (false). */
45
60
  archive: boolean;
46
61
  }
62
+ /** Parameters for deleting an OTA image or the package it came from. */
63
+ export interface DeleteOTAImageParams {
64
+ /** ID of the OTA image to delete. */
65
+ ota_image_id: string;
66
+ /**
67
+ * Delete an image that is still referenced by OTA jobs. Never overrides a
68
+ * reference from an *active* job, which is rejected regardless of this flag.
69
+ */
70
+ force_delete?: boolean;
71
+ }
47
72
  /** Time window (minutes past midnight) during which the node may apply the OTA. */
48
73
  export interface OtaJobDownloadWindow {
49
74
  /** Window start, in minutes past midnight (0-1439). */
@@ -150,6 +175,21 @@ export interface UpdateOTAJobParams {
150
175
  /** Additional update fields. */
151
176
  [key: string]: unknown;
152
177
  }
178
+ /** Request body for cancelling an in-flight OTA job. */
179
+ export interface CancelOTAJobRequest {
180
+ /** ID of the OTA job to cancel. */
181
+ ota_job_id: string;
182
+ }
183
+ /**
184
+ * Request body for archiving an OTA job.
185
+ *
186
+ * The `archive` flag is supplied by `archiveJob` itself and is deliberately not
187
+ * part of this type: archiving is one-way, so there is no `archive: false`.
188
+ */
189
+ export interface ArchiveOTAJobRequest {
190
+ /** ID of the OTA job to archive. */
191
+ ota_job_id: string;
192
+ }
153
193
  /** Parameters for fetching OTA job status. */
154
194
  export interface GetOTAJobStatusParams {
155
195
  /** ID of the OTA job to check status for. */
@@ -180,12 +220,13 @@ export interface OTAJobStatusSummaryResponse {
180
220
  failed?: number;
181
221
  total?: number;
182
222
  }
183
- /** Request body for retriggering a failed OTA job. */
223
+ /**
224
+ * Request body for retriggering an OTA job, pushing it to every node that is
225
+ * still pending. The backend accepts no other fields.
226
+ */
184
227
  export interface RetriggerOTAJobRequest {
185
228
  /** ID of the OTA job to retrigger. */
186
229
  ota_job_id: string;
187
- /** List of node IDs to retrigger the job for. */
188
- node_ids?: string[];
189
230
  }
190
231
  /** Related artifact bundled with an OTA image (e.g. bootloader). */
191
232
  export interface OTAImageRelatedFile {
@@ -212,12 +253,28 @@ export interface OTAImageInfo {
212
253
  fw_version: string;
213
254
  /** Size of the image file in bytes. */
214
255
  file_size?: number;
215
- /** Current status of the image. */
256
+ /**
257
+ * Current status of the image.
258
+ *
259
+ * @deprecated Never returned for OTA images; carried over from the OTA job type.
260
+ */
216
261
  status?: string;
217
- /** Timestamp when the image was created. */
262
+ /**
263
+ * Timestamp when the image was created.
264
+ *
265
+ * @deprecated Never returned for OTA images; use `upload_timestamp`.
266
+ */
218
267
  timestamp?: number;
219
- /** Whether the image is archived. */
268
+ /**
269
+ * Whether the image is archived. Omitted entirely rather than set to `false` for
270
+ * images that have never been archived.
271
+ */
220
272
  archived?: boolean;
273
+ /**
274
+ * Name of the package archive this image was extracted from, when it was uploaded
275
+ * as a package. Such images can only be removed via `deletePackage`.
276
+ */
277
+ package?: string;
221
278
  /** Presigned or public URL for the main firmware binary (detail responses). */
222
279
  image_url?: string;
223
280
  /** MD5 checksum of the main image file (detail responses). */
@@ -248,7 +305,11 @@ export interface GetOTAImagesResponse {
248
305
  ota_images?: OTAImageInfo[];
249
306
  /** ID to use for fetching the next page. */
250
307
  next_id?: string;
251
- /** Total number of images matching the query. */
308
+ /**
309
+ * Total number of images matching the query.
310
+ *
311
+ * @deprecated Never sent by the backend for OTA images.
312
+ */
252
313
  total?: number;
253
314
  }
254
315
  /** OTA job response. */
@@ -269,9 +330,21 @@ export interface OTAJobInfo {
269
330
  additional_info?: string;
270
331
  /** Whether the job is continuous / recurring when returned by the API. */
271
332
  continuous?: boolean;
333
+ /**
334
+ * Present and `true` once the job has been archived. Archiving is one-way,
335
+ * so the attribute is absent rather than `false` on unarchived jobs.
336
+ */
337
+ archived?: boolean;
272
338
  /** Additional job properties. */
273
339
  [key: string]: unknown;
274
340
  }
341
+ /**
342
+ * Response returned by the cancel and archive operations.
343
+ *
344
+ * The backend re-reads the job after applying the update and returns its full
345
+ * record, so this is the updated job itself rather than a bare acknowledgement.
346
+ */
347
+ export type OTAJobUpdateResponse = OTAJobInfo;
275
348
  /** Response returned after creating an OTA job. */
276
349
  export interface OTAJobCreateResponse {
277
350
  /** ID assigned to the newly created job. */
@@ -281,6 +354,18 @@ export interface OTAJobCreateResponse {
281
354
  /** Human-readable description of the result. */
282
355
  description: string;
283
356
  }
357
+ /**
358
+ * Response returned after retriggering an OTA job.
359
+ *
360
+ * Delivery is dispatched asynchronously, so a success here means the retrigger
361
+ * was accepted — not that any node has received the update yet.
362
+ */
363
+ export interface OTAJobRetriggerResponse {
364
+ /** ID of the job that was retriggered. */
365
+ ota_job_id: string;
366
+ /** Status of the retrigger operation. */
367
+ status: string;
368
+ }
284
369
  /** Paginated response containing a list of OTA jobs. */
285
370
  export interface GetOTAJobsResponse {
286
371
  /** List of OTA job objects. */
@@ -7,7 +7,7 @@ export type { ESPAPIError, ESPAPISuccessResponse } from "./api.cjs";
7
7
  export type { LoginWithPasswordResponse, ExtendSessionResponse, LoginWithoutPasswordResponse, GetUserInfoResponse, } from "./auth.cjs";
8
8
  export type { AdminUserInfo, GetAdminUsersResponse } from "./admin_user.cjs";
9
9
  export type { AdminNodeInfo, AdminNodeListResponse, GetNodeTagsResponse, NodeStatusSummaryResponse, } from "./node.cjs";
10
- export type { OTAImageInfo, OTAImageRelatedFile, OTAImageCreateResponse, GetOTAImagesResponse, OTAImageUploadUrlResponse, ConfirmOTAImageUploadResponse, OTAPackageUploadUrlResponse, ConfirmOTAPackageUploadResponse, OTAJobInfo, OTAJobCreateResponse, GetOTAJobsResponse, NodeOTAJobStatusEntry, OTAJobStatusResponse, OTAJobStatusSummaryResponse, } from "./ota.cjs";
10
+ export type { OTAImageInfo, OTAImageRelatedFile, OTAImageCreateResponse, GetOTAImagesResponse, OTAImageUploadUrlResponse, ConfirmOTAImageUploadResponse, OTAPackageUploadUrlResponse, ConfirmOTAPackageUploadResponse, OTAJobInfo, OTAJobCreateResponse, OTAJobUpdateResponse, OTAJobRetriggerResponse, GetOTAJobsResponse, NodeOTAJobStatusEntry, OTAJobStatusResponse, OTAJobStatusSummaryResponse, } from "./ota.cjs";
11
11
  export type { AdminGroupInfo, CreateAdminGroupResponse, GetAdminGroupsResponse, } from "./group.cjs";
12
12
  export type { TagResourceInfo, GetAdminTagsResponse, GetTagNamesResponse, } from "./tag.cjs";
13
13
  export type { CommandRequestInfo, GetCommandRequestsResponse, AddCommandRequestResponse, } from "./command_response.cjs";
@@ -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. */
@@ -27,7 +27,7 @@ declare const APIEndpoints: {
27
27
  readonly ADMIN_OTA_JOB: "admin/otajob";
28
28
  readonly ADMIN_OTA_JOB_STATUS: "admin/otajob/status";
29
29
  readonly ADMIN_OTA_JOB_STATUS_SUMMARY: "admin/otajob/status/summary";
30
- readonly ADMIN_OTA_JOB_ACTION: "admin/otajob";
30
+ readonly ADMIN_OTA_JOB_RETRIGGER: "admin/otajob/retrigger";
31
31
  readonly ADMIN_NODE_GROUP: "admin/node_group";
32
32
  readonly ADMIN_TAGS: "admin/tags";
33
33
  readonly ADMIN_TAG_NAMES: "admin/tags/names";
@@ -115,6 +115,7 @@ declare const StorageAdapterErrorCodes: {
115
115
  declare const APICallValidationErrorCodes: {
116
116
  readonly MISSING_NODE_ID: "MISSING_NODE_ID";
117
117
  readonly MISSING_OTA_IMAGE_ID: "MISSING_OTA_IMAGE_ID";
118
+ readonly MISSING_ARCHIVE_FLAG: "MISSING_ARCHIVE_FLAG";
118
119
  readonly MISSING_OTA_JOB_ID: "MISSING_OTA_JOB_ID";
119
120
  readonly MISSING_GROUP_ID: "MISSING_GROUP_ID";
120
121
  readonly MISSING_GROUP_NAME: "MISSING_GROUP_NAME";
@@ -19,6 +19,7 @@ declare const storageAdapterErrorMessages: {
19
19
  declare const apiCallValidationErrorMessages: {
20
20
  MISSING_NODE_ID: string;
21
21
  MISSING_OTA_IMAGE_ID: string;
22
+ MISSING_ARCHIVE_FLAG: string;
22
23
  MISSING_OTA_JOB_ID: string;
23
24
  MISSING_GROUP_ID: string;
24
25
  MISSING_GROUP_NAME: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@espressif/rainmaker-admin-sdk",
3
- "version": "1.0.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",
@@ -1,17 +0,0 @@
1
- /*
2
- * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
- *
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { ESPAPISuccessResponse } from "../../types/api.js";
7
- declare module "../../ESPRMAdminOTAJob.js" {
8
- interface ESPRMAdminOTAJob {
9
- /**
10
- * Deletes an OTA job by its job ID.
11
- *
12
- * @param otaJobId - The ID of the OTA job to delete.
13
- * @returns A success response confirming the job was deleted.
14
- */
15
- deleteJob(otaJobId: string): Promise<ESPAPISuccessResponse>;
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- /*
2
- * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
- *
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { ESPAPISuccessResponse } from "../../types/api.cjs";
7
- declare module "../../ESPRMAdminOTAJob.cjs" {
8
- interface ESPRMAdminOTAJob {
9
- /**
10
- * Deletes an OTA job by its job ID.
11
- *
12
- * @param otaJobId - The ID of the OTA job to delete.
13
- * @returns A success response confirming the job was deleted.
14
- */
15
- deleteJob(otaJobId: string): Promise<ESPAPISuccessResponse>;
16
- }
17
- }