@espressif/rainmaker-admin-sdk 1.1.1 → 1.3.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 (119) hide show
  1. package/CHANGELOG.md +209 -0
  2. package/README.md +2 -1
  3. package/dist/cjs/ESPRMBase.cjs +1 -0
  4. package/dist/cjs/ESPRMClaim.cjs +16 -0
  5. package/dist/cjs/entries/ESPRMAdminCommonCustomData.cjs +1 -0
  6. package/dist/cjs/entries/ESPRMAdminNode.cjs +2 -0
  7. package/dist/cjs/entries/ESPRMAdminNodeRegistration.cjs +3 -0
  8. package/dist/cjs/entries/ESPRMClaim.cjs +14 -0
  9. package/dist/cjs/index.cjs +11 -0
  10. package/dist/cjs/methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.cjs +24 -0
  11. package/dist/cjs/methods/ESPRMAdminCommonCustomData/SetCommonCustomData.cjs +7 -0
  12. package/dist/cjs/methods/ESPRMAdminNode/ActivateDeactivateNodes.cjs +11 -1
  13. package/dist/cjs/methods/ESPRMAdminNode/CancelCommandRequests.cjs +27 -0
  14. package/dist/cjs/methods/ESPRMAdminNode/DeleteNode.cjs +24 -0
  15. package/dist/cjs/methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.cjs +25 -0
  16. package/dist/cjs/methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.cjs +24 -0
  17. package/dist/cjs/methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.cjs +21 -0
  18. package/dist/cjs/methods/ESPRMClaim/InitiateClaim.cjs +28 -0
  19. package/dist/cjs/methods/ESPRMClaim/VerifyClaim.cjs +28 -0
  20. package/dist/cjs/services/ESPRMAPIManager.cjs +15 -1
  21. package/dist/cjs/utils/constants.cjs +17 -0
  22. package/dist/cjs/utils/error/errorMessages.cjs +11 -0
  23. package/dist/cjs/utils/validator/ConfigValidator.cjs +9 -0
  24. package/dist/esm/ESPRMBase.js +1 -0
  25. package/dist/esm/ESPRMClaim.js +14 -0
  26. package/dist/esm/entries/ESPRMAdminCommonCustomData.js +1 -0
  27. package/dist/esm/entries/ESPRMAdminNode.js +2 -0
  28. package/dist/esm/entries/ESPRMAdminNodeRegistration.js +3 -0
  29. package/dist/esm/entries/ESPRMClaim.js +8 -0
  30. package/dist/esm/index.js +10 -1
  31. package/dist/esm/methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.js +22 -0
  32. package/dist/esm/methods/ESPRMAdminCommonCustomData/SetCommonCustomData.js +8 -1
  33. package/dist/esm/methods/ESPRMAdminNode/ActivateDeactivateNodes.js +12 -2
  34. package/dist/esm/methods/ESPRMAdminNode/CancelCommandRequests.js +25 -0
  35. package/dist/esm/methods/ESPRMAdminNode/DeleteNode.js +22 -0
  36. package/dist/esm/methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.js +23 -0
  37. package/dist/esm/methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.js +22 -0
  38. package/dist/esm/methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.js +19 -0
  39. package/dist/esm/methods/ESPRMClaim/InitiateClaim.js +26 -0
  40. package/dist/esm/methods/ESPRMClaim/VerifyClaim.js +26 -0
  41. package/dist/esm/services/ESPRMAPIManager.js +15 -1
  42. package/dist/esm/utils/constants.js +17 -1
  43. package/dist/esm/utils/error/errorMessages.js +11 -0
  44. package/dist/esm/utils/validator/ConfigValidator.js +9 -0
  45. package/dist/types/ESPRMClaim.d.ts +12 -0
  46. package/dist/types/entries/ESPRMClaim.d.ts +7 -0
  47. package/dist/types/methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.d.ts +22 -0
  48. package/dist/types/methods/ESPRMAdminCommonCustomData/SetCommonCustomData.d.ts +6 -1
  49. package/dist/types/methods/ESPRMAdminCommonCustomData/index.d.ts +1 -0
  50. package/dist/types/methods/ESPRMAdminEventFilter/UpdateEventFilter.d.ts +5 -0
  51. package/dist/types/methods/ESPRMAdminNode/ActivateDeactivateNodes.d.ts +9 -6
  52. package/dist/types/methods/ESPRMAdminNode/CancelCommandRequests.d.ts +22 -0
  53. package/dist/types/methods/ESPRMAdminNode/DeleteNode.d.ts +19 -0
  54. package/dist/types/methods/ESPRMAdminNode/index.d.ts +2 -0
  55. package/dist/types/methods/ESPRMAdminNodeRegistration/GetMQTTHost.d.ts +3 -2
  56. package/dist/types/methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.d.ts +18 -0
  57. package/dist/types/methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.d.ts +17 -0
  58. package/dist/types/methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.d.ts +19 -0
  59. package/dist/types/methods/ESPRMAdminNodeRegistration/RegisterNodeCertificates.d.ts +6 -6
  60. package/dist/types/methods/ESPRMAdminNodeRegistration/index.d.ts +3 -0
  61. package/dist/types/methods/ESPRMAdminWebhook/GetWebhookIntegrations.d.ts +2 -1
  62. package/dist/types/methods/ESPRMClaim/InitiateClaim.d.ts +21 -0
  63. package/dist/types/methods/ESPRMClaim/VerifyClaim.d.ts +21 -0
  64. package/dist/types/methods/ESPRMClaim/index.d.ts +7 -0
  65. package/dist/types/methods/export.d.ts +1 -0
  66. package/dist/types/services/ESPRMAPIManager.d.ts +6 -0
  67. package/dist/types/types/claim.d.ts +45 -0
  68. package/dist/types/types/command_response.d.ts +56 -7
  69. package/dist/types/types/common_custom_data.d.ts +32 -5
  70. package/dist/types/types/config.d.ts +9 -0
  71. package/dist/types/types/event_filter.d.ts +17 -3
  72. package/dist/types/types/index.d.ts +1 -0
  73. package/dist/types/types/input.d.ts +3 -2
  74. package/dist/types/types/mainTypes.d.ts +2 -1
  75. package/dist/types/types/node.d.ts +33 -3
  76. package/dist/types/types/node_registration.d.ts +164 -12
  77. package/dist/types/types/output.d.ts +3 -2
  78. package/dist/types/types/webhook.d.ts +5 -2
  79. package/dist/types/utils/constants.d.ts +17 -1
  80. package/dist/types/utils/error/errorMessages.d.ts +11 -0
  81. package/dist/types/utils/validator/ConfigValidator.d.ts +1 -0
  82. package/dist/types-cjs/ESPRMClaim.d.cts +12 -0
  83. package/dist/types-cjs/entries/ESPRMClaim.d.cts +7 -0
  84. package/dist/types-cjs/methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.d.cts +22 -0
  85. package/dist/types-cjs/methods/ESPRMAdminCommonCustomData/SetCommonCustomData.d.cts +6 -1
  86. package/dist/types-cjs/methods/ESPRMAdminCommonCustomData/index.d.cts +1 -0
  87. package/dist/types-cjs/methods/ESPRMAdminEventFilter/UpdateEventFilter.d.cts +5 -0
  88. package/dist/types-cjs/methods/ESPRMAdminNode/ActivateDeactivateNodes.d.cts +9 -6
  89. package/dist/types-cjs/methods/ESPRMAdminNode/CancelCommandRequests.d.cts +22 -0
  90. package/dist/types-cjs/methods/ESPRMAdminNode/DeleteNode.d.cts +19 -0
  91. package/dist/types-cjs/methods/ESPRMAdminNode/index.d.cts +2 -0
  92. package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/GetMQTTHost.d.cts +3 -2
  93. package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.d.cts +18 -0
  94. package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.d.cts +17 -0
  95. package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.d.cts +19 -0
  96. package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/RegisterNodeCertificates.d.cts +6 -6
  97. package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/index.d.cts +3 -0
  98. package/dist/types-cjs/methods/ESPRMAdminWebhook/GetWebhookIntegrations.d.cts +2 -1
  99. package/dist/types-cjs/methods/ESPRMClaim/InitiateClaim.d.cts +21 -0
  100. package/dist/types-cjs/methods/ESPRMClaim/VerifyClaim.d.cts +21 -0
  101. package/dist/types-cjs/methods/ESPRMClaim/index.d.cts +7 -0
  102. package/dist/types-cjs/methods/export.d.cts +1 -0
  103. package/dist/types-cjs/services/ESPRMAPIManager.d.cts +6 -0
  104. package/dist/types-cjs/types/claim.d.cts +45 -0
  105. package/dist/types-cjs/types/command_response.d.cts +56 -7
  106. package/dist/types-cjs/types/common_custom_data.d.cts +32 -5
  107. package/dist/types-cjs/types/config.d.cts +9 -0
  108. package/dist/types-cjs/types/event_filter.d.cts +17 -3
  109. package/dist/types-cjs/types/index.d.cts +1 -0
  110. package/dist/types-cjs/types/input.d.cts +3 -2
  111. package/dist/types-cjs/types/mainTypes.d.cts +2 -1
  112. package/dist/types-cjs/types/node.d.cts +33 -3
  113. package/dist/types-cjs/types/node_registration.d.cts +164 -12
  114. package/dist/types-cjs/types/output.d.cts +3 -2
  115. package/dist/types-cjs/types/webhook.d.cts +5 -2
  116. package/dist/types-cjs/utils/constants.d.cts +17 -1
  117. package/dist/types-cjs/utils/error/errorMessages.d.cts +11 -0
  118. package/dist/types-cjs/utils/validator/ConfigValidator.d.cts +1 -0
  119. package/package.json +11 -1
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import "../methods/ESPRMClaim/index.js";
7
+ export { ESPRMClaim } from "../ESPRMClaim.js";
@@ -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 { DeleteCommonCustomDataRequest } from "../../types/common_custom_data.js";
7
+ import { ESPAPISuccessResponse } from "../../types/api.js";
8
+ declare module "../../ESPRMAdminCommonCustomData.js" {
9
+ interface ESPRMAdminCommonCustomData {
10
+ /**
11
+ * Deletes a common custom data entry.
12
+ *
13
+ * The backend has no DELETE method for this resource; an entry is deleted
14
+ * by sending `PUT admin/common_custom_data` with `value: null`.
15
+ *
16
+ * @param params - The name of the entry to delete.
17
+ * @returns A success response confirming the entry was deleted.
18
+ * @throws ESPAPICallValidationError when `name` is empty.
19
+ */
20
+ deleteCommonCustomData(params: DeleteCommonCustomDataRequest): Promise<ESPAPISuccessResponse>;
21
+ }
22
+ }
@@ -8,10 +8,15 @@ import { ESPAPISuccessResponse } from "../../types/api.js";
8
8
  declare module "../../ESPRMAdminCommonCustomData.js" {
9
9
  interface ESPRMAdminCommonCustomData {
10
10
  /**
11
- * Sets or updates common custom data shared across users.
11
+ * Adds or updates a common custom data entry shared across users.
12
+ *
13
+ * JSON object values are deep merged into the stored object; other value
14
+ * types replace it. See {@link SetCommonCustomDataRequest}.
12
15
  *
13
16
  * @param params - The common custom data payload to set.
14
17
  * @returns A success response confirming the data was set.
18
+ * @throws ESPAPICallValidationError when `name` is empty, or when `value`
19
+ * is `null` or `undefined` (the backend would delete the entry).
15
20
  */
16
21
  setCommonCustomData(params: SetCommonCustomDataRequest): Promise<ESPAPISuccessResponse>;
17
22
  }
@@ -5,3 +5,4 @@
5
5
  */
6
6
  import "./SetCommonCustomData.js";
7
7
  import "./GetCommonCustomData.js";
8
+ import "./DeleteCommonCustomData.js";
@@ -10,6 +10,11 @@ declare module "../../ESPRMAdminEventFilter.js" {
10
10
  /**
11
11
  * Updates an existing event filter configuration.
12
12
  *
13
+ * `enabled_for_integrations` adds or removes integrations instead of
14
+ * replacing the stored list; see {@link UpdateEventFilterRequest}. Omit it
15
+ * to change only `enabled`. Fails with error code `113109` when the
16
+ * mapping does not exist (this call never creates one).
17
+ *
13
18
  * @param params - The updated event filter properties.
14
19
  * @returns A success response confirming the event filter was updated.
15
20
  */
@@ -3,16 +3,19 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { ActivateDeactivateNodesParams } from "../../types/node.js";
7
- import { ESPAPISuccessResponse } from "../../types/api.js";
6
+ import { ActivateDeactivateNodesParams, ActivateDeactivateNodesResponse } from "../../types/node.js";
8
7
  declare module "../../ESPRMAdminNode.js" {
9
8
  interface ESPRMAdminNode {
10
9
  /**
11
- * Activates or deactivates nodes based on the provided parameters.
10
+ * Activates or deactivates up to 25 nodes in one request. Supported only
11
+ * on private (customer) deployments.
12
12
  *
13
- * @param params - Parameters specifying which nodes to activate or deactivate.
14
- * @returns A success response confirming the operation.
13
+ * The backend returns a single success when every node has the same
14
+ * outcome, and a 207 response with per-node results when they differ.
15
+ *
16
+ * @param params - Node IDs and whether to activate or deactivate them.
17
+ * @returns A success response, or per-node results on mixed outcomes.
15
18
  */
16
- activateDeactivateNodes(params: ActivateDeactivateNodesParams): Promise<ESPAPISuccessResponse>;
19
+ activateDeactivateNodes(params: ActivateDeactivateNodesParams): Promise<ActivateDeactivateNodesResponse>;
17
20
  }
18
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 { CancelCommandRequestsParams, CancelCommandRequestsResponse } from "../../types/command_response.js";
7
+ declare module "../../ESPRMAdminNode.js" {
8
+ interface ESPRMAdminNode {
9
+ /**
10
+ * Cancels pending (`requested` or `in_progress`) command requests created by any user.
11
+ *
12
+ * - `request_id`: cancels that request. The backend rejects the call (131020)
13
+ * when the request is no longer pending.
14
+ * - `node_id`: cancels every pending request for the node, optionally narrowed
15
+ * by `cmd_id`. Returns `total_cancelled: 0` when nothing matches.
16
+ *
17
+ * @param params - The cancel scope.
18
+ * @returns The number of requests that were cancelled.
19
+ */
20
+ cancelCommandRequests(params: CancelCommandRequestsParams): Promise<CancelCommandRequestsResponse>;
21
+ }
22
+ }
@@ -0,0 +1,19 @@
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 "../../ESPRMAdminNode.js" {
8
+ interface ESPRMAdminNode {
9
+ /**
10
+ * Permanently deletes a node: its IoT certificates and thing, its data,
11
+ * and its user and group mappings. Cannot be undone. Supported only on
12
+ * public deployments; the backend accepts one node per request.
13
+ *
14
+ * @param nodeId - The ID of the node to delete.
15
+ * @returns A success response confirming the node was deleted.
16
+ */
17
+ deleteNode(nodeId: string): Promise<ESPAPISuccessResponse>;
18
+ }
19
+ }
@@ -7,8 +7,10 @@ import "./GetNodes.js";
7
7
  import "./ActivateDeactivateNodes.js";
8
8
  import "./AttachNodeTags.js";
9
9
  import "./RemoveNodeTags.js";
10
+ import "./DeleteNode.js";
10
11
  import "./GetNodeTags.js";
11
12
  import "./GetCommandRequests.js";
12
13
  import "./AddCommandRequest.js";
14
+ import "./CancelCommandRequests.js";
13
15
  import "./GetTimeSeriesData.js";
14
16
  import "./GetSimpleTimeSeriesData.js";
@@ -7,9 +7,10 @@ import { GetMQTTHostResponse } from "../../types/node_registration.js";
7
7
  declare module "../../ESPRMAdminNodeRegistration.js" {
8
8
  interface ESPRMAdminNodeRegistration {
9
9
  /**
10
- * Retrieves the default MQTT host endpoint for the deployment.
10
+ * Retrieves the deployment's default node endpoints: the MQTT host, the
11
+ * IoT credential provider host and, when configured, the HTTPS host.
11
12
  *
12
- * @returns The MQTT host information.
13
+ * @returns The node endpoint information.
13
14
  */
14
15
  getMQTTHost(): Promise<GetMQTTHostResponse>;
15
16
  }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { GetNodeCertificateUploadUrlParams, NodeCertificateUploadUrlResponse } from "../../types/node_registration.js";
7
+ declare module "../../ESPRMAdminNodeRegistration.js" {
8
+ interface ESPRMAdminNodeRegistration {
9
+ /**
10
+ * Fetches a pre-signed URL to upload a node certificates CSV, along with
11
+ * the request ID to pass to `registerNodeCertificates`.
12
+ *
13
+ * @param params - Must include the name of the CSV file.
14
+ * @returns The pre-signed upload URL and the registration request ID.
15
+ */
16
+ getNodeCertificateUploadUrl(params: GetNodeCertificateUploadUrlParams): Promise<NodeCertificateUploadUrlResponse>;
17
+ }
18
+ }
@@ -0,0 +1,17 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { NodeRegistrationRequestDetail } from "../../types/node_registration.js";
7
+ declare module "../../ESPRMAdminNodeRegistration.js" {
8
+ interface ESPRMAdminNodeRegistration {
9
+ /**
10
+ * Retrieves the full detail of a node certificate registration request.
11
+ *
12
+ * @param requestId - The ID of the registration request.
13
+ * @returns The registration request detail.
14
+ */
15
+ getNodeRegistrationRequest(requestId: string): Promise<NodeRegistrationRequestDetail>;
16
+ }
17
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { ListNodeRegistrationRequestsParams } from "../../types/node_registration.js";
7
+ import { ListNodeRegistrationRequestsResponse } from "../../types/node_registration.js";
8
+ declare module "../../ESPRMAdminNodeRegistration.js" {
9
+ interface ESPRMAdminNodeRegistration {
10
+ /**
11
+ * Lists the node certificate registration requests of the signed-in
12
+ * admin, newest first.
13
+ *
14
+ * @param params - Optional status filter and pagination.
15
+ * @returns A page of registration requests.
16
+ */
17
+ listNodeRegistrationRequests(params?: ListNodeRegistrationRequestsParams): Promise<ListNodeRegistrationRequestsResponse>;
18
+ }
19
+ }
@@ -3,16 +3,16 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { RegisterNodeCertificatesRequest } from "../../types/node_registration.js";
7
- import { ESPAPISuccessResponse } from "../../types/api.js";
6
+ import { RegisterNodeCertificatesRequest, RegisterNodeCertificatesResponse } from "../../types/node_registration.js";
8
7
  declare module "../../ESPRMAdminNodeRegistration.js" {
9
8
  interface ESPRMAdminNodeRegistration {
10
9
  /**
11
- * Registers node certificates for device authentication.
10
+ * Triggers registration of the node certificates in a CSV that was
11
+ * uploaded to the URL from `getNodeCertificateUploadUrl`.
12
12
  *
13
- * @param params - The certificate data to register.
14
- * @returns A success response upon registration.
13
+ * @param params - The uploaded file details and registration options.
14
+ * @returns The ID of the registration request.
15
15
  */
16
- registerNodeCertificates(params: RegisterNodeCertificatesRequest): Promise<ESPAPISuccessResponse>;
16
+ registerNodeCertificates(params: RegisterNodeCertificatesRequest): Promise<RegisterNodeCertificatesResponse>;
17
17
  }
18
18
  }
@@ -8,5 +8,8 @@ import "./GetNodeIds.js";
8
8
  import "./GetNodeCertificates.js";
9
9
  import "./GetNodeCertificateRegistrationStatus.js";
10
10
  import "./RegisterNodeCertificates.js";
11
+ import "./GetNodeCertificateUploadUrl.js";
11
12
  import "./GetMQTTHost.js";
12
13
  import "./GetCustomMQTTHost.js";
14
+ import "./ListNodeRegistrationRequests.js";
15
+ import "./GetNodeRegistrationRequest.js";
@@ -11,7 +11,8 @@ declare module "../../ESPRMAdminWebhook.js" {
11
11
  * Retrieves the list of configured webhook integrations.
12
12
  *
13
13
  * @param params - Optional filtering parameters for the webhook integrations query.
14
- * @returns The response containing webhook integration details.
14
+ * @returns The response containing webhook integration details in
15
+ * `integration_info_list`, which is `null` when none are configured.
15
16
  */
16
17
  getWebhookIntegrations(params?: GetWebhookIntegrationsParams): Promise<GetWebhookIntegrationsResponse>;
17
18
  }
@@ -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 { InitiateClaimRequest, InitiateClaimResponse } from "../../types/claim.js";
7
+ declare module "../../ESPRMClaim.js" {
8
+ interface ESPRMClaim {
9
+ /**
10
+ * Starts authenticated claiming of a node for the signed in user.
11
+ * The claim expires a few minutes after it is created, so call
12
+ * {@link ESPRMClaim.verifyClaim} promptly.
13
+ *
14
+ * @param params - MAC address and platform of the node.
15
+ * @returns The node ID assigned to the node.
16
+ * @throws ESPConfigError `CLAIMING_NOT_CONFIGURED` without `claimingBaseUrl`.
17
+ * @throws ESPAPICallValidationError when `mac_addr` or `platform` is empty.
18
+ */
19
+ initiateClaim(params: InitiateClaimRequest): Promise<InitiateClaimResponse>;
20
+ }
21
+ }
@@ -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 { VerifyClaimOptions, VerifyClaimRequest, VerifyClaimResponse } from "../../types/claim.js";
7
+ declare module "../../ESPRMClaim.js" {
8
+ interface ESPRMClaim {
9
+ /**
10
+ * Completes a claim started with {@link ESPRMClaim.initiateClaim} by
11
+ * submitting the node's CSR, and returns the signed node certificate.
12
+ *
13
+ * @param params - CSR plus optional node policies and MQTT host request.
14
+ * @param options - Matter and Matter test CA flags.
15
+ * @returns The node certificate, and MQTT hosts when requested.
16
+ * @throws ESPConfigError `CLAIMING_NOT_CONFIGURED` without `claimingBaseUrl`.
17
+ * @throws ESPAPICallValidationError when `csr` is empty.
18
+ */
19
+ verifyClaim(params: VerifyClaimRequest, options?: VerifyClaimOptions): Promise<VerifyClaimResponse>;
20
+ }
21
+ }
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import "./InitiateClaim.js";
7
+ import "./VerifyClaim.js";
@@ -40,6 +40,7 @@ import "./ESPRMAdminMobilePlatform/index.js";
40
40
  import "./ESPRMAdminPublishMessage/index.js";
41
41
  import "./ESPRMAdminPassthrough/index.js";
42
42
  import "./ESPRMAdminNodeCertificateCA/index.js";
43
+ import "./ESPRMClaim/index.js";
43
44
  import "./ESPRMAdminWebhook/index.js";
44
45
  import "./ESPRMAdminStatisticalService/index.js";
45
46
  import "./ESPRMAdminMailFailure/index.js";
@@ -13,6 +13,12 @@ export declare class ESPRMAPIManager {
13
13
  #private;
14
14
  private constructor();
15
15
  static initialize(config: ESPRMAPIManagerConfig): void;
16
+ /**
17
+ * Base URL of the claiming service set through `claimingBaseUrl`.
18
+ *
19
+ * @throws ESPConfigError `CLAIMING_NOT_CONFIGURED` when it was not configured.
20
+ */
21
+ static getClaimingBaseUrl(): string;
16
22
  /**
17
23
  * Send a request with the current user's access token in the
18
24
  * `Authorization` header, refreshing the token first if it has expired.
@@ -0,0 +1,45 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /** Request body for `POST claim/initiate` (authenticated claiming). */
7
+ export interface InitiateClaimRequest {
8
+ /** Node MAC address: 12 uppercase hex characters, no separators, e.g. `7CDFA100033B`. */
9
+ mac_addr: string;
10
+ /** Platform the node is claimed for, e.g. `ESP32` or `ESP32S3`. */
11
+ platform: string;
12
+ }
13
+ /** Response of `POST claim/initiate` for authenticated claiming. */
14
+ export interface InitiateClaimResponse {
15
+ /** Node ID assigned to the claimed node. */
16
+ node_id: string;
17
+ }
18
+ /** Request body for `POST claim/verify` (authenticated claiming). */
19
+ export interface VerifyClaimRequest {
20
+ /** PEM encoded certificate signing request for the node key, with `CN=<node_id>`. */
21
+ csr: string;
22
+ /** When true, the response also carries `mqtt_host` and `mqtt_cred_host`. */
23
+ send_mqtt_host?: boolean;
24
+ /**
25
+ * Comma separated node policies to attach, e.g. `videostream`. The
26
+ * `mqtt` policy is always attached by the backend.
27
+ */
28
+ node_policies?: string;
29
+ }
30
+ /** Query options for `POST claim/verify`. */
31
+ export interface VerifyClaimOptions {
32
+ /** Issue a Matter compliant node certificate. Defaults to false. */
33
+ matter?: boolean;
34
+ /** Use the Matter test CA. Only sent when `matter` is true. */
35
+ test?: boolean;
36
+ }
37
+ /** Response of `POST claim/verify`. */
38
+ export interface VerifyClaimResponse {
39
+ /** PEM encoded node certificate chain. */
40
+ certificate: string;
41
+ /** MQTT endpoint, present when `send_mqtt_host` was true. */
42
+ mqtt_host?: string;
43
+ /** MQTT credentials endpoint, present when `send_mqtt_host` was true. */
44
+ mqtt_cred_host?: string;
45
+ }
@@ -3,6 +3,19 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Lifecycle status of a command request.
8
+ *
9
+ * - `requested`: created, not yet delivered to the node
10
+ * - `in_progress`: delivered to the node, awaiting its response
11
+ * - `success` / `failure`: the node reported the result
12
+ * - `timed_out`: the timeout elapsed before the command completed
13
+ * - `overridden`: replaced by a later request sent with `override: true`
14
+ * - `cancelled`: cancelled through the cancel API
15
+ */
16
+ export type CommandRequestStatus = "requested" | "in_progress" | "success" | "failure" | "timed_out" | "overridden" | "cancelled";
17
+ /** Error marker set when stored request or response data cannot be decoded. */
18
+ export type CommandRequestDataError = "ERROR_DESERIALIZE_JSON";
6
19
  /** Parameters for listing command requests. */
7
20
  export interface GetCommandRequestsParams {
8
21
  /** Filter by specific request ID. */
@@ -10,10 +23,13 @@ export interface GetCommandRequestsParams {
10
23
  /** Filter by node ID. */
11
24
  node_id?: string;
12
25
  /** Filter by request status. */
13
- status?: string;
14
- /** Filter requests created after this timestamp. */
26
+ status?: CommandRequestStatus;
27
+ /**
28
+ * Start of the request time range, in epoch seconds. Must be sent with
29
+ * `end_time`, and requires the `cmd_resp_history` deployment setting.
30
+ */
15
31
  start_time?: number;
16
- /** Filter requests created before this timestamp. */
32
+ /** End of the request time range, in epoch seconds. Must be sent with `start_time`. */
17
33
  end_time?: number;
18
34
  /** Filter by command ID. */
19
35
  cmd_id?: number;
@@ -44,25 +60,37 @@ export interface CommandRequestInfo {
44
60
  /** Unique identifier of the command request. */
45
61
  request_id: string;
46
62
  /** Current status of the request. */
47
- status: string;
63
+ status: CommandRequestStatus;
48
64
  /** Device-reported status code. */
49
65
  device_status?: number;
50
66
  /** Human-readable description of the status. */
51
67
  status_description?: string;
52
68
  /** Data sent in the request. */
53
69
  request_data?: unknown;
70
+ /** Set instead of `request_data` when the stored request data cannot be decoded. */
71
+ request_data_error?: CommandRequestDataError;
54
72
  /** Data received in the response. */
55
73
  response_data?: unknown;
74
+ /** Set instead of `response_data` when the stored response data cannot be decoded. */
75
+ response_data_error?: CommandRequestDataError;
76
+ /** Whether the data is a base64-encoded string rather than JSON. */
77
+ is_base64?: boolean;
56
78
  /** Node ID the command was sent to. */
57
79
  node_id: string;
58
- /** Timestamp when the request was created. */
80
+ /** Timestamp when the request was created, in epoch seconds. */
59
81
  request_timestamp?: number;
60
- /** Timestamp when the response was received. */
82
+ /** Timestamp when the response was received, in epoch seconds. */
61
83
  response_timestamp?: number;
62
- /** Timestamp when the request expires. */
84
+ /** Timestamp when the request expires, in epoch seconds. */
63
85
  expiration_timestamp?: number;
86
+ /** Whether the request never expires (sent with a timeout of -1). */
87
+ indefinite_timeout?: boolean;
64
88
  /** Command identifier. */
65
89
  cmd?: number;
90
+ /** Name of the user who created the request. */
91
+ user_name?: string;
92
+ /** Whether the request was created through the user API rather than by a device. */
93
+ for_user?: boolean;
66
94
  }
67
95
  /** Paginated response containing a list of command requests. */
68
96
  export interface GetCommandRequestsResponse {
@@ -80,3 +108,24 @@ export interface AddCommandRequestResponse {
80
108
  /** Status of the command submission. */
81
109
  status: string;
82
110
  }
111
+ /**
112
+ * Parameters for cancelling pending command requests.
113
+ *
114
+ * Provide `request_id` to cancel one request, or `node_id` to cancel every
115
+ * pending request for a node (optionally narrowed by `cmd_id`).
116
+ */
117
+ export interface CancelCommandRequestsParams {
118
+ /** Cancel this specific request. */
119
+ request_id?: string;
120
+ /** Cancel all pending requests for this node. */
121
+ node_id?: string;
122
+ /** Cancel only requests with this command ID. Requires `node_id`. */
123
+ cmd_id?: number;
124
+ }
125
+ /** Response returned after cancelling command requests. */
126
+ export interface CancelCommandRequestsResponse {
127
+ /** Status of the cancel operation. */
128
+ status: string;
129
+ /** Number of requests that were cancelled. */
130
+ total_cancelled: number;
131
+ }
@@ -3,19 +3,46 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- /** Request body for setting a common custom data entry. */
6
+ /**
7
+ * Request body for adding or updating a common custom data entry.
8
+ *
9
+ * `PUT admin/common_custom_data` is an upsert with merge semantics:
10
+ * - When the stored value and `value` are both JSON objects, they are deep
11
+ * merged. Keys omitted from `value` are kept, and a nested `null` deletes
12
+ * that key.
13
+ * - Arrays, strings, numbers and booleans replace the stored value.
14
+ * - A `null` or missing `value` deletes the whole entry, so `value` must be
15
+ * defined here. Use `deleteCommonCustomData` to delete.
16
+ */
7
17
  export interface SetCommonCustomDataRequest {
8
18
  /** Name of the custom data entry. */
9
19
  name: string;
10
- /** Value to assign to the custom data entry. */
20
+ /** Value to assign to the custom data entry. Must not be `null` or `undefined`. */
11
21
  value: unknown;
12
22
  }
23
+ /** Request for deleting a common custom data entry. */
24
+ export interface DeleteCommonCustomDataRequest {
25
+ /** Name of the custom data entry to delete. */
26
+ name: string;
27
+ }
13
28
  /** Parameters for retrieving common custom data. */
14
29
  export interface GetCommonCustomDataParams {
15
30
  /** Name of the custom data entry to retrieve. */
16
31
  name?: string;
17
32
  }
18
- /** Response containing common custom data as dynamic key-value pairs. */
19
- export interface GetCommonCustomDataResponse {
20
- [key: string]: unknown;
33
+ /** A single common custom data entry. */
34
+ export interface CommonCustomDataItem {
35
+ /** Name of the custom data entry. */
36
+ name: string;
37
+ /** Stored value: a JSON object, array, string, number or boolean. */
38
+ value: unknown;
39
+ /** RBAC permissions attached to the entry, when any were set. */
40
+ perms?: unknown[];
21
41
  }
42
+ /**
43
+ * Response of `GET admin/common_custom_data`.
44
+ *
45
+ * Always an array: every entry when `name` is omitted, or a single-element
46
+ * array when `name` is given.
47
+ */
48
+ export type GetCommonCustomDataResponse = CommonCustomDataItem[];
@@ -21,12 +21,21 @@ export interface ESPRMBaseConfig {
21
21
  * `errorCode` is `REQUEST_TIMEOUT`. Defaults to 30000. Set to `0` to disable.
22
22
  */
23
23
  timeoutMs?: number;
24
+ /**
25
+ * Base URL of the standalone ESP RainMaker claiming service, e.g.
26
+ * `https://esp-claiming.rainmaker.espressif.com`. Required only for
27
+ * `ESPRMClaim`; the service is available on public deployments only.
28
+ * The user's access token is sent to this host, so only set it to a
29
+ * trusted Espressif claiming endpoint.
30
+ */
31
+ claimingBaseUrl?: string;
24
32
  }
25
33
  /** Configuration for the ESPRMAPIManager. */
26
34
  export interface ESPRMAPIManagerConfig {
27
35
  baseUrl: string;
28
36
  version: string;
29
37
  timeoutMs?: number;
38
+ claimingBaseUrl?: string;
30
39
  }
31
40
  /** Configuration for an API request made through ESPRMAPIManager. */
32
41
  export interface ESPRMRequestConfig {
@@ -24,10 +24,24 @@ export interface UpdateEventFilterRequest {
24
24
  entity_id: string;
25
25
  /** Type of entity. */
26
26
  entity_type: string;
27
- /** Whether this filter is enabled. */
27
+ /**
28
+ * Whether this filter is enabled. When `enabled_for_integrations` is
29
+ * omitted or empty, this value is stored as sent. When it is non-empty,
30
+ * the backend derives `enabled` itself (see `enabled_for_integrations`).
31
+ */
28
32
  enabled: boolean;
29
- /** Integration types this filter is enabled for. */
30
- enabled_for_integrations: string[];
33
+ /**
34
+ * Integrations to add or remove. This is **not** a replacement list:
35
+ * - omitted or `[]`: the stored list is kept unchanged.
36
+ * - with `enabled: true`: the listed integrations are added to the stored list.
37
+ * - with `enabled: false`: the listed integrations are removed from the stored list.
38
+ *
39
+ * When a non-empty list is sent, the backend overrides `enabled`: it becomes
40
+ * `false` if the resulting list is empty, otherwise `true`, except that a
41
+ * filter already stored as disabled (with a non-empty list) stays disabled.
42
+ * To set `enabled` explicitly, send a separate update without this field.
43
+ */
44
+ enabled_for_integrations?: string[];
31
45
  }
32
46
  /** Parameters for listing event filters. */
33
47
  export interface GetEventFiltersParams {
@@ -44,6 +44,7 @@ export * from "./mobile_platform.js";
44
44
  export * from "./publish_message.js";
45
45
  export * from "./passthrough.js";
46
46
  export * from "./node_certificate_ca.js";
47
+ export * from "./claim.js";
47
48
  export * from "./webhook.js";
48
49
  export * from "./statistical_service.js";
49
50
  export * from "./mail_failure.js";
@@ -11,7 +11,7 @@ export type { GetAdminNodesParams, ActivateDeactivateNodesParams, GetNodeTagsPar
11
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
- export type { GetCommandRequestsParams, AddCommandRequestBody, } from "./command_response.js";
14
+ export type { GetCommandRequestsParams, AddCommandRequestBody, CancelCommandRequestsParams, CommandRequestStatus, } from "./command_response.js";
15
15
  export type { CreateEventFilterRequest, UpdateEventFilterRequest, GetEventFiltersParams, DeleteEventFilterRequest, } from "./event_filter.js";
16
16
  export type { GetTimeSeriesDataParams, GetSimpleTimeSeriesDataParams, } from "./time_series.js";
17
17
  export type { GetAdminCustomDataParams, SetAdminCustomDataParams, } from "./custom_data.js";
@@ -31,7 +31,7 @@ export type { UploadLicenseFileRequest, GetLicenseFileParams } from "./license.j
31
31
  export type { GenerateNodeIdsRequest, GetNodeIdsParams, GetNodeCertificatesParams, RegisterNodeCertificatesRequest, GetNodeCertificateRegistrationParams, } from "./node_registration.js";
32
32
  export type { ChangeSuperAdminRequest } from "./super_admin.js";
33
33
  export type { ChangeSenderEmailRequest } from "./sender_email.js";
34
- export type { SetCommonCustomDataRequest, GetCommonCustomDataParams, } from "./common_custom_data.js";
34
+ export type { SetCommonCustomDataRequest, DeleteCommonCustomDataRequest, GetCommonCustomDataParams, } from "./common_custom_data.js";
35
35
  export type { GetDeploymentDetailsParams } from "./deployment_details.js";
36
36
  export type { UpdateDeploymentConfigRequest } from "./deployment_setting.js";
37
37
  export type { GetNotificationsParams, UpdateNotificationsRequest, } from "./configuration.js";
@@ -42,6 +42,7 @@ export type { CreateMobilePlatformRequest, UpdateMobilePlatformRequest, DeleteMo
42
42
  export type { PublishMessageQueryParams, PublishMessageRequest, } from "./publish_message.js";
43
43
  export type { CreatePassthroughConfigRequest, UpdatePassthroughConfigRequest, GetPassthroughConfigParams, } from "./passthrough.js";
44
44
  export type { UpdateNodeCACertificateRequest } from "./node_certificate_ca.js";
45
+ export type { InitiateClaimRequest, VerifyClaimRequest, VerifyClaimOptions, } from "./claim.js";
45
46
  export type { CreateWebhookIntegrationRequest, UpdateWebhookIntegrationRequest, GetWebhookIntegrationsParams, DeleteWebhookIntegrationParams, UpdateWebhookEventMappingRequest, GetWebhookEventMappingParams, DeleteWebhookEventMappingParams, } from "./webhook.js";
46
47
  export type { GetStatsInfoParams } from "./statistical_service.js";
47
48
  export type { GetMailFailuresParams } from "./mail_failure.js";