@espressif/rainmaker-admin-sdk 1.0.0 → 1.1.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +84 -0
  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/utils/constants.cjs +2 -1
  13. package/dist/cjs/utils/error/errorMessages.cjs +1 -0
  14. package/dist/esm/entries/ESPRMAdminOTAImage.js +1 -0
  15. package/dist/esm/entries/ESPRMAdminOTAJob.js +2 -1
  16. package/dist/esm/index.js +3 -1
  17. package/dist/esm/methods/ESPRMAdminOTAImage/ArchiveImage.js +10 -1
  18. package/dist/esm/methods/ESPRMAdminOTAImage/DeleteImage.js +4 -3
  19. package/dist/esm/methods/ESPRMAdminOTAImage/DeletePackage.js +23 -0
  20. package/dist/esm/methods/ESPRMAdminOTAImage/deleteParams.js +19 -0
  21. package/dist/esm/methods/ESPRMAdminOTAJob/ArchiveJob.js +22 -0
  22. package/dist/esm/methods/ESPRMAdminOTAJob/{DeleteJob.js → CancelJob.js} +4 -4
  23. package/dist/esm/methods/ESPRMAdminOTAJob/RetriggerJob.js +2 -2
  24. package/dist/esm/utils/constants.js +2 -1
  25. package/dist/esm/utils/error/errorMessages.js +1 -0
  26. package/dist/types/methods/ESPRMAdminOTAImage/ArchiveImage.d.ts +6 -3
  27. package/dist/types/methods/ESPRMAdminOTAImage/DeleteImage.d.ts +6 -2
  28. package/dist/types/methods/ESPRMAdminOTAImage/DeletePackage.d.ts +22 -0
  29. package/dist/types/methods/ESPRMAdminOTAImage/deleteParams.d.ts +13 -0
  30. package/dist/types/methods/ESPRMAdminOTAImage/index.d.ts +1 -0
  31. package/dist/types/methods/ESPRMAdminOTAJob/ArchiveJob.d.ts +22 -0
  32. package/dist/types/methods/ESPRMAdminOTAJob/CancelJob.d.ts +21 -0
  33. package/dist/types/methods/ESPRMAdminOTAJob/RetriggerJob.d.ts +9 -5
  34. package/dist/types/methods/ESPRMAdminOTAJob/index.d.ts +2 -1
  35. package/dist/types/types/input.d.ts +1 -1
  36. package/dist/types/types/ota.d.ts +95 -10
  37. package/dist/types/types/output.d.ts +1 -1
  38. package/dist/types/utils/constants.d.ts +2 -1
  39. package/dist/types/utils/error/errorMessages.d.ts +1 -0
  40. package/dist/types-cjs/methods/ESPRMAdminOTAImage/ArchiveImage.d.cts +6 -3
  41. package/dist/types-cjs/methods/ESPRMAdminOTAImage/DeleteImage.d.cts +6 -2
  42. package/dist/types-cjs/methods/ESPRMAdminOTAImage/DeletePackage.d.cts +22 -0
  43. package/dist/types-cjs/methods/ESPRMAdminOTAImage/deleteParams.d.cts +13 -0
  44. package/dist/types-cjs/methods/ESPRMAdminOTAImage/index.d.cts +1 -0
  45. package/dist/types-cjs/methods/ESPRMAdminOTAJob/ArchiveJob.d.cts +22 -0
  46. package/dist/types-cjs/methods/ESPRMAdminOTAJob/CancelJob.d.cts +21 -0
  47. package/dist/types-cjs/methods/ESPRMAdminOTAJob/RetriggerJob.d.cts +9 -5
  48. package/dist/types-cjs/methods/ESPRMAdminOTAJob/index.d.cts +2 -1
  49. package/dist/types-cjs/types/input.d.cts +1 -1
  50. package/dist/types-cjs/types/ota.d.cts +95 -10
  51. package/dist/types-cjs/types/output.d.cts +1 -1
  52. package/dist/types-cjs/utils/constants.d.cts +2 -1
  53. package/dist/types-cjs/utils/error/errorMessages.d.cts +1 -0
  54. package/package.json +1 -1
  55. package/dist/types/methods/ESPRMAdminOTAJob/DeleteJob.d.ts +0 -17
  56. package/dist/types-cjs/methods/ESPRMAdminOTAJob/DeleteJob.d.cts +0 -17
