@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.
- package/CHANGELOG.md +209 -0
- package/README.md +2 -1
- package/dist/cjs/ESPRMBase.cjs +1 -0
- package/dist/cjs/ESPRMClaim.cjs +16 -0
- package/dist/cjs/entries/ESPRMAdminCommonCustomData.cjs +1 -0
- package/dist/cjs/entries/ESPRMAdminNode.cjs +2 -0
- package/dist/cjs/entries/ESPRMAdminNodeRegistration.cjs +3 -0
- package/dist/cjs/entries/ESPRMClaim.cjs +14 -0
- package/dist/cjs/index.cjs +11 -0
- package/dist/cjs/methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.cjs +24 -0
- package/dist/cjs/methods/ESPRMAdminCommonCustomData/SetCommonCustomData.cjs +7 -0
- package/dist/cjs/methods/ESPRMAdminNode/ActivateDeactivateNodes.cjs +11 -1
- package/dist/cjs/methods/ESPRMAdminNode/CancelCommandRequests.cjs +27 -0
- package/dist/cjs/methods/ESPRMAdminNode/DeleteNode.cjs +24 -0
- package/dist/cjs/methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.cjs +25 -0
- package/dist/cjs/methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.cjs +24 -0
- package/dist/cjs/methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.cjs +21 -0
- package/dist/cjs/methods/ESPRMClaim/InitiateClaim.cjs +28 -0
- package/dist/cjs/methods/ESPRMClaim/VerifyClaim.cjs +28 -0
- package/dist/cjs/services/ESPRMAPIManager.cjs +15 -1
- package/dist/cjs/utils/constants.cjs +17 -0
- package/dist/cjs/utils/error/errorMessages.cjs +11 -0
- package/dist/cjs/utils/validator/ConfigValidator.cjs +9 -0
- package/dist/esm/ESPRMBase.js +1 -0
- package/dist/esm/ESPRMClaim.js +14 -0
- package/dist/esm/entries/ESPRMAdminCommonCustomData.js +1 -0
- package/dist/esm/entries/ESPRMAdminNode.js +2 -0
- package/dist/esm/entries/ESPRMAdminNodeRegistration.js +3 -0
- package/dist/esm/entries/ESPRMClaim.js +8 -0
- package/dist/esm/index.js +10 -1
- package/dist/esm/methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.js +22 -0
- package/dist/esm/methods/ESPRMAdminCommonCustomData/SetCommonCustomData.js +8 -1
- package/dist/esm/methods/ESPRMAdminNode/ActivateDeactivateNodes.js +12 -2
- package/dist/esm/methods/ESPRMAdminNode/CancelCommandRequests.js +25 -0
- package/dist/esm/methods/ESPRMAdminNode/DeleteNode.js +22 -0
- package/dist/esm/methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.js +23 -0
- package/dist/esm/methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.js +22 -0
- package/dist/esm/methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.js +19 -0
- package/dist/esm/methods/ESPRMClaim/InitiateClaim.js +26 -0
- package/dist/esm/methods/ESPRMClaim/VerifyClaim.js +26 -0
- package/dist/esm/services/ESPRMAPIManager.js +15 -1
- package/dist/esm/utils/constants.js +17 -1
- package/dist/esm/utils/error/errorMessages.js +11 -0
- package/dist/esm/utils/validator/ConfigValidator.js +9 -0
- package/dist/types/ESPRMClaim.d.ts +12 -0
- package/dist/types/entries/ESPRMClaim.d.ts +7 -0
- package/dist/types/methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.d.ts +22 -0
- package/dist/types/methods/ESPRMAdminCommonCustomData/SetCommonCustomData.d.ts +6 -1
- package/dist/types/methods/ESPRMAdminCommonCustomData/index.d.ts +1 -0
- package/dist/types/methods/ESPRMAdminEventFilter/UpdateEventFilter.d.ts +5 -0
- package/dist/types/methods/ESPRMAdminNode/ActivateDeactivateNodes.d.ts +9 -6
- package/dist/types/methods/ESPRMAdminNode/CancelCommandRequests.d.ts +22 -0
- package/dist/types/methods/ESPRMAdminNode/DeleteNode.d.ts +19 -0
- package/dist/types/methods/ESPRMAdminNode/index.d.ts +2 -0
- package/dist/types/methods/ESPRMAdminNodeRegistration/GetMQTTHost.d.ts +3 -2
- package/dist/types/methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.d.ts +18 -0
- package/dist/types/methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.d.ts +17 -0
- package/dist/types/methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.d.ts +19 -0
- package/dist/types/methods/ESPRMAdminNodeRegistration/RegisterNodeCertificates.d.ts +6 -6
- package/dist/types/methods/ESPRMAdminNodeRegistration/index.d.ts +3 -0
- package/dist/types/methods/ESPRMAdminWebhook/GetWebhookIntegrations.d.ts +2 -1
- package/dist/types/methods/ESPRMClaim/InitiateClaim.d.ts +21 -0
- package/dist/types/methods/ESPRMClaim/VerifyClaim.d.ts +21 -0
- package/dist/types/methods/ESPRMClaim/index.d.ts +7 -0
- package/dist/types/methods/export.d.ts +1 -0
- package/dist/types/services/ESPRMAPIManager.d.ts +6 -0
- package/dist/types/types/claim.d.ts +45 -0
- package/dist/types/types/command_response.d.ts +56 -7
- package/dist/types/types/common_custom_data.d.ts +32 -5
- package/dist/types/types/config.d.ts +9 -0
- package/dist/types/types/event_filter.d.ts +17 -3
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/input.d.ts +3 -2
- package/dist/types/types/mainTypes.d.ts +2 -1
- package/dist/types/types/node.d.ts +33 -3
- package/dist/types/types/node_registration.d.ts +164 -12
- package/dist/types/types/output.d.ts +3 -2
- package/dist/types/types/webhook.d.ts +5 -2
- package/dist/types/utils/constants.d.ts +17 -1
- package/dist/types/utils/error/errorMessages.d.ts +11 -0
- package/dist/types/utils/validator/ConfigValidator.d.ts +1 -0
- package/dist/types-cjs/ESPRMClaim.d.cts +12 -0
- package/dist/types-cjs/entries/ESPRMClaim.d.cts +7 -0
- package/dist/types-cjs/methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.d.cts +22 -0
- package/dist/types-cjs/methods/ESPRMAdminCommonCustomData/SetCommonCustomData.d.cts +6 -1
- package/dist/types-cjs/methods/ESPRMAdminCommonCustomData/index.d.cts +1 -0
- package/dist/types-cjs/methods/ESPRMAdminEventFilter/UpdateEventFilter.d.cts +5 -0
- package/dist/types-cjs/methods/ESPRMAdminNode/ActivateDeactivateNodes.d.cts +9 -6
- package/dist/types-cjs/methods/ESPRMAdminNode/CancelCommandRequests.d.cts +22 -0
- package/dist/types-cjs/methods/ESPRMAdminNode/DeleteNode.d.cts +19 -0
- package/dist/types-cjs/methods/ESPRMAdminNode/index.d.cts +2 -0
- package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/GetMQTTHost.d.cts +3 -2
- package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.d.cts +18 -0
- package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.d.cts +17 -0
- package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.d.cts +19 -0
- package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/RegisterNodeCertificates.d.cts +6 -6
- package/dist/types-cjs/methods/ESPRMAdminNodeRegistration/index.d.cts +3 -0
- package/dist/types-cjs/methods/ESPRMAdminWebhook/GetWebhookIntegrations.d.cts +2 -1
- package/dist/types-cjs/methods/ESPRMClaim/InitiateClaim.d.cts +21 -0
- package/dist/types-cjs/methods/ESPRMClaim/VerifyClaim.d.cts +21 -0
- package/dist/types-cjs/methods/ESPRMClaim/index.d.cts +7 -0
- package/dist/types-cjs/methods/export.d.cts +1 -0
- package/dist/types-cjs/services/ESPRMAPIManager.d.cts +6 -0
- package/dist/types-cjs/types/claim.d.cts +45 -0
- package/dist/types-cjs/types/command_response.d.cts +56 -7
- package/dist/types-cjs/types/common_custom_data.d.cts +32 -5
- package/dist/types-cjs/types/config.d.cts +9 -0
- package/dist/types-cjs/types/event_filter.d.cts +17 -3
- package/dist/types-cjs/types/index.d.cts +1 -0
- package/dist/types-cjs/types/input.d.cts +3 -2
- package/dist/types-cjs/types/mainTypes.d.cts +2 -1
- package/dist/types-cjs/types/node.d.cts +33 -3
- package/dist/types-cjs/types/node_registration.d.cts +164 -12
- package/dist/types-cjs/types/output.d.cts +3 -2
- package/dist/types-cjs/types/webhook.d.cts +5 -2
- package/dist/types-cjs/utils/constants.d.cts +17 -1
- package/dist/types-cjs/utils/error/errorMessages.d.cts +11 -0
- package/dist/types-cjs/utils/validator/ConfigValidator.d.cts +1 -0
- package/package.json +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,215 @@
|
|
|
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
|
+
## [1.3.0] - 2026-10-06
|
|
7
|
+
|
|
8
|
+
Minor release that adds node deletion, node claiming through the standalone
|
|
9
|
+
claiming service (new `ESPRMClaim` module) and a delete helper for common
|
|
10
|
+
custom data. It also folds in the fixes prepared for 1.2.1, which was never
|
|
11
|
+
published: corrected webhook integration, event filter and common custom data
|
|
12
|
+
types, and a fix for `activateDeactivateNodes`, which could not have worked
|
|
13
|
+
before.
|
|
14
|
+
|
|
15
|
+
Some request and response types change shape to match the backend. In every
|
|
16
|
+
case the old shape was never accepted or returned by the backend, so no
|
|
17
|
+
working caller breaks at runtime, but code built on the old types will no
|
|
18
|
+
longer type-check.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **Node deletion** (`ESPRMAdminNode`)
|
|
23
|
+
- `deleteNode(nodeId)` → `DELETE admin/nodes?node_id=<id>&delete_node=true`.
|
|
24
|
+
Permanently deletes one node (certificates, IoT thing, data, user and
|
|
25
|
+
group mappings). Public deployments only; the backend rejects it on
|
|
26
|
+
customer deployments with error 105059.
|
|
27
|
+
- `MAX_NODE_ACTIVATION_BATCH_SIZE` constant (25), plus validation error
|
|
28
|
+
codes `MISSING_NODE_IDS` and `TOO_MANY_NODE_IDS`.
|
|
29
|
+
- `ActivateDeactivateNodesResponse`, `NodeActivationMultiStatusResponse`,
|
|
30
|
+
`NodeActivationSuccessResult` and `NodeActivationFailureResult` types.
|
|
31
|
+
|
|
32
|
+
- **Node claiming** (`ESPRMClaim`, new module)
|
|
33
|
+
- `initiateClaim({ mac_addr, platform })` → `POST claim/initiate`, returns
|
|
34
|
+
`{ node_id }`.
|
|
35
|
+
- `verifyClaim({ csr, send_mqtt_host?, node_policies? }, { matter?, test? })`
|
|
36
|
+
→ `POST claim/verify`, returns `{ certificate, mqtt_host?, mqtt_cred_host? }`.
|
|
37
|
+
`test` is only sent when `matter` is true.
|
|
38
|
+
- Both call the standalone claiming service (public deployments only), not
|
|
39
|
+
the RainMaker API. Configure it with the new optional
|
|
40
|
+
`ESPRMBase.configure({ claimingBaseUrl })`; calls without it throw
|
|
41
|
+
`ESPConfigError` `CLAIMING_NOT_CONFIGURED`. An invalid URL throws
|
|
42
|
+
`INVALID_CLAIMING_BASE_URL` at configure time.
|
|
43
|
+
- Validation error codes `MISSING_MAC_ADDRESS`, `MISSING_CLAIM_PLATFORM`
|
|
44
|
+
and `MISSING_CSR`.
|
|
45
|
+
- Only authenticated claiming is supported; the unauthenticated
|
|
46
|
+
challenge/response variant is not exposed.
|
|
47
|
+
- Available from the package root and the new
|
|
48
|
+
`@espressif/rainmaker-admin-sdk/ESPRMClaim` sub-path.
|
|
49
|
+
|
|
50
|
+
- **Common custom data** (`ESPRMAdminCommonCustomData`)
|
|
51
|
+
- `deleteCommonCustomData({ name })`. The backend has no DELETE method for
|
|
52
|
+
this resource; it deletes an entry when `PUT admin/common_custom_data`
|
|
53
|
+
receives `value: null`. Callers no longer need to know that.
|
|
54
|
+
- `CommonCustomDataItem` (`{ name, value, perms? }`) and
|
|
55
|
+
`DeleteCommonCustomDataRequest` types.
|
|
56
|
+
- Validation error codes `MISSING_COMMON_CUSTOM_DATA_NAME` and
|
|
57
|
+
`MISSING_COMMON_CUSTOM_DATA_VALUE`.
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
|
|
61
|
+
- **Node activation** (`ESPRMAdminNode`) — **breaking**
|
|
62
|
+
- `activateDeactivateNodes` sent `node_id` and `activate` as a JSON body,
|
|
63
|
+
but `PUT admin/nodes` reads them from the query string only (the body is
|
|
64
|
+
parsed as tags), so every call failed with error 105018. They are now
|
|
65
|
+
sent as query parameters.
|
|
66
|
+
- `ActivateDeactivateNodesParams` is now `{ node_ids: string[]; activate }`
|
|
67
|
+
(was `{ node_id: string; activate }`), matching the backend's batch
|
|
68
|
+
support of up to 25 comma-separated IDs. The method throws
|
|
69
|
+
`ESPAPICallValidationError` for an empty list or more than 25 IDs.
|
|
70
|
+
The endpoint is supported on private (customer) deployments only.
|
|
71
|
+
- The return type is `ActivateDeactivateNodesResponse`: a single success,
|
|
72
|
+
or a 207 `{ responses }` list with per-node results when outcomes differ.
|
|
73
|
+
Since the old call never succeeded, no working caller breaks at runtime.
|
|
74
|
+
|
|
75
|
+
- **Common custom data** (`ESPRMAdminCommonCustomData`)
|
|
76
|
+
- `GetCommonCustomDataResponse` is now `CommonCustomDataItem[]` instead of
|
|
77
|
+
a `{ [key: string]: unknown }` map. `GET admin/common_custom_data` has
|
|
78
|
+
always returned an array, including a single-element array when `name`
|
|
79
|
+
is given. Code that indexed the old map type will no longer type-check.
|
|
80
|
+
- `setCommonCustomData` now throws `ESPAPICallValidationError` when `name`
|
|
81
|
+
is empty or `value` is `null`/`undefined`. The backend treats a null or
|
|
82
|
+
missing value as a delete, and `JSON.stringify` drops `undefined`, so an
|
|
83
|
+
accidental `undefined` used to wipe the entry.
|
|
84
|
+
- Documented the PUT merge semantics on `SetCommonCustomDataRequest`:
|
|
85
|
+
object values are deep merged (omitted keys are kept, nested `null`
|
|
86
|
+
deletes a key); other value types replace the stored value.
|
|
87
|
+
|
|
88
|
+
- **Webhook integrations** (`ESPRMAdminWebhook`)
|
|
89
|
+
- `GetWebhookIntegrationsResponse` now declares `integration_info_list`
|
|
90
|
+
(`WebhookIntegrationInfo[] | null`) instead of `webhooks_endpoints`.
|
|
91
|
+
`GET admin/webhook_integration` has always returned
|
|
92
|
+
`integration_info_list`, and returns `null` when no integrations are
|
|
93
|
+
configured. The backend never sent `webhooks_endpoints`, so no working
|
|
94
|
+
caller can break at runtime, but code that read that field will no
|
|
95
|
+
longer type-check.
|
|
96
|
+
|
|
97
|
+
- **Event filters** (`ESPRMAdminEventFilter`)
|
|
98
|
+
- `UpdateEventFilterRequest.enabled_for_integrations` is now optional.
|
|
99
|
+
`PUT admin/event_filter` keeps the stored integration list when the
|
|
100
|
+
field is omitted, so callers can change only `enabled`. Existing
|
|
101
|
+
callers that pass the field are unaffected.
|
|
102
|
+
- Documented the update semantics: the list adds (`enabled: true`) or
|
|
103
|
+
removes (`enabled: false`) integrations rather than replacing the
|
|
104
|
+
stored list, and a non-empty list makes the backend derive `enabled`.
|
|
105
|
+
The call fails with error `113109` when the mapping does not exist; it
|
|
106
|
+
never creates one.
|
|
107
|
+
|
|
108
|
+
### Security
|
|
109
|
+
|
|
110
|
+
- `claimingBaseUrl` receives the user's access token on every `ESPRMClaim`
|
|
111
|
+
call. Set it only to a trusted Espressif claiming endpoint.
|
|
112
|
+
|
|
113
|
+
## [1.2.0] - 2026-09-25
|
|
114
|
+
|
|
115
|
+
Minor release that adds typed access to node certificate registration, so
|
|
116
|
+
admin apps can register nodes from a CSV, list registration jobs and inspect
|
|
117
|
+
a single job without hand-rolled HTTP calls. It also completes the node
|
|
118
|
+
endpoint response type.
|
|
119
|
+
|
|
120
|
+
The registration request and status types are corrected to match what the
|
|
121
|
+
backend accepts and returns. The old request shape (`node_ids` / `certs`)
|
|
122
|
+
was never accepted by `admin/node_certificates/register`, so no working
|
|
123
|
+
caller can break at runtime, but code that built that shape will no longer
|
|
124
|
+
type-check.
|
|
125
|
+
|
|
126
|
+
### Added
|
|
127
|
+
|
|
128
|
+
- **CSV node certificate registration** (`ESPRMAdminNodeRegistration`)
|
|
129
|
+
- `getNodeCertificateUploadUrl({ file_name })` wraps
|
|
130
|
+
`GET admin/node_certificates/register?file_name=`. It returns a
|
|
131
|
+
pre-signed S3 PUT URL (valid for 1 hour) and the `request_id` to pass to
|
|
132
|
+
`registerNodeCertificates`. It throws `MISSING_FILE_NAME` when
|
|
133
|
+
`file_name` is empty.
|
|
134
|
+
- New types: `GetNodeCertificateUploadUrlParams`,
|
|
135
|
+
`NodeCertificateUploadUrlResponse` and
|
|
136
|
+
`RegisterNodeCertificatesResponse`.
|
|
137
|
+
- **Node registration requests** (`ESPRMAdminNodeRegistration`)
|
|
138
|
+
- `listNodeRegistrationRequests(params?)` wraps
|
|
139
|
+
`GET admin/node_registrations/requests`. It accepts an optional `status`
|
|
140
|
+
filter plus `num_records` / `start_id` pagination and returns the
|
|
141
|
+
requests newest first, with `next_id` while more pages exist. The
|
|
142
|
+
backend caps `num_records` at 25.
|
|
143
|
+
- `getNodeRegistrationRequest(requestId)` wraps
|
|
144
|
+
`GET admin/node_registrations/requests/{request_id}` and returns the full
|
|
145
|
+
request detail: registration parameters, failure context and a
|
|
146
|
+
pre-signed CSV download URL that is valid for 1 hour. It throws
|
|
147
|
+
`MISSING_REQUEST_ID` when `requestId` is empty.
|
|
148
|
+
- New types: `NodeRegistrationRequestStatus`,
|
|
149
|
+
`ListNodeRegistrationRequestsParams`, `NodeRegistrationRequest`,
|
|
150
|
+
`ListNodeRegistrationRequestsResponse` and
|
|
151
|
+
`NodeRegistrationRequestDetail`.
|
|
152
|
+
- **Command request cancellation** (`ESPRMAdminNode`)
|
|
153
|
+
- `cancelCommandRequests(params)` wraps `DELETE admin/nodes/cmd`. Pass
|
|
154
|
+
`request_id` to cancel one request, or `node_id` (optionally with
|
|
155
|
+
`cmd_id`) to cancel every pending request for a node. Only `requested`
|
|
156
|
+
and `in_progress` requests can be cancelled. It throws
|
|
157
|
+
`MISSING_CANCEL_COMMAND_SCOPE` when neither `request_id` nor `node_id`
|
|
158
|
+
is given, and `CMD_ID_REQUIRES_NODE_ID` when `cmd_id` is sent without
|
|
159
|
+
`node_id`.
|
|
160
|
+
- New types: `CancelCommandRequestsParams`,
|
|
161
|
+
`CancelCommandRequestsResponse`, `CommandRequestStatus` and
|
|
162
|
+
`CommandRequestDataError`.
|
|
163
|
+
- **Errors**
|
|
164
|
+
- Added the `MISSING_CANCEL_COMMAND_SCOPE` and `CMD_ID_REQUIRES_NODE_ID`
|
|
165
|
+
API-call validation codes.
|
|
166
|
+
|
|
167
|
+
### Changed
|
|
168
|
+
|
|
169
|
+
- **Command requests** (`ESPRMAdminNode`)
|
|
170
|
+
- `CommandRequestInfo.status` and `GetCommandRequestsParams.status` are
|
|
171
|
+
now typed as `CommandRequestStatus` (`requested`, `in_progress`,
|
|
172
|
+
`success`, `failure`, `timed_out`, `overridden`, `cancelled`). Code that
|
|
173
|
+
passed an arbitrary string will no longer type-check; the backend never
|
|
174
|
+
returned any other value.
|
|
175
|
+
- `CommandRequestInfo` now declares the fields the backend already
|
|
176
|
+
returned: `user_name`, `is_base64`, `request_data_error`,
|
|
177
|
+
`response_data_error`, `indefinite_timeout` and `for_user`. Timestamp
|
|
178
|
+
fields are documented as epoch seconds.
|
|
179
|
+
- `GetCommandRequestsParams.start_time` / `end_time` are documented as
|
|
180
|
+
epoch seconds that must be sent together; the backend only honours a
|
|
181
|
+
time range when the `cmd_resp_history` deployment setting is enabled.
|
|
182
|
+
- **CSV node certificate registration** (`ESPRMAdminNodeRegistration`)
|
|
183
|
+
- `RegisterNodeCertificatesRequest` now describes the real request body:
|
|
184
|
+
`file_name`, `file_md5`, `request_id` and `refresh_token` are required
|
|
185
|
+
(the backend rejects the call without them), and `type`, `model`,
|
|
186
|
+
`subtype`, `group_name`, `parent_group_id`, `parent_group_name`, `tags`,
|
|
187
|
+
`force`, `update_nodes`, `node_policies` and `tenant_id` are optional.
|
|
188
|
+
The previous `node_ids` / `certs` shape and its index signature are
|
|
189
|
+
removed.
|
|
190
|
+
- `registerNodeCertificates` now resolves to
|
|
191
|
+
`RegisterNodeCertificatesResponse`, which includes the `request_id`.
|
|
192
|
+
- `NodeCertificateRegistrationStatusResponse` now declares the fields the
|
|
193
|
+
backend returns (`completed_count`, `total_count`, `description`,
|
|
194
|
+
`failed_registration`, `group_name`, `group_id`) and types `status` as
|
|
195
|
+
`NodeRegistrationRequestStatus`. The undocumented `request_id` field and
|
|
196
|
+
the index signature are removed; the backend never returned them.
|
|
197
|
+
- **Node endpoints**
|
|
198
|
+
- `GetMQTTHostResponse` now declares `mqtt_cred_host` (the AWS IoT
|
|
199
|
+
credential provider endpoint) and `https_host`, which
|
|
200
|
+
`admin/mqtt_host` already returned. Callers that read them through the
|
|
201
|
+
index signature keep working.
|
|
202
|
+
|
|
203
|
+
### Notes
|
|
204
|
+
|
|
205
|
+
- CSV registration is a three-step flow: call
|
|
206
|
+
`getNodeCertificateUploadUrl()`, `PUT` the CSV to the returned URL
|
|
207
|
+
**without** an `Authorization` header, then call
|
|
208
|
+
`registerNodeCertificates()` with the same `request_id` and the file's hex
|
|
209
|
+
MD5. Track progress with `getNodeCertificateRegistrationStatus()` or
|
|
210
|
+
`getNodeRegistrationRequest()`.
|
|
211
|
+
- `getNodeCertificateRegistrationStatus()` checks the batch job and reports
|
|
212
|
+
`failure` when the job died while the request was still `requested`;
|
|
213
|
+
`getNodeRegistrationRequest()` returns the stored status as-is.
|
|
214
|
+
|
|
6
215
|
## [1.1.1] - 2026-09-23
|
|
7
216
|
|
|
8
217
|
Patch release for the simple time series data endpoint. The time range
|
package/README.md
CHANGED
|
@@ -121,9 +121,10 @@ const adminNode = new ESPRMAdminNode();
|
|
|
121
121
|
|
|
122
122
|
const nodes = await adminNode.getNodes({ num_records: "50" });
|
|
123
123
|
await adminNode.activateDeactivateNodes({
|
|
124
|
-
|
|
124
|
+
node_ids: ["<NODE_ID_1>", "<NODE_ID_2>"], // up to 25 per call
|
|
125
125
|
activate: true,
|
|
126
126
|
});
|
|
127
|
+
await adminNode.deleteNode("<NODE_ID>"); // public deployments only
|
|
127
128
|
```
|
|
128
129
|
|
|
129
130
|
### OTA
|
package/dist/cjs/ESPRMBase.cjs
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Shell class for the standalone ESP RainMaker claiming service.
|
|
10
|
+
* Requires `claimingBaseUrl` in {@link ESPRMBase.configure}.
|
|
11
|
+
* Methods are added via prototype augmentation in methods/ESPRMClaim/*.
|
|
12
|
+
*/
|
|
13
|
+
class ESPRMClaim {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.ESPRMClaim = ESPRMClaim;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
require('../methods/ESPRMAdminCommonCustomData/SetCommonCustomData.cjs');
|
|
9
9
|
require('../methods/ESPRMAdminCommonCustomData/GetCommonCustomData.cjs');
|
|
10
|
+
require('../methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.cjs');
|
|
10
11
|
var ESPRMAdminCommonCustomData = require('../ESPRMAdminCommonCustomData.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
@@ -9,9 +9,11 @@ require('../methods/ESPRMAdminNode/GetNodes.cjs');
|
|
|
9
9
|
require('../methods/ESPRMAdminNode/ActivateDeactivateNodes.cjs');
|
|
10
10
|
require('../methods/ESPRMAdminNode/AttachNodeTags.cjs');
|
|
11
11
|
require('../methods/ESPRMAdminNode/RemoveNodeTags.cjs');
|
|
12
|
+
require('../methods/ESPRMAdminNode/DeleteNode.cjs');
|
|
12
13
|
require('../methods/ESPRMAdminNode/GetNodeTags.cjs');
|
|
13
14
|
require('../methods/ESPRMAdminNode/GetCommandRequests.cjs');
|
|
14
15
|
require('../methods/ESPRMAdminNode/AddCommandRequest.cjs');
|
|
16
|
+
require('../methods/ESPRMAdminNode/CancelCommandRequests.cjs');
|
|
15
17
|
require('../methods/ESPRMAdminNode/GetTimeSeriesData.cjs');
|
|
16
18
|
require('../methods/ESPRMAdminNode/GetSimpleTimeSeriesData.cjs');
|
|
17
19
|
var ESPRMAdminNode = require('../ESPRMAdminNode.cjs');
|
|
@@ -10,8 +10,11 @@ require('../methods/ESPRMAdminNodeRegistration/GetNodeIds.cjs');
|
|
|
10
10
|
require('../methods/ESPRMAdminNodeRegistration/GetNodeCertificates.cjs');
|
|
11
11
|
require('../methods/ESPRMAdminNodeRegistration/GetNodeCertificateRegistrationStatus.cjs');
|
|
12
12
|
require('../methods/ESPRMAdminNodeRegistration/RegisterNodeCertificates.cjs');
|
|
13
|
+
require('../methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.cjs');
|
|
13
14
|
require('../methods/ESPRMAdminNodeRegistration/GetMQTTHost.cjs');
|
|
14
15
|
require('../methods/ESPRMAdminNodeRegistration/GetCustomMQTTHost.cjs');
|
|
16
|
+
require('../methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.cjs');
|
|
17
|
+
require('../methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.cjs');
|
|
15
18
|
var ESPRMAdminNodeRegistration = require('../ESPRMAdminNodeRegistration.cjs');
|
|
16
19
|
|
|
17
20
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
require('../methods/ESPRMClaim/InitiateClaim.cjs');
|
|
9
|
+
require('../methods/ESPRMClaim/VerifyClaim.cjs');
|
|
10
|
+
var ESPRMClaim = require('../ESPRMClaim.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.ESPRMClaim = ESPRMClaim.ESPRMClaim;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ var ESPRMAdminAPIStatistics = require('./ESPRMAdminAPIStatistics.cjs');
|
|
|
56
56
|
var ESPRMAdminMQTTStatistics = require('./ESPRMAdminMQTTStatistics.cjs');
|
|
57
57
|
var ESPRMAdminMatter = require('./ESPRMAdminMatter.cjs');
|
|
58
58
|
var ESPRMAdminNodeParams = require('./ESPRMAdminNodeParams.cjs');
|
|
59
|
+
var ESPRMClaim = require('./ESPRMClaim.cjs');
|
|
59
60
|
require('./methods/ESPRMAuth/Login.cjs');
|
|
60
61
|
require('./methods/ESPRMAuth/Logout.cjs');
|
|
61
62
|
require('./methods/ESPRMAuth/ForgotPassword.cjs');
|
|
@@ -77,9 +78,11 @@ require('./methods/ESPRMAdminNode/GetNodes.cjs');
|
|
|
77
78
|
require('./methods/ESPRMAdminNode/ActivateDeactivateNodes.cjs');
|
|
78
79
|
require('./methods/ESPRMAdminNode/AttachNodeTags.cjs');
|
|
79
80
|
require('./methods/ESPRMAdminNode/RemoveNodeTags.cjs');
|
|
81
|
+
require('./methods/ESPRMAdminNode/DeleteNode.cjs');
|
|
80
82
|
require('./methods/ESPRMAdminNode/GetNodeTags.cjs');
|
|
81
83
|
require('./methods/ESPRMAdminNode/GetCommandRequests.cjs');
|
|
82
84
|
require('./methods/ESPRMAdminNode/AddCommandRequest.cjs');
|
|
85
|
+
require('./methods/ESPRMAdminNode/CancelCommandRequests.cjs');
|
|
83
86
|
require('./methods/ESPRMAdminNode/GetTimeSeriesData.cjs');
|
|
84
87
|
require('./methods/ESPRMAdminNode/GetSimpleTimeSeriesData.cjs');
|
|
85
88
|
require('./methods/ESPRMAdminOTAImage/UploadImage.cjs');
|
|
@@ -160,12 +163,16 @@ require('./methods/ESPRMAdminNodeRegistration/GetNodeIds.cjs');
|
|
|
160
163
|
require('./methods/ESPRMAdminNodeRegistration/GetNodeCertificates.cjs');
|
|
161
164
|
require('./methods/ESPRMAdminNodeRegistration/GetNodeCertificateRegistrationStatus.cjs');
|
|
162
165
|
require('./methods/ESPRMAdminNodeRegistration/RegisterNodeCertificates.cjs');
|
|
166
|
+
require('./methods/ESPRMAdminNodeRegistration/GetNodeCertificateUploadUrl.cjs');
|
|
163
167
|
require('./methods/ESPRMAdminNodeRegistration/GetMQTTHost.cjs');
|
|
164
168
|
require('./methods/ESPRMAdminNodeRegistration/GetCustomMQTTHost.cjs');
|
|
169
|
+
require('./methods/ESPRMAdminNodeRegistration/ListNodeRegistrationRequests.cjs');
|
|
170
|
+
require('./methods/ESPRMAdminNodeRegistration/GetNodeRegistrationRequest.cjs');
|
|
165
171
|
require('./methods/ESPRMAdminSuperAdmin/ChangeSuperAdmin.cjs');
|
|
166
172
|
require('./methods/ESPRMAdminSenderEmail/ChangeSenderEmail.cjs');
|
|
167
173
|
require('./methods/ESPRMAdminCommonCustomData/SetCommonCustomData.cjs');
|
|
168
174
|
require('./methods/ESPRMAdminCommonCustomData/GetCommonCustomData.cjs');
|
|
175
|
+
require('./methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.cjs');
|
|
169
176
|
require('./methods/ESPRMAdminDeploymentSetting/GetDeploymentSettings.cjs');
|
|
170
177
|
require('./methods/ESPRMAdminDeploymentSetting/UpdateDeploymentConfig.cjs');
|
|
171
178
|
require('./methods/ESPRMAdminConfiguration/GetNotifications.cjs');
|
|
@@ -188,6 +195,8 @@ require('./methods/ESPRMAdminPassthrough/CreatePassthroughConfig.cjs');
|
|
|
188
195
|
require('./methods/ESPRMAdminPassthrough/UpdatePassthroughConfig.cjs');
|
|
189
196
|
require('./methods/ESPRMAdminNodeCertificateCA/UpdateNodeCACertificate.cjs');
|
|
190
197
|
require('./methods/ESPRMAdminNodeCertificateCA/GetNodeCACertificate.cjs');
|
|
198
|
+
require('./methods/ESPRMClaim/InitiateClaim.cjs');
|
|
199
|
+
require('./methods/ESPRMClaim/VerifyClaim.cjs');
|
|
191
200
|
require('./methods/ESPRMAdminWebhook/CreateWebhookIntegration.cjs');
|
|
192
201
|
require('./methods/ESPRMAdminWebhook/UpdateWebhookIntegration.cjs');
|
|
193
202
|
require('./methods/ESPRMAdminWebhook/GetWebhookIntegrations.cjs');
|
|
@@ -279,6 +288,7 @@ exports.ESPRMAdminAPIStatistics = ESPRMAdminAPIStatistics.ESPRMAdminAPIStatistic
|
|
|
279
288
|
exports.ESPRMAdminMQTTStatistics = ESPRMAdminMQTTStatistics.ESPRMAdminMQTTStatistics;
|
|
280
289
|
exports.ESPRMAdminMatter = ESPRMAdminMatter.ESPRMAdminMatter;
|
|
281
290
|
exports.ESPRMAdminNodeParams = ESPRMAdminNodeParams.ESPRMAdminNodeParams;
|
|
291
|
+
exports.ESPRMClaim = ESPRMClaim.ESPRMClaim;
|
|
282
292
|
exports.APICallValidationErrorCodes = constants.APICallValidationErrorCodes;
|
|
283
293
|
exports.APIEndpoints = constants.APIEndpoints;
|
|
284
294
|
exports.APIErrorCodes = constants.APIErrorCodes;
|
|
@@ -289,6 +299,7 @@ exports.DEFAULT_REST_API_VERSION = constants.DEFAULT_REST_API_VERSION;
|
|
|
289
299
|
exports.ErrorLabels = constants.ErrorLabels;
|
|
290
300
|
exports.HTTPMethods = constants.HTTPMethods;
|
|
291
301
|
exports.HTTPStatusCodes = constants.HTTPStatusCodes;
|
|
302
|
+
exports.MAX_NODE_ACTIVATION_BATCH_SIZE = constants.MAX_NODE_ACTIVATION_BATCH_SIZE;
|
|
292
303
|
exports.StorageAdapterErrorCodes = constants.StorageAdapterErrorCodes;
|
|
293
304
|
exports.StorageKeys = constants.StorageKeys;
|
|
294
305
|
exports.TOKEN_EXPIRY_MARGIN_SECONDS = constants.TOKEN_EXPIRY_MARGIN_SECONDS;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ESPRMAdminCommonCustomData = require('../../ESPRMAdminCommonCustomData.cjs');
|
|
9
|
+
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
|
+
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
12
|
+
|
|
13
|
+
ESPRMAdminCommonCustomData.ESPRMAdminCommonCustomData.prototype.deleteCommonCustomData = async function (params) {
|
|
14
|
+
if (!params.name) {
|
|
15
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_COMMON_CUSTOM_DATA_NAME);
|
|
16
|
+
}
|
|
17
|
+
const requestConfig = {
|
|
18
|
+
url: constants.APIEndpoints.ADMIN_COMMON_CUSTOM_DATA,
|
|
19
|
+
method: constants.HTTPMethods.PUT,
|
|
20
|
+
data: { name: params.name, value: null },
|
|
21
|
+
};
|
|
22
|
+
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
23
|
+
return response;
|
|
24
|
+
};
|
|
@@ -8,8 +8,15 @@
|
|
|
8
8
|
var ESPRMAdminCommonCustomData = require('../../ESPRMAdminCommonCustomData.cjs');
|
|
9
9
|
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
10
|
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
11
12
|
|
|
12
13
|
ESPRMAdminCommonCustomData.ESPRMAdminCommonCustomData.prototype.setCommonCustomData = async function (params) {
|
|
14
|
+
if (!params.name) {
|
|
15
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_COMMON_CUSTOM_DATA_NAME);
|
|
16
|
+
}
|
|
17
|
+
if (params.value === null || params.value === undefined) {
|
|
18
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_COMMON_CUSTOM_DATA_VALUE);
|
|
19
|
+
}
|
|
13
20
|
const requestConfig = {
|
|
14
21
|
url: constants.APIEndpoints.ADMIN_COMMON_CUSTOM_DATA,
|
|
15
22
|
method: constants.HTTPMethods.PUT,
|
|
@@ -8,12 +8,22 @@
|
|
|
8
8
|
var ESPRMAdminNode = require('../../ESPRMAdminNode.cjs');
|
|
9
9
|
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
10
|
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
11
12
|
|
|
12
13
|
ESPRMAdminNode.ESPRMAdminNode.prototype.activateDeactivateNodes = async function (params) {
|
|
14
|
+
const nodeIds = params.node_ids?.filter(Boolean) ?? [];
|
|
15
|
+
if (nodeIds.length === 0) {
|
|
16
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_NODE_IDS);
|
|
17
|
+
}
|
|
18
|
+
if (nodeIds.length > constants.MAX_NODE_ACTIVATION_BATCH_SIZE) {
|
|
19
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.TOO_MANY_NODE_IDS);
|
|
20
|
+
}
|
|
21
|
+
// The backend reads both values from the query string only; a JSON body
|
|
22
|
+
// on this endpoint is parsed as node tags.
|
|
13
23
|
const requestConfig = {
|
|
14
24
|
url: constants.APIEndpoints.ADMIN_NODES,
|
|
15
25
|
method: constants.HTTPMethods.PUT,
|
|
16
|
-
|
|
26
|
+
params: { node_id: nodeIds.join(","), activate: params.activate },
|
|
17
27
|
};
|
|
18
28
|
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
19
29
|
return response;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ESPRMAdminNode = require('../../ESPRMAdminNode.cjs');
|
|
9
|
+
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
|
+
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
12
|
+
|
|
13
|
+
ESPRMAdminNode.ESPRMAdminNode.prototype.cancelCommandRequests = async function (params) {
|
|
14
|
+
if (!params?.request_id && !params?.node_id) {
|
|
15
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_CANCEL_COMMAND_SCOPE);
|
|
16
|
+
}
|
|
17
|
+
if (params.cmd_id !== undefined && !params.node_id) {
|
|
18
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.CMD_ID_REQUIRES_NODE_ID);
|
|
19
|
+
}
|
|
20
|
+
const requestConfig = {
|
|
21
|
+
url: constants.APIEndpoints.ADMIN_CMD,
|
|
22
|
+
method: constants.HTTPMethods.DELETE,
|
|
23
|
+
params,
|
|
24
|
+
};
|
|
25
|
+
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
26
|
+
return response;
|
|
27
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ESPRMAdminNode = require('../../ESPRMAdminNode.cjs');
|
|
9
|
+
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
|
+
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
12
|
+
|
|
13
|
+
ESPRMAdminNode.ESPRMAdminNode.prototype.deleteNode = async function (nodeId) {
|
|
14
|
+
if (!nodeId) {
|
|
15
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_NODE_ID);
|
|
16
|
+
}
|
|
17
|
+
const requestConfig = {
|
|
18
|
+
url: constants.APIEndpoints.ADMIN_NODES,
|
|
19
|
+
method: constants.HTTPMethods.DELETE,
|
|
20
|
+
params: { node_id: nodeId, delete_node: true },
|
|
21
|
+
};
|
|
22
|
+
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
23
|
+
return response;
|
|
24
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ESPRMAdminNodeRegistration = require('../../ESPRMAdminNodeRegistration.cjs');
|
|
9
|
+
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
|
+
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
12
|
+
|
|
13
|
+
ESPRMAdminNodeRegistration.ESPRMAdminNodeRegistration.prototype.getNodeCertificateUploadUrl =
|
|
14
|
+
async function (params) {
|
|
15
|
+
if (!params.file_name) {
|
|
16
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_FILE_NAME);
|
|
17
|
+
}
|
|
18
|
+
const requestConfig = {
|
|
19
|
+
url: constants.APIEndpoints.ADMIN_NODE_CERTIFICATES_REGISTER,
|
|
20
|
+
method: constants.HTTPMethods.GET,
|
|
21
|
+
params: { file_name: params.file_name },
|
|
22
|
+
};
|
|
23
|
+
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
24
|
+
return response;
|
|
25
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ESPRMAdminNodeRegistration = require('../../ESPRMAdminNodeRegistration.cjs');
|
|
9
|
+
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
|
+
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
12
|
+
|
|
13
|
+
ESPRMAdminNodeRegistration.ESPRMAdminNodeRegistration.prototype.getNodeRegistrationRequest =
|
|
14
|
+
async function (requestId) {
|
|
15
|
+
if (!requestId) {
|
|
16
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_REQUEST_ID);
|
|
17
|
+
}
|
|
18
|
+
const requestConfig = {
|
|
19
|
+
url: `${constants.APIEndpoints.ADMIN_NODE_REGISTRATION_REQUESTS}/${encodeURIComponent(requestId)}`,
|
|
20
|
+
method: constants.HTTPMethods.GET,
|
|
21
|
+
};
|
|
22
|
+
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
23
|
+
return response;
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ESPRMAdminNodeRegistration = require('../../ESPRMAdminNodeRegistration.cjs');
|
|
9
|
+
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
|
+
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
|
|
12
|
+
ESPRMAdminNodeRegistration.ESPRMAdminNodeRegistration.prototype.listNodeRegistrationRequests =
|
|
13
|
+
async function (params) {
|
|
14
|
+
const requestConfig = {
|
|
15
|
+
url: constants.APIEndpoints.ADMIN_NODE_REGISTRATION_REQUESTS,
|
|
16
|
+
method: constants.HTTPMethods.GET,
|
|
17
|
+
...(params && { params }),
|
|
18
|
+
};
|
|
19
|
+
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
20
|
+
return response;
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ESPRMClaim = require('../../ESPRMClaim.cjs');
|
|
9
|
+
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
|
+
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
12
|
+
|
|
13
|
+
ESPRMClaim.ESPRMClaim.prototype.initiateClaim = async function (params) {
|
|
14
|
+
if (!params.mac_addr) {
|
|
15
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_MAC_ADDRESS);
|
|
16
|
+
}
|
|
17
|
+
if (!params.platform) {
|
|
18
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_CLAIM_PLATFORM);
|
|
19
|
+
}
|
|
20
|
+
const requestConfig = {
|
|
21
|
+
baseURL: ESPRMAPIManager.ESPRMAPIManager.getClaimingBaseUrl(),
|
|
22
|
+
url: constants.APIEndpoints.CLAIM_INITIATE,
|
|
23
|
+
method: constants.HTTPMethods.POST,
|
|
24
|
+
data: params,
|
|
25
|
+
};
|
|
26
|
+
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
27
|
+
return response;
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ESPRMClaim = require('../../ESPRMClaim.cjs');
|
|
9
|
+
var ESPRMAPIManager = require('../../services/ESPRMAPIManager.cjs');
|
|
10
|
+
var constants = require('../../utils/constants.cjs');
|
|
11
|
+
var ESPAPICallValidationError = require('../../utils/error/ESPAPICallValidationError.cjs');
|
|
12
|
+
|
|
13
|
+
ESPRMClaim.ESPRMClaim.prototype.verifyClaim = async function (params, options = {}) {
|
|
14
|
+
if (!params.csr) {
|
|
15
|
+
throw new ESPAPICallValidationError.ESPAPICallValidationError(constants.APICallValidationErrorCodes.MISSING_CSR);
|
|
16
|
+
}
|
|
17
|
+
const matter = options.matter ?? false;
|
|
18
|
+
const requestConfig = {
|
|
19
|
+
baseURL: ESPRMAPIManager.ESPRMAPIManager.getClaimingBaseUrl(),
|
|
20
|
+
url: constants.APIEndpoints.CLAIM_VERIFY,
|
|
21
|
+
method: constants.HTTPMethods.POST,
|
|
22
|
+
data: params,
|
|
23
|
+
// The service ignores `test` unless `matter` is true.
|
|
24
|
+
params: matter ? { matter, test: options.test ?? false } : { matter },
|
|
25
|
+
};
|
|
26
|
+
const response = await ESPRMAPIManager.ESPRMAPIManager.authorizeRequest(requestConfig);
|
|
27
|
+
return response;
|
|
28
|
+
};
|
|
@@ -21,10 +21,12 @@ class ESPRMAPIManager {
|
|
|
21
21
|
static #instance;
|
|
22
22
|
#baseUrl;
|
|
23
23
|
#timeoutMs;
|
|
24
|
+
#claimingBaseUrl;
|
|
24
25
|
constructor(config) {
|
|
25
|
-
const { baseUrl, version, timeoutMs } = config;
|
|
26
|
+
const { baseUrl, version, timeoutMs, claimingBaseUrl } = config;
|
|
26
27
|
this.#baseUrl = `${baseUrl}/${version}`;
|
|
27
28
|
this.#timeoutMs = timeoutMs ?? constants.DEFAULT_REQUEST_TIMEOUT_MS;
|
|
29
|
+
this.#claimingBaseUrl = claimingBaseUrl?.replace(/\/+$/, "");
|
|
28
30
|
}
|
|
29
31
|
static initialize(config) {
|
|
30
32
|
ESPRMAPIManager.#instance = new ESPRMAPIManager(config);
|
|
@@ -35,6 +37,18 @@ class ESPRMAPIManager {
|
|
|
35
37
|
}
|
|
36
38
|
return ESPRMAPIManager.#instance;
|
|
37
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Base URL of the claiming service set through `claimingBaseUrl`.
|
|
42
|
+
*
|
|
43
|
+
* @throws ESPConfigError `CLAIMING_NOT_CONFIGURED` when it was not configured.
|
|
44
|
+
*/
|
|
45
|
+
static getClaimingBaseUrl() {
|
|
46
|
+
const claimingBaseUrl = ESPRMAPIManager.#getInstance().#claimingBaseUrl;
|
|
47
|
+
if (!claimingBaseUrl) {
|
|
48
|
+
throw new ESPConfigError.ESPConfigError(constants.ConfigErrorCodes.CLAIMING_NOT_CONFIGURED);
|
|
49
|
+
}
|
|
50
|
+
return claimingBaseUrl;
|
|
51
|
+
}
|
|
38
52
|
/**
|
|
39
53
|
* Send a request with the current user's access token in the
|
|
40
54
|
* `Authorization` header, refreshing the token first if it has expired.
|