@espressif/rainmaker-admin-sdk 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +133 -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 +1 -0
- package/dist/cjs/entries/ESPRMClaim.cjs +14 -0
- package/dist/cjs/index.cjs +7 -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/DeleteNode.cjs +24 -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 +14 -0
- package/dist/cjs/utils/error/errorMessages.cjs +9 -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 +1 -0
- package/dist/esm/entries/ESPRMClaim.js +8 -0
- package/dist/esm/index.js +6 -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/DeleteNode.js +22 -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 +14 -1
- package/dist/esm/utils/error/errorMessages.js +9 -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/DeleteNode.d.ts +19 -0
- package/dist/types/methods/ESPRMAdminNode/index.d.ts +1 -0
- package/dist/types/methods/ESPRMAdminOTAJob/GetJob.d.ts +12 -3
- 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/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/ota.d.ts +42 -8
- package/dist/types/types/output.d.ts +2 -1
- package/dist/types/types/webhook.d.ts +5 -2
- package/dist/types/utils/constants.d.ts +14 -1
- package/dist/types/utils/error/errorMessages.d.ts +9 -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/DeleteNode.d.cts +19 -0
- package/dist/types-cjs/methods/ESPRMAdminNode/index.d.cts +1 -0
- package/dist/types-cjs/methods/ESPRMAdminOTAJob/GetJob.d.cts +12 -3
- 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/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/ota.d.cts +42 -8
- package/dist/types-cjs/types/output.d.cts +2 -1
- package/dist/types-cjs/types/webhook.d.cts +5 -2
- package/dist/types-cjs/utils/constants.d.cts +14 -1
- package/dist/types-cjs/utils/error/errorMessages.d.cts +9 -0
- package/dist/types-cjs/utils/validator/ConfigValidator.d.cts +1 -0
- package/package.json +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,139 @@
|
|
|
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.1] - 2026-10-07
|
|
7
|
+
|
|
8
|
+
Patch release that corrects the OTA job list types in `ESPRMAdminOTAJob.getJob`
|
|
9
|
+
to match what the backend accepts and returns. No runtime behaviour changes:
|
|
10
|
+
the SDK already forwarded every query parameter and returned the backend's
|
|
11
|
+
response as-is. Only the types were wrong.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `GetOTAJobParams` now declares the filters the backend accepts:
|
|
16
|
+
`ota_job_name` (case-sensitive "contains" search), `ota_image_id`,
|
|
17
|
+
`archived` and `all`. Callers no longer need a cast to search.
|
|
18
|
+
- `GetOTAJobsResponse.otaJobs`, the key the backend actually returns the job
|
|
19
|
+
list under.
|
|
20
|
+
- `GetOTAJobByIdParams` and a `getJob({ ota_job_id })` overload that returns
|
|
21
|
+
`OTAJobInfo`. The backend answers an ID lookup with the job itself, not a
|
|
22
|
+
list.
|
|
23
|
+
|
|
24
|
+
### Deprecated
|
|
25
|
+
|
|
26
|
+
- `GetOTAJobsResponse.ota_update_jobs` and `GetOTAJobsResponse.total`. The
|
|
27
|
+
backend has never returned either; read `otaJobs` instead. Both will be
|
|
28
|
+
removed in the next minor release.
|
|
29
|
+
- `GetOTAJobParams.ota_job_id`. Pass `GetOTAJobByIdParams` to get the
|
|
30
|
+
correctly typed single-job response.
|
|
31
|
+
|
|
32
|
+
## [1.3.0] - 2026-10-06
|
|
33
|
+
|
|
34
|
+
Minor release that adds node deletion, node claiming through the standalone
|
|
35
|
+
claiming service (new `ESPRMClaim` module) and a delete helper for common
|
|
36
|
+
custom data. It also folds in the fixes prepared for 1.2.1, which was never
|
|
37
|
+
published: corrected webhook integration, event filter and common custom data
|
|
38
|
+
types, and a fix for `activateDeactivateNodes`, which could not have worked
|
|
39
|
+
before.
|
|
40
|
+
|
|
41
|
+
Some request and response types change shape to match the backend. In every
|
|
42
|
+
case the old shape was never accepted or returned by the backend, so no
|
|
43
|
+
working caller breaks at runtime, but code built on the old types will no
|
|
44
|
+
longer type-check.
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- **Node deletion** (`ESPRMAdminNode`)
|
|
49
|
+
- `deleteNode(nodeId)` → `DELETE admin/nodes?node_id=<id>&delete_node=true`.
|
|
50
|
+
Permanently deletes one node (certificates, IoT thing, data, user and
|
|
51
|
+
group mappings). Public deployments only; the backend rejects it on
|
|
52
|
+
customer deployments with error 105059.
|
|
53
|
+
- `MAX_NODE_ACTIVATION_BATCH_SIZE` constant (25), plus validation error
|
|
54
|
+
codes `MISSING_NODE_IDS` and `TOO_MANY_NODE_IDS`.
|
|
55
|
+
- `ActivateDeactivateNodesResponse`, `NodeActivationMultiStatusResponse`,
|
|
56
|
+
`NodeActivationSuccessResult` and `NodeActivationFailureResult` types.
|
|
57
|
+
|
|
58
|
+
- **Node claiming** (`ESPRMClaim`, new module)
|
|
59
|
+
- `initiateClaim({ mac_addr, platform })` → `POST claim/initiate`, returns
|
|
60
|
+
`{ node_id }`.
|
|
61
|
+
- `verifyClaim({ csr, send_mqtt_host?, node_policies? }, { matter?, test? })`
|
|
62
|
+
→ `POST claim/verify`, returns `{ certificate, mqtt_host?, mqtt_cred_host? }`.
|
|
63
|
+
`test` is only sent when `matter` is true.
|
|
64
|
+
- Both call the standalone claiming service (public deployments only), not
|
|
65
|
+
the RainMaker API. Configure it with the new optional
|
|
66
|
+
`ESPRMBase.configure({ claimingBaseUrl })`; calls without it throw
|
|
67
|
+
`ESPConfigError` `CLAIMING_NOT_CONFIGURED`. An invalid URL throws
|
|
68
|
+
`INVALID_CLAIMING_BASE_URL` at configure time.
|
|
69
|
+
- Validation error codes `MISSING_MAC_ADDRESS`, `MISSING_CLAIM_PLATFORM`
|
|
70
|
+
and `MISSING_CSR`.
|
|
71
|
+
- Only authenticated claiming is supported; the unauthenticated
|
|
72
|
+
challenge/response variant is not exposed.
|
|
73
|
+
- Available from the package root and the new
|
|
74
|
+
`@espressif/rainmaker-admin-sdk/ESPRMClaim` sub-path.
|
|
75
|
+
|
|
76
|
+
- **Common custom data** (`ESPRMAdminCommonCustomData`)
|
|
77
|
+
- `deleteCommonCustomData({ name })`. The backend has no DELETE method for
|
|
78
|
+
this resource; it deletes an entry when `PUT admin/common_custom_data`
|
|
79
|
+
receives `value: null`. Callers no longer need to know that.
|
|
80
|
+
- `CommonCustomDataItem` (`{ name, value, perms? }`) and
|
|
81
|
+
`DeleteCommonCustomDataRequest` types.
|
|
82
|
+
- Validation error codes `MISSING_COMMON_CUSTOM_DATA_NAME` and
|
|
83
|
+
`MISSING_COMMON_CUSTOM_DATA_VALUE`.
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- **Node activation** (`ESPRMAdminNode`) — **breaking**
|
|
88
|
+
- `activateDeactivateNodes` sent `node_id` and `activate` as a JSON body,
|
|
89
|
+
but `PUT admin/nodes` reads them from the query string only (the body is
|
|
90
|
+
parsed as tags), so every call failed with error 105018. They are now
|
|
91
|
+
sent as query parameters.
|
|
92
|
+
- `ActivateDeactivateNodesParams` is now `{ node_ids: string[]; activate }`
|
|
93
|
+
(was `{ node_id: string; activate }`), matching the backend's batch
|
|
94
|
+
support of up to 25 comma-separated IDs. The method throws
|
|
95
|
+
`ESPAPICallValidationError` for an empty list or more than 25 IDs.
|
|
96
|
+
The endpoint is supported on private (customer) deployments only.
|
|
97
|
+
- The return type is `ActivateDeactivateNodesResponse`: a single success,
|
|
98
|
+
or a 207 `{ responses }` list with per-node results when outcomes differ.
|
|
99
|
+
Since the old call never succeeded, no working caller breaks at runtime.
|
|
100
|
+
|
|
101
|
+
- **Common custom data** (`ESPRMAdminCommonCustomData`)
|
|
102
|
+
- `GetCommonCustomDataResponse` is now `CommonCustomDataItem[]` instead of
|
|
103
|
+
a `{ [key: string]: unknown }` map. `GET admin/common_custom_data` has
|
|
104
|
+
always returned an array, including a single-element array when `name`
|
|
105
|
+
is given. Code that indexed the old map type will no longer type-check.
|
|
106
|
+
- `setCommonCustomData` now throws `ESPAPICallValidationError` when `name`
|
|
107
|
+
is empty or `value` is `null`/`undefined`. The backend treats a null or
|
|
108
|
+
missing value as a delete, and `JSON.stringify` drops `undefined`, so an
|
|
109
|
+
accidental `undefined` used to wipe the entry.
|
|
110
|
+
- Documented the PUT merge semantics on `SetCommonCustomDataRequest`:
|
|
111
|
+
object values are deep merged (omitted keys are kept, nested `null`
|
|
112
|
+
deletes a key); other value types replace the stored value.
|
|
113
|
+
|
|
114
|
+
- **Webhook integrations** (`ESPRMAdminWebhook`)
|
|
115
|
+
- `GetWebhookIntegrationsResponse` now declares `integration_info_list`
|
|
116
|
+
(`WebhookIntegrationInfo[] | null`) instead of `webhooks_endpoints`.
|
|
117
|
+
`GET admin/webhook_integration` has always returned
|
|
118
|
+
`integration_info_list`, and returns `null` when no integrations are
|
|
119
|
+
configured. The backend never sent `webhooks_endpoints`, so no working
|
|
120
|
+
caller can break at runtime, but code that read that field will no
|
|
121
|
+
longer type-check.
|
|
122
|
+
|
|
123
|
+
- **Event filters** (`ESPRMAdminEventFilter`)
|
|
124
|
+
- `UpdateEventFilterRequest.enabled_for_integrations` is now optional.
|
|
125
|
+
`PUT admin/event_filter` keeps the stored integration list when the
|
|
126
|
+
field is omitted, so callers can change only `enabled`. Existing
|
|
127
|
+
callers that pass the field are unaffected.
|
|
128
|
+
- Documented the update semantics: the list adds (`enabled: true`) or
|
|
129
|
+
removes (`enabled: false`) integrations rather than replacing the
|
|
130
|
+
stored list, and a non-empty list makes the backend derive `enabled`.
|
|
131
|
+
The call fails with error `113109` when the mapping does not exist; it
|
|
132
|
+
never creates one.
|
|
133
|
+
|
|
134
|
+
### Security
|
|
135
|
+
|
|
136
|
+
- `claimingBaseUrl` receives the user's access token on every `ESPRMClaim`
|
|
137
|
+
call. Set it only to a trusted Espressif claiming endpoint.
|
|
138
|
+
|
|
6
139
|
## [1.2.0] - 2026-09-25
|
|
7
140
|
|
|
8
141
|
Minor release that adds typed access to node certificate registration, so
|
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,6 +9,7 @@ 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');
|
|
@@ -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,6 +78,7 @@ 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');
|
|
@@ -170,6 +172,7 @@ require('./methods/ESPRMAdminSuperAdmin/ChangeSuperAdmin.cjs');
|
|
|
170
172
|
require('./methods/ESPRMAdminSenderEmail/ChangeSenderEmail.cjs');
|
|
171
173
|
require('./methods/ESPRMAdminCommonCustomData/SetCommonCustomData.cjs');
|
|
172
174
|
require('./methods/ESPRMAdminCommonCustomData/GetCommonCustomData.cjs');
|
|
175
|
+
require('./methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.cjs');
|
|
173
176
|
require('./methods/ESPRMAdminDeploymentSetting/GetDeploymentSettings.cjs');
|
|
174
177
|
require('./methods/ESPRMAdminDeploymentSetting/UpdateDeploymentConfig.cjs');
|
|
175
178
|
require('./methods/ESPRMAdminConfiguration/GetNotifications.cjs');
|
|
@@ -192,6 +195,8 @@ require('./methods/ESPRMAdminPassthrough/CreatePassthroughConfig.cjs');
|
|
|
192
195
|
require('./methods/ESPRMAdminPassthrough/UpdatePassthroughConfig.cjs');
|
|
193
196
|
require('./methods/ESPRMAdminNodeCertificateCA/UpdateNodeCACertificate.cjs');
|
|
194
197
|
require('./methods/ESPRMAdminNodeCertificateCA/GetNodeCACertificate.cjs');
|
|
198
|
+
require('./methods/ESPRMClaim/InitiateClaim.cjs');
|
|
199
|
+
require('./methods/ESPRMClaim/VerifyClaim.cjs');
|
|
195
200
|
require('./methods/ESPRMAdminWebhook/CreateWebhookIntegration.cjs');
|
|
196
201
|
require('./methods/ESPRMAdminWebhook/UpdateWebhookIntegration.cjs');
|
|
197
202
|
require('./methods/ESPRMAdminWebhook/GetWebhookIntegrations.cjs');
|
|
@@ -283,6 +288,7 @@ exports.ESPRMAdminAPIStatistics = ESPRMAdminAPIStatistics.ESPRMAdminAPIStatistic
|
|
|
283
288
|
exports.ESPRMAdminMQTTStatistics = ESPRMAdminMQTTStatistics.ESPRMAdminMQTTStatistics;
|
|
284
289
|
exports.ESPRMAdminMatter = ESPRMAdminMatter.ESPRMAdminMatter;
|
|
285
290
|
exports.ESPRMAdminNodeParams = ESPRMAdminNodeParams.ESPRMAdminNodeParams;
|
|
291
|
+
exports.ESPRMClaim = ESPRMClaim.ESPRMClaim;
|
|
286
292
|
exports.APICallValidationErrorCodes = constants.APICallValidationErrorCodes;
|
|
287
293
|
exports.APIEndpoints = constants.APIEndpoints;
|
|
288
294
|
exports.APIErrorCodes = constants.APIErrorCodes;
|
|
@@ -293,6 +299,7 @@ exports.DEFAULT_REST_API_VERSION = constants.DEFAULT_REST_API_VERSION;
|
|
|
293
299
|
exports.ErrorLabels = constants.ErrorLabels;
|
|
294
300
|
exports.HTTPMethods = constants.HTTPMethods;
|
|
295
301
|
exports.HTTPStatusCodes = constants.HTTPStatusCodes;
|
|
302
|
+
exports.MAX_NODE_ACTIVATION_BATCH_SIZE = constants.MAX_NODE_ACTIVATION_BATCH_SIZE;
|
|
296
303
|
exports.StorageAdapterErrorCodes = constants.StorageAdapterErrorCodes;
|
|
297
304
|
exports.StorageKeys = constants.StorageKeys;
|
|
298
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,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,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.
|
|
@@ -96,6 +96,8 @@ const APIEndpoints = {
|
|
|
96
96
|
ADMIN_MATTER_BATCH: "admin/matter/batch",
|
|
97
97
|
ADMIN_MATTER_BATCH_NODES: "admin/matter/batch/nodes",
|
|
98
98
|
ADMIN_MAIL_FAILURES: "admin/mail_failures",
|
|
99
|
+
CLAIM_INITIATE: "claim/initiate",
|
|
100
|
+
CLAIM_VERIFY: "claim/verify",
|
|
99
101
|
};
|
|
100
102
|
const StorageKeys = {
|
|
101
103
|
ACCESSTOKEN: "com.esprmbase.accessToken",
|
|
@@ -106,6 +108,8 @@ const ConfigErrorCodes = {
|
|
|
106
108
|
SDK_NOT_CONFIGURED: "SDK_NOT_CONFIGURED",
|
|
107
109
|
INVALID_CONFIG_OBJECT: "INVALID_CONFIG_OBJECT",
|
|
108
110
|
INVALID_BASE_URL: "INVALID_BASE_URL",
|
|
111
|
+
INVALID_CLAIMING_BASE_URL: "INVALID_CLAIMING_BASE_URL",
|
|
112
|
+
CLAIMING_NOT_CONFIGURED: "CLAIMING_NOT_CONFIGURED",
|
|
109
113
|
};
|
|
110
114
|
const ValidationErrorCodes = {
|
|
111
115
|
MISSING_LOGIN_PASSWORD: "MISSING_LOGIN_PASSWORD",
|
|
@@ -153,6 +157,13 @@ const APICallValidationErrorCodes = {
|
|
|
153
157
|
MISSING_BATCH_ID: "MISSING_BATCH_ID",
|
|
154
158
|
MISSING_CANCEL_COMMAND_SCOPE: "MISSING_CANCEL_COMMAND_SCOPE",
|
|
155
159
|
CMD_ID_REQUIRES_NODE_ID: "CMD_ID_REQUIRES_NODE_ID",
|
|
160
|
+
MISSING_COMMON_CUSTOM_DATA_NAME: "MISSING_COMMON_CUSTOM_DATA_NAME",
|
|
161
|
+
MISSING_COMMON_CUSTOM_DATA_VALUE: "MISSING_COMMON_CUSTOM_DATA_VALUE",
|
|
162
|
+
MISSING_MAC_ADDRESS: "MISSING_MAC_ADDRESS",
|
|
163
|
+
MISSING_CLAIM_PLATFORM: "MISSING_CLAIM_PLATFORM",
|
|
164
|
+
MISSING_CSR: "MISSING_CSR",
|
|
165
|
+
MISSING_NODE_IDS: "MISSING_NODE_IDS",
|
|
166
|
+
TOO_MANY_NODE_IDS: "TOO_MANY_NODE_IDS",
|
|
156
167
|
};
|
|
157
168
|
const TokenErrorCodes = {
|
|
158
169
|
MISSING_ACCESS_TOKEN: "MISSING_ACCESS_TOKEN",
|
|
@@ -178,6 +189,8 @@ const DEFAULT_REST_API_VERSION = "v1";
|
|
|
178
189
|
const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
179
190
|
/** Tokens expiring within this many seconds are refreshed proactively. */
|
|
180
191
|
const TOKEN_EXPIRY_MARGIN_SECONDS = 30;
|
|
192
|
+
/** Backend limit on node IDs per `PUT admin/nodes` activation request. */
|
|
193
|
+
const MAX_NODE_ACTIVATION_BATCH_SIZE = 25;
|
|
181
194
|
/** errorCode values the SDK itself sets on ESPAPIError for non-HTTP failures. */
|
|
182
195
|
const APIErrorCodes = {
|
|
183
196
|
REQUEST_TIMEOUT: "REQUEST_TIMEOUT",
|
|
@@ -194,6 +207,7 @@ exports.DEFAULT_REST_API_VERSION = DEFAULT_REST_API_VERSION;
|
|
|
194
207
|
exports.ErrorLabels = ErrorLabels;
|
|
195
208
|
exports.HTTPMethods = HTTPMethods;
|
|
196
209
|
exports.HTTPStatusCodes = HTTPStatusCodes;
|
|
210
|
+
exports.MAX_NODE_ACTIVATION_BATCH_SIZE = MAX_NODE_ACTIVATION_BATCH_SIZE;
|
|
197
211
|
exports.StorageAdapterErrorCodes = StorageAdapterErrorCodes;
|
|
198
212
|
exports.StorageKeys = StorageKeys;
|
|
199
213
|
exports.TOKEN_EXPIRY_MARGIN_SECONDS = TOKEN_EXPIRY_MARGIN_SECONDS;
|
|
@@ -9,6 +9,8 @@ const configErrorMessages = {
|
|
|
9
9
|
SDK_NOT_CONFIGURED: "ESPRMBase is not configured yet",
|
|
10
10
|
INVALID_CONFIG_OBJECT: "Configuration Error: Config must be a non-null object.",
|
|
11
11
|
INVALID_BASE_URL: "Configuration Error: BaseUrl must be a non-empty valid URL string.",
|
|
12
|
+
INVALID_CLAIMING_BASE_URL: "Configuration Error: claimingBaseUrl must be a non-empty valid URL string.",
|
|
13
|
+
CLAIMING_NOT_CONFIGURED: "Configuration Error: claimingBaseUrl is not configured. Pass it to ESPRMBase.configure to use ESPRMClaim.",
|
|
12
14
|
};
|
|
13
15
|
const validationErrorMessages = {
|
|
14
16
|
MISSING_LOGIN_PASSWORD: "Validation Error: Password is required.",
|
|
@@ -20,6 +22,8 @@ const storageAdapterErrorMessages = {
|
|
|
20
22
|
};
|
|
21
23
|
const apiCallValidationErrorMessages = {
|
|
22
24
|
MISSING_NODE_ID: "ESPAPICallValidationError: Node ID is required.",
|
|
25
|
+
MISSING_NODE_IDS: "ESPAPICallValidationError: At least one node ID is required.",
|
|
26
|
+
TOO_MANY_NODE_IDS: "ESPAPICallValidationError: Too many node IDs; at most 25 are allowed per request.",
|
|
23
27
|
MISSING_OTA_IMAGE_ID: "ESPAPICallValidationError: OTA image ID is required.",
|
|
24
28
|
MISSING_ARCHIVE_FLAG: "ESPAPICallValidationError: Archive flag is required and must be a boolean.",
|
|
25
29
|
MISSING_OTA_JOB_ID: "ESPAPICallValidationError: OTA job ID is required.",
|
|
@@ -56,6 +60,11 @@ const apiCallValidationErrorMessages = {
|
|
|
56
60
|
MISSING_BATCH_ID: "ESPAPICallValidationError: Batch ID is required.",
|
|
57
61
|
MISSING_CANCEL_COMMAND_SCOPE: "ESPAPICallValidationError: Request ID or node ID is required.",
|
|
58
62
|
CMD_ID_REQUIRES_NODE_ID: "ESPAPICallValidationError: Command ID can only be used together with a node ID.",
|
|
63
|
+
MISSING_COMMON_CUSTOM_DATA_NAME: "ESPAPICallValidationError: Common custom data name is required.",
|
|
64
|
+
MISSING_COMMON_CUSTOM_DATA_VALUE: "ESPAPICallValidationError: Common custom data value is required. Use deleteCommonCustomData to delete an entry.",
|
|
65
|
+
MISSING_MAC_ADDRESS: "ESPAPICallValidationError: MAC address is required (12 uppercase hex characters, no separators).",
|
|
66
|
+
MISSING_CLAIM_PLATFORM: "ESPAPICallValidationError: Claim platform is required.",
|
|
67
|
+
MISSING_CSR: "ESPAPICallValidationError: Certificate signing request (CSR) is required.",
|
|
59
68
|
};
|
|
60
69
|
const tokenErrorMessages = {
|
|
61
70
|
MISSING_ACCESS_TOKEN: "ESPTokenError: Access token is missing. User needs to authenticate.",
|
|
@@ -13,12 +13,21 @@ class ConfigValidator {
|
|
|
13
13
|
static validateConfig(config) {
|
|
14
14
|
ConfigValidator.validateConfigObject(config);
|
|
15
15
|
ConfigValidator.validateBaseUrl(config.baseUrl);
|
|
16
|
+
ConfigValidator.validateClaimingBaseUrl(config.claimingBaseUrl);
|
|
16
17
|
}
|
|
17
18
|
static validateConfigObject(config) {
|
|
18
19
|
if (!validators.isValidObject(config)) {
|
|
19
20
|
throw new ESPConfigError.ESPConfigError(constants.ConfigErrorCodes.INVALID_CONFIG_OBJECT);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
23
|
+
static validateClaimingBaseUrl(claimingBaseUrl) {
|
|
24
|
+
if (claimingBaseUrl === undefined) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!validators.isNonEmptyString(claimingBaseUrl) || !validators.isValidUrl(claimingBaseUrl)) {
|
|
28
|
+
throw new ESPConfigError.ESPConfigError(constants.ConfigErrorCodes.INVALID_CLAIMING_BASE_URL);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
22
31
|
static validateBaseUrl(baseUrl) {
|
|
23
32
|
if (!validators.isNonEmptyString(baseUrl) || !validators.isValidUrl(baseUrl)) {
|
|
24
33
|
throw new ESPConfigError.ESPConfigError(constants.ConfigErrorCodes.INVALID_BASE_URL);
|
package/dist/esm/ESPRMBase.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Shell class for the standalone ESP RainMaker claiming service.
|
|
8
|
+
* Requires `claimingBaseUrl` in {@link ESPRMBase.configure}.
|
|
9
|
+
* Methods are added via prototype augmentation in methods/ESPRMClaim/*.
|
|
10
|
+
*/
|
|
11
|
+
class ESPRMClaim {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { ESPRMClaim };
|
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '../methods/ESPRMAdminCommonCustomData/SetCommonCustomData.js';
|
|
7
7
|
import '../methods/ESPRMAdminCommonCustomData/GetCommonCustomData.js';
|
|
8
|
+
import '../methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.js';
|
|
8
9
|
export { ESPRMAdminCommonCustomData } from '../ESPRMAdminCommonCustomData.js';
|
|
@@ -7,6 +7,7 @@ import '../methods/ESPRMAdminNode/GetNodes.js';
|
|
|
7
7
|
import '../methods/ESPRMAdminNode/ActivateDeactivateNodes.js';
|
|
8
8
|
import '../methods/ESPRMAdminNode/AttachNodeTags.js';
|
|
9
9
|
import '../methods/ESPRMAdminNode/RemoveNodeTags.js';
|
|
10
|
+
import '../methods/ESPRMAdminNode/DeleteNode.js';
|
|
10
11
|
import '../methods/ESPRMAdminNode/GetNodeTags.js';
|
|
11
12
|
import '../methods/ESPRMAdminNode/GetCommandRequests.js';
|
|
12
13
|
import '../methods/ESPRMAdminNode/AddCommandRequest.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import '../methods/ESPRMClaim/InitiateClaim.js';
|
|
7
|
+
import '../methods/ESPRMClaim/VerifyClaim.js';
|
|
8
|
+
export { ESPRMClaim } from '../ESPRMClaim.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -54,6 +54,7 @@ export { ESPRMAdminAPIStatistics } from './ESPRMAdminAPIStatistics.js';
|
|
|
54
54
|
export { ESPRMAdminMQTTStatistics } from './ESPRMAdminMQTTStatistics.js';
|
|
55
55
|
export { ESPRMAdminMatter } from './ESPRMAdminMatter.js';
|
|
56
56
|
export { ESPRMAdminNodeParams } from './ESPRMAdminNodeParams.js';
|
|
57
|
+
export { ESPRMClaim } from './ESPRMClaim.js';
|
|
57
58
|
import './methods/ESPRMAuth/Login.js';
|
|
58
59
|
import './methods/ESPRMAuth/Logout.js';
|
|
59
60
|
import './methods/ESPRMAuth/ForgotPassword.js';
|
|
@@ -75,6 +76,7 @@ import './methods/ESPRMAdminNode/GetNodes.js';
|
|
|
75
76
|
import './methods/ESPRMAdminNode/ActivateDeactivateNodes.js';
|
|
76
77
|
import './methods/ESPRMAdminNode/AttachNodeTags.js';
|
|
77
78
|
import './methods/ESPRMAdminNode/RemoveNodeTags.js';
|
|
79
|
+
import './methods/ESPRMAdminNode/DeleteNode.js';
|
|
78
80
|
import './methods/ESPRMAdminNode/GetNodeTags.js';
|
|
79
81
|
import './methods/ESPRMAdminNode/GetCommandRequests.js';
|
|
80
82
|
import './methods/ESPRMAdminNode/AddCommandRequest.js';
|
|
@@ -168,6 +170,7 @@ import './methods/ESPRMAdminSuperAdmin/ChangeSuperAdmin.js';
|
|
|
168
170
|
import './methods/ESPRMAdminSenderEmail/ChangeSenderEmail.js';
|
|
169
171
|
import './methods/ESPRMAdminCommonCustomData/SetCommonCustomData.js';
|
|
170
172
|
import './methods/ESPRMAdminCommonCustomData/GetCommonCustomData.js';
|
|
173
|
+
import './methods/ESPRMAdminCommonCustomData/DeleteCommonCustomData.js';
|
|
171
174
|
import './methods/ESPRMAdminDeploymentSetting/GetDeploymentSettings.js';
|
|
172
175
|
import './methods/ESPRMAdminDeploymentSetting/UpdateDeploymentConfig.js';
|
|
173
176
|
import './methods/ESPRMAdminConfiguration/GetNotifications.js';
|
|
@@ -190,6 +193,8 @@ import './methods/ESPRMAdminPassthrough/CreatePassthroughConfig.js';
|
|
|
190
193
|
import './methods/ESPRMAdminPassthrough/UpdatePassthroughConfig.js';
|
|
191
194
|
import './methods/ESPRMAdminNodeCertificateCA/UpdateNodeCACertificate.js';
|
|
192
195
|
import './methods/ESPRMAdminNodeCertificateCA/GetNodeCACertificate.js';
|
|
196
|
+
import './methods/ESPRMClaim/InitiateClaim.js';
|
|
197
|
+
import './methods/ESPRMClaim/VerifyClaim.js';
|
|
193
198
|
import './methods/ESPRMAdminWebhook/CreateWebhookIntegration.js';
|
|
194
199
|
import './methods/ESPRMAdminWebhook/UpdateWebhookIntegration.js';
|
|
195
200
|
import './methods/ESPRMAdminWebhook/GetWebhookIntegrations.js';
|
|
@@ -219,7 +224,7 @@ import './methods/ESPRMAdminMatter/GetMatterBatch.js';
|
|
|
219
224
|
import './methods/ESPRMAdminMatter/GetMatterBatchNodes.js';
|
|
220
225
|
import './methods/ESPRMAdminNodeParams/UpdateNodeParams.js';
|
|
221
226
|
import './methods/ESPRMAdminNodeParams/GetNodeParams.js';
|
|
222
|
-
export { APICallValidationErrorCodes, APIEndpoints, APIErrorCodes, AdditionalInfo, ConfigErrorCodes, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_REST_API_VERSION, ErrorLabels, HTTPMethods, HTTPStatusCodes, StorageAdapterErrorCodes, StorageKeys, TOKEN_EXPIRY_MARGIN_SECONDS, TokenErrorCodes, ValidationErrorCodes } from './utils/constants.js';
|
|
227
|
+
export { APICallValidationErrorCodes, APIEndpoints, APIErrorCodes, AdditionalInfo, ConfigErrorCodes, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_REST_API_VERSION, ErrorLabels, HTTPMethods, HTTPStatusCodes, MAX_NODE_ACTIVATION_BATCH_SIZE, StorageAdapterErrorCodes, StorageKeys, TOKEN_EXPIRY_MARGIN_SECONDS, TokenErrorCodes, ValidationErrorCodes } from './utils/constants.js';
|
|
223
228
|
export { isNonEmptyString, isValidObject, isValidUrl } from './utils/validator/validators.js';
|
|
224
229
|
export { ESPBaseError } from './utils/error/ESPBaseError.js';
|
|
225
230
|
export { ESPRMAPIManager } from './services/ESPRMAPIManager.js';
|