@@ -3,16 +3,20 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { RetriggerOTAJobRequest } from "../../types/ota.js";
7
- import { ESPAPISuccessResponse } from "../../types/api.js";
6
+ import { OTAJobRetriggerResponse, RetriggerOTAJobRequest } from "../../types/ota.js";
8
7
  declare module "../../ESPRMAdminOTAJob.js" {
9
8
  interface ESPRMAdminOTAJob {
10
9
  /**
11
- * Retriggers a previously created OTA job for failed or pending nodes.
10
+ * Retriggers an OTA job, pushing it again to every node still pending.
11
+ *
12
+ * The backend rejects this for jobs that are not active, that have expired,
13
+ * that require user approval, or that were created with an auto-selected
14
+ * signing key. Delivery is dispatched asynchronously, so a success means
15
+ * the retrigger was accepted, not that any node has received it.
12
16
  *
13
17
  * @param params - Parameters including the OTA job ID to retrigger.
14
- * @returns A success response confirming the job was retriggered.
18
+ * @returns The job ID and the status of the retrigger operation.
15
19
  */
16
- retriggerJob(params: RetriggerOTAJobRequest): Promise<ESPAPISuccessResponse>;
20
+ retriggerJob(params: RetriggerOTAJobRequest): Promise<OTAJobRetriggerResponse>;
17
21
  }
18
22
  }
@@ -6,7 +6,8 @@
6
6
  import "./CreateJob.js";
7
7
  import "./GetJob.js";
8
8
  import "./UpdateJob.js";
9
- import "./DeleteJob.js";
9
+ import "./CancelJob.js";
10
+ import "./ArchiveJob.js";
10
11
  import "./GetJobStatus.js";
11
12
  import "./GetJobStatusSummary.js";
12
13
  import "./RetriggerJob.js";
@@ -8,7 +8,7 @@ export type { ESPRMBaseConfig, ESPRMAPIManagerConfig, UserTokensData } from "./c
8
8
  export type { SignUpRequest, ConfirmUserRequest, ChangePasswordRequest, ForgotPasswordRequest, ForgotPasswordConfirmRequest, LogoutRequest, UpdateUserProfileRequest, DeleteAccountParams, } from "./auth.js";
9
9
  export type { CreateAdminUserRequest, UpdateAdminUserRequest, GetAdminUsersParams, DeleteAdminUserParams, } from "./admin_user.js";
10
10
  export type { GetAdminNodesParams, ActivateDeactivateNodesParams, GetNodeTagsParams, NodeAttachTagsRequest, } from "./node.js";
11
- export type { CreateOTAImageRequest, GetOTAImagesParams, ArchiveOTAImageParams, GetOTAImageUploadUrlParams, ConfirmOTAImageUploadRequest, GetOTAPackageUploadUrlParams, ConfirmOTAPackageUploadRequest, CreateOTAJobRequest, CreateOTAJobQueryOptions, OtaJobDownloadWindow, OtaJobValidity, OtaJobMetadata, OtaSecureBoot, OtaNetworkSerialisation, GetOTAJobParams, UpdateOTAJobParams, GetOTAJobStatusParams, GetOTAJobStatusSummaryParams, RetriggerOTAJobRequest, } from "./ota.js";
11
+ export type { CreateOTAImageRequest, GetOTAImagesParams, ArchiveOTAImageParams, DeleteOTAImageParams, GetOTAImageUploadUrlParams, ConfirmOTAImageUploadRequest, GetOTAPackageUploadUrlParams, ConfirmOTAPackageUploadRequest, CreateOTAJobRequest, CreateOTAJobQueryOptions, OtaJobDownloadWindow, OtaJobValidity, OtaJobMetadata, OtaSecureBoot, OtaNetworkSerialisation, GetOTAJobParams, UpdateOTAJobParams, CancelOTAJobRequest, ArchiveOTAJobRequest, GetOTAJobStatusParams, GetOTAJobStatusSummaryParams, RetriggerOTAJobRequest, } from "./ota.js";
12
12
  export type { CreateAdminGroupRequest, UpdateAdminGroupRequest, GetAdminGroupsParams, } from "./group.js";
13
13
  export type { GetAdminTagsParams, AttachDetachTagsParams, GetTagNamesParams, } from "./tag.js";
14
14
  export type { GetCommandRequestsParams, AddCommandRequestBody, } from "./command_response.js";
@@ -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.js";
7
7
  export type { LoginWithPasswordResponse, ExtendSessionResponse, LoginWithoutPasswordResponse, GetUserInfoResponse, } from "./auth.js";
8
8
  export type { AdminUserInfo, GetAdminUsersResponse } from "./admin_user.js";
9
9
  export type { AdminNodeInfo, AdminNodeListResponse, GetNodeTagsResponse, NodeStatusSummaryResponse, } from "./node.js";
10
- export type { OTAImageInfo, OTAImageRelatedFile, OTAImageCreateResponse, GetOTAImagesResponse, OTAImageUploadUrlResponse, ConfirmOTAImageUploadResponse, OTAPackageUploadUrlResponse, ConfirmOTAPackageUploadResponse, OTAJobInfo, OTAJobCreateResponse, GetOTAJobsResponse, NodeOTAJobStatusEntry, OTAJobStatusResponse, OTAJobStatusSummaryResponse, } from "./ota.js";
10
+ export type { OTAImageInfo, OTAImageRelatedFile, OTAImageCreateResponse, GetOTAImagesResponse, OTAImageUploadUrlResponse, ConfirmOTAImageUploadResponse, OTAPackageUploadUrlResponse, ConfirmOTAPackageUploadResponse, OTAJobInfo, OTAJobCreateResponse, OTAJobUpdateResponse, OTAJobRetriggerResponse, GetOTAJobsResponse, NodeOTAJobStatusEntry, OTAJobStatusResponse, OTAJobStatusSummaryResponse, } from "./ota.js";
11
11
  export type { AdminGroupInfo, CreateAdminGroupResponse, GetAdminGroupsResponse, } from "./group.js";
12
12
  export type { TagResourceInfo, GetAdminTagsResponse, GetTagNamesResponse, } from "./tag.js";
13
13
  export type { CommandRequestInfo, GetCommandRequestsResponse, AddCommandRequestResponse, } from "./command_response.js";
@@ -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;
@@ -8,10 +8,13 @@ import { ESPAPISuccessResponse } from "../../types/api.cjs";
8
8
  declare module "../../ESPRMAdminOTAImage.cjs" {
9
9
  interface ESPRMAdminOTAImage {
10
10
  /**
11
- * Archives an OTA firmware image by its image ID.
11
+ * Archives or unarchives an OTA firmware image by its image ID.
12
12
  *
13
- * @param params - Parameters including the OTA image ID to archive.
14
- * @returns A success response confirming the image was archived.
13
+ * Unlike OTA jobs, image archiving is two-way: pass `archive: false` to restore
14
+ * an archived image.
15
+ *
16
+ * @param params - The OTA image ID and the desired archived state.
17
+ * @returns A success response confirming the new archived state.
15
18
  */
16
19
  archiveImage(params: ArchiveOTAImageParams): Promise<ESPAPISuccessResponse>;
17
20
  }
@@ -3,15 +3,19 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { DeleteOTAImageParams } from "../../types/ota.cjs";
6
7
  import { ESPAPISuccessResponse } from "../../types/api.cjs";
7
8
  declare module "../../ESPRMAdminOTAImage.cjs" {
8
9
  interface ESPRMAdminOTAImage {
9
10
  /**
10
11
  * Deletes an OTA firmware image by its image ID.
11
12
  *
12
- * @param otaImageId - The ID of the OTA image to delete.
13
+ * Images uploaded as part of a package are rejected by this endpoint and must
14
+ * be removed with {@link ESPRMAdminOTAImage.deletePackage} instead.
15
+ *
16
+ * @param params - The OTA image ID, and optionally `force_delete`.
13
17
  * @returns A success response confirming the image was deleted.
14
18
  */
15
- deleteImage(otaImageId: string): Promise<ESPAPISuccessResponse>;
19
+ deleteImage(params: DeleteOTAImageParams): Promise<ESPAPISuccessResponse>;
16
20
  }
17
21
  }
@@ -0,0 +1,22 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DeleteOTAImageParams } from "../../types/ota.cjs";
7
+ import { ESPAPISuccessResponse } from "../../types/api.cjs";
8
+ declare module "../../ESPRMAdminOTAImage.cjs" {
9
+ interface ESPRMAdminOTAImage {
10
+ /**
11
+ * Deletes an OTA image that was uploaded as part of a package, removing both the
12
+ * image and the package archive it came from.
13
+ *
14
+ * Images uploaded as a standalone binary should use
15
+ * {@link ESPRMAdminOTAImage.deleteImage} instead.
16
+ *
17
+ * @param params - The OTA image ID, and optionally `force_delete`.
18
+ * @returns A success response confirming the package was deleted.
19
+ */
20
+ deletePackage(params: DeleteOTAImageParams): Promise<ESPAPISuccessResponse>;
21
+ }
22
+ }
@@ -0,0 +1,13 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DeleteOTAImageParams } from "../../types/ota.cjs";
7
+ /**
8
+ * Builds the query string shared by the image and package delete endpoints.
9
+ *
10
+ * `force_delete` is sent only when requested: the backend reads it as a string and
11
+ * treats any value other than "true" as false, so omitting it keeps the URL clean.
12
+ */
13
+ export declare function buildDeleteOTAImageParams(params: DeleteOTAImageParams): Record<string, string>;
@@ -11,3 +11,4 @@ import "./ConfirmPackageUpload.cjs";
11
11
  import "./GetImages.cjs";
12
12
  import "./ArchiveImage.cjs";
13
13
  import "./DeleteImage.cjs";
14
+ import "./DeletePackage.cjs";
@@ -0,0 +1,22 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { ArchiveOTAJobRequest, OTAJobUpdateResponse } from "../../types/ota.cjs";
7
+ declare module "../../ESPRMAdminOTAJob.cjs" {
8
+ interface ESPRMAdminOTAJob {
9
+ /**
10
+ * Archives an OTA job so it no longer appears in the default job listing.
11
+ *
12
+ * Only jobs that have finished, been cancelled or expired can be archived,
13
+ * and only once: archiving is one-way and the backend rejects an already
14
+ * archived job. Archived jobs are retrieved by listing with `archived` or
15
+ * `all` set.
16
+ *
17
+ * @param params - Parameters including the OTA job ID to archive.
18
+ * @returns The updated OTA job record.
19
+ */
20
+ archiveJob(params: ArchiveOTAJobRequest): Promise<OTAJobUpdateResponse>;
21
+ }
22
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CancelOTAJobRequest, OTAJobUpdateResponse } from "../../types/ota.cjs";
7
+ declare module "../../ESPRMAdminOTAJob.cjs" {
8
+ interface ESPRMAdminOTAJob {
9
+ /**
10
+ * Cancels an in-flight OTA job, marking it and all of its pending nodes as
11
+ * cancelled.
12
+ *
13
+ * Only jobs that are still active can be cancelled; the backend rejects
14
+ * jobs that are already finished, cancelled, failed or expired.
15
+ *
16
+ * @param params - Parameters including the OTA job ID to cancel.
17
+ * @returns The updated OTA job record.
18
+ */
19
+ cancelJob(params: CancelOTAJobRequest): Promise<OTAJobUpdateResponse>;
20
+ }
21
+ }
@@ -3,16 +3,20 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { RetriggerOTAJobRequest } from "../../types/ota.cjs";
7
- import { ESPAPISuccessResponse } from "../../types/api.cjs";
6
+ import { OTAJobRetriggerResponse, RetriggerOTAJobRequest } from "../../types/ota.cjs";
8
7
  declare module "../../ESPRMAdminOTAJob.cjs" {
9
8
  interface ESPRMAdminOTAJob {
10
9
  /**
11
- * Retriggers a previously created OTA job for failed or pending nodes.
10
+ * Retriggers an OTA job, pushing it again to every node still pending.
11
+ *
12
+ * The backend rejects this for jobs that are not active, that have expired,
13
+ * that require user approval, or that were created with an auto-selected
14
+ * signing key. Delivery is dispatched asynchronously, so a success means
15
+ * the retrigger was accepted, not that any node has received it.
12
16
  *
13
17
  * @param params - Parameters including the OTA job ID to retrigger.
14
- * @returns A success response confirming the job was retriggered.
18
+ * @returns The job ID and the status of the retrigger operation.
15
19
  */
16
- retriggerJob(params: RetriggerOTAJobRequest): Promise<ESPAPISuccessResponse>;
20
+ retriggerJob(params: RetriggerOTAJobRequest): Promise<OTAJobRetriggerResponse>;
17
21
  }
18
22
  }
@@ -6,7 +6,8 @@
6
6
  import "./CreateJob.cjs";
7
7
  import "./GetJob.cjs";
8
8
  import "./UpdateJob.cjs";
9
- import "./DeleteJob.cjs";
9
+ import "./CancelJob.cjs";
10
+ import "./ArchiveJob.cjs";
10
11
  import "./GetJobStatus.cjs";
11
12
  import "./GetJobStatusSummary.cjs";
12
13
  import "./RetriggerJob.cjs";
@@ -8,7 +8,7 @@ export type { ESPRMBaseConfig, ESPRMAPIManagerConfig, UserTokensData } from "./c
8
8
  export type { SignUpRequest, ConfirmUserRequest, ChangePasswordRequest, ForgotPasswordRequest, ForgotPasswordConfirmRequest, LogoutRequest, UpdateUserProfileRequest, DeleteAccountParams, } from "./auth.cjs";
9
9
  export type { CreateAdminUserRequest, UpdateAdminUserRequest, GetAdminUsersParams, DeleteAdminUserParams, } from "./admin_user.cjs";
10
10
  export type { GetAdminNodesParams, ActivateDeactivateNodesParams, GetNodeTagsParams, NodeAttachTagsRequest, } from "./node.cjs";
11
- export type { CreateOTAImageRequest, GetOTAImagesParams, ArchiveOTAImageParams, GetOTAImageUploadUrlParams, ConfirmOTAImageUploadRequest, GetOTAPackageUploadUrlParams, ConfirmOTAPackageUploadRequest, CreateOTAJobRequest, CreateOTAJobQueryOptions, OtaJobDownloadWindow, OtaJobValidity, OtaJobMetadata, OtaSecureBoot, OtaNetworkSerialisation, GetOTAJobParams, UpdateOTAJobParams, GetOTAJobStatusParams, GetOTAJobStatusSummaryParams, RetriggerOTAJobRequest, } from "./ota.cjs";
11
+ export type { CreateOTAImageRequest, GetOTAImagesParams, ArchiveOTAImageParams, DeleteOTAImageParams, GetOTAImageUploadUrlParams, ConfirmOTAImageUploadRequest, GetOTAPackageUploadUrlParams, ConfirmOTAPackageUploadRequest, CreateOTAJobRequest, CreateOTAJobQueryOptions, OtaJobDownloadWindow, OtaJobValidity, OtaJobMetadata, OtaSecureBoot, OtaNetworkSerialisation, GetOTAJobParams, UpdateOTAJobParams, CancelOTAJobRequest, ArchiveOTAJobRequest, GetOTAJobStatusParams, GetOTAJobStatusSummaryParams, RetriggerOTAJobRequest, } from "./ota.cjs";
12
12
  export type { CreateAdminGroupRequest, UpdateAdminGroupRequest, GetAdminGroupsParams, } from "./group.cjs";
13
13
  export type { GetAdminTagsParams, AttachDetachTagsParams, GetTagNamesParams, } from "./tag.cjs";
14
14
  export type { GetCommandRequestsParams, AddCommandRequestBody, } from "./command_response.cjs";
@@ -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";
@@ -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;