@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
|
@@ -3,19 +3,46 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
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
|
-
/**
|
|
19
|
-
export interface
|
|
20
|
-
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
30
|
-
|
|
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.cjs";
|
|
|
44
44
|
export * from "./publish_message.cjs";
|
|
45
45
|
export * from "./passthrough.cjs";
|
|
46
46
|
export * from "./node_certificate_ca.cjs";
|
|
47
|
+
export * from "./claim.cjs";
|
|
47
48
|
export * from "./webhook.cjs";
|
|
48
49
|
export * from "./statistical_service.cjs";
|
|
49
50
|
export * from "./mail_failure.cjs";
|
|
@@ -8,7 +8,7 @@ export type { ESPRMBaseConfig, ESPRMAPIManagerConfig, UserTokensData } from "./c
|
|
|
8
8
|
export type { SignUpRequest, ConfirmUserRequest, ChangePasswordRequest, ForgotPasswordRequest, ForgotPasswordConfirmRequest, LogoutRequest, UpdateUserProfileRequest, DeleteAccountParams, } from "./auth.cjs";
|
|
9
9
|
export type { CreateAdminUserRequest, UpdateAdminUserRequest, GetAdminUsersParams, DeleteAdminUserParams, } from "./admin_user.cjs";
|
|
10
10
|
export type { GetAdminNodesParams, ActivateDeactivateNodesParams, GetNodeTagsParams, NodeAttachTagsRequest, } from "./node.cjs";
|
|
11
|
-
export type { CreateOTAImageRequest, GetOTAImagesParams, ArchiveOTAImageParams, DeleteOTAImageParams, GetOTAImageUploadUrlParams, ConfirmOTAImageUploadRequest, GetOTAPackageUploadUrlParams, ConfirmOTAPackageUploadRequest, CreateOTAJobRequest, CreateOTAJobQueryOptions, OtaJobDownloadWindow, OtaJobValidity, OtaJobMetadata, OtaSecureBoot, OtaNetworkSerialisation, GetOTAJobParams, UpdateOTAJobParams, CancelOTAJobRequest, ArchiveOTAJobRequest, GetOTAJobStatusParams, GetOTAJobStatusSummaryParams, RetriggerOTAJobRequest, } from "./ota.cjs";
|
|
11
|
+
export type { CreateOTAImageRequest, GetOTAImagesParams, ArchiveOTAImageParams, DeleteOTAImageParams, GetOTAImageUploadUrlParams, ConfirmOTAImageUploadRequest, GetOTAPackageUploadUrlParams, ConfirmOTAPackageUploadRequest, CreateOTAJobRequest, CreateOTAJobQueryOptions, OtaJobDownloadWindow, OtaJobValidity, OtaJobMetadata, OtaSecureBoot, OtaNetworkSerialisation, GetOTAJobParams, GetOTAJobByIdParams, UpdateOTAJobParams, CancelOTAJobRequest, ArchiveOTAJobRequest, GetOTAJobStatusParams, GetOTAJobStatusSummaryParams, RetriggerOTAJobRequest, } from "./ota.cjs";
|
|
12
12
|
export type { CreateAdminGroupRequest, UpdateAdminGroupRequest, GetAdminGroupsParams, } from "./group.cjs";
|
|
13
13
|
export type { GetAdminTagsParams, AttachDetachTagsParams, GetTagNamesParams, } from "./tag.cjs";
|
|
14
14
|
export type { GetCommandRequestsParams, AddCommandRequestBody, CancelCommandRequestsParams, CommandRequestStatus, } from "./command_response.cjs";
|
|
@@ -31,7 +31,7 @@ export type { UploadLicenseFileRequest, GetLicenseFileParams } from "./license.c
|
|
|
31
31
|
export type { GenerateNodeIdsRequest, GetNodeIdsParams, GetNodeCertificatesParams, RegisterNodeCertificatesRequest, GetNodeCertificateRegistrationParams, } from "./node_registration.cjs";
|
|
32
32
|
export type { ChangeSuperAdminRequest } from "./super_admin.cjs";
|
|
33
33
|
export type { ChangeSenderEmailRequest } from "./sender_email.cjs";
|
|
34
|
-
export type { SetCommonCustomDataRequest, GetCommonCustomDataParams, } from "./common_custom_data.cjs";
|
|
34
|
+
export type { SetCommonCustomDataRequest, DeleteCommonCustomDataRequest, GetCommonCustomDataParams, } from "./common_custom_data.cjs";
|
|
35
35
|
export type { GetDeploymentDetailsParams } from "./deployment_details.cjs";
|
|
36
36
|
export type { UpdateDeploymentConfigRequest } from "./deployment_setting.cjs";
|
|
37
37
|
export type { GetNotificationsParams, UpdateNotificationsRequest, } from "./configuration.cjs";
|
|
@@ -42,6 +42,7 @@ export type { CreateMobilePlatformRequest, UpdateMobilePlatformRequest, DeleteMo
|
|
|
42
42
|
export type { PublishMessageQueryParams, PublishMessageRequest, } from "./publish_message.cjs";
|
|
43
43
|
export type { CreatePassthroughConfigRequest, UpdatePassthroughConfigRequest, GetPassthroughConfigParams, } from "./passthrough.cjs";
|
|
44
44
|
export type { UpdateNodeCACertificateRequest } from "./node_certificate_ca.cjs";
|
|
45
|
+
export type { InitiateClaimRequest, VerifyClaimRequest, VerifyClaimOptions, } from "./claim.cjs";
|
|
45
46
|
export type { CreateWebhookIntegrationRequest, UpdateWebhookIntegrationRequest, GetWebhookIntegrationsParams, DeleteWebhookIntegrationParams, UpdateWebhookEventMappingRequest, GetWebhookEventMappingParams, DeleteWebhookEventMappingParams, } from "./webhook.cjs";
|
|
46
47
|
export type { GetStatsInfoParams } from "./statistical_service.cjs";
|
|
47
48
|
export type { GetMailFailuresParams } from "./mail_failure.cjs";
|
|
@@ -52,5 +52,6 @@ import { ESPRMAdminAPIStatistics } from "../ESPRMAdminAPIStatistics.cjs";
|
|
|
52
52
|
import { ESPRMAdminMQTTStatistics } from "../ESPRMAdminMQTTStatistics.cjs";
|
|
53
53
|
import { ESPRMAdminMatter } from "../ESPRMAdminMatter.cjs";
|
|
54
54
|
import { ESPRMAdminNodeParams } from "../ESPRMAdminNodeParams.cjs";
|
|
55
|
+
import { ESPRMClaim } from "../ESPRMClaim.cjs";
|
|
55
56
|
import "../methods/export.cjs";
|
|
56
|
-
export { ESPRMAuth, ESPRMUser, ESPRMAdminUser, ESPRMAdminNode, ESPRMAdminOTAImage, ESPRMAdminOTAJob, ESPRMAdminGroup, ESPRMAdminTag, ESPRMAdminEventFilter, ESPRMAdminCustomData, ESPRMAdminRole, ESPRMAdminPolicy, ESPRMAdminUserRole, ESPRMAdminKey, ESPRMAdminSecureSign, ESPRMAdminFile, ESPRMAdminAPIInfo, ESPRMAdminDeploymentDetails, ESPRMAdminCognitoAppClient, ESPRMAdminCognitoDomain, ESPRMAdminIdentityProvider, ESPRMAdminMessageTemplate, ESPRMAdminDashboard, ESPRMAdminLicense, ESPRMAdminNodeRegistration, ESPRMAdminSuperAdmin, ESPRMAdminSenderEmail, ESPRMAdminCommonCustomData, ESPRMAdminDeploymentSetting, ESPRMAdminConfiguration, ESPRMAdminIoTDeviceRateLimit, ESPRMAdminAPIRateLimit, ESPRMAdminCustomMessageTemplate, ESPRMAdminMobilePlatform, ESPRMAdminPublishMessage, ESPRMAdminPassthrough, ESPRMAdminNodeCertificateCA, ESPRMAdminWebhook, ESPRMAdminStatisticalService, ESPRMAdminMailFailure, ESPRMAdminAPIGateway, ESPRMAdminTermsPolicy, ESPRMAdminCloudwatchLog, ESPRMAdminLogConfig, ESPRMAdminDeploymentCapability, ESPRMAdminAPIStatistics, ESPRMAdminMQTTStatistics, ESPRMAdminMatter, ESPRMAdminNodeParams, };
|
|
57
|
+
export { ESPRMAuth, ESPRMUser, ESPRMAdminUser, ESPRMAdminNode, ESPRMAdminOTAImage, ESPRMAdminOTAJob, ESPRMAdminGroup, ESPRMAdminTag, ESPRMAdminEventFilter, ESPRMAdminCustomData, ESPRMAdminRole, ESPRMAdminPolicy, ESPRMAdminUserRole, ESPRMAdminKey, ESPRMAdminSecureSign, ESPRMAdminFile, ESPRMAdminAPIInfo, ESPRMAdminDeploymentDetails, ESPRMAdminCognitoAppClient, ESPRMAdminCognitoDomain, ESPRMAdminIdentityProvider, ESPRMAdminMessageTemplate, ESPRMAdminDashboard, ESPRMAdminLicense, ESPRMAdminNodeRegistration, ESPRMAdminSuperAdmin, ESPRMAdminSenderEmail, ESPRMAdminCommonCustomData, ESPRMAdminDeploymentSetting, ESPRMAdminConfiguration, ESPRMAdminIoTDeviceRateLimit, ESPRMAdminAPIRateLimit, ESPRMAdminCustomMessageTemplate, ESPRMAdminMobilePlatform, ESPRMAdminPublishMessage, ESPRMAdminPassthrough, ESPRMAdminNodeCertificateCA, ESPRMAdminWebhook, ESPRMAdminStatisticalService, ESPRMAdminMailFailure, ESPRMAdminAPIGateway, ESPRMAdminTermsPolicy, ESPRMAdminCloudwatchLog, ESPRMAdminLogConfig, ESPRMAdminDeploymentCapability, ESPRMAdminAPIStatistics, ESPRMAdminMQTTStatistics, ESPRMAdminMatter, ESPRMAdminNodeParams, ESPRMClaim, };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import type { ESPAPISuccessResponse } from "./api.cjs";
|
|
6
7
|
/** Parameters for listing admin nodes. */
|
|
7
8
|
export interface GetAdminNodesParams {
|
|
8
9
|
/** Maximum number of records to return. */
|
|
@@ -34,11 +35,40 @@ export interface GetAdminNodesParams {
|
|
|
34
35
|
}
|
|
35
36
|
/** Parameters for activating or deactivating nodes. */
|
|
36
37
|
export interface ActivateDeactivateNodesParams {
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* IDs of the nodes to activate or deactivate. At most
|
|
40
|
+
* `MAX_NODE_ACTIVATION_BATCH_SIZE` (25) per request.
|
|
41
|
+
*/
|
|
42
|
+
node_ids: string[];
|
|
43
|
+
/** Whether to activate (true) or deactivate (false) the nodes. */
|
|
40
44
|
activate: boolean;
|
|
41
45
|
}
|
|
46
|
+
/** Per-node success entry in a 207 activation response. */
|
|
47
|
+
export interface NodeActivationSuccessResult {
|
|
48
|
+
node_id: string;
|
|
49
|
+
status: "success";
|
|
50
|
+
description: string;
|
|
51
|
+
}
|
|
52
|
+
/** Per-node failure entry in a 207 activation response. */
|
|
53
|
+
export interface NodeActivationFailureResult {
|
|
54
|
+
node_id: string;
|
|
55
|
+
status: "failure";
|
|
56
|
+
error_code: number;
|
|
57
|
+
description: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 207 Multi-Status response from `PUT admin/nodes`, returned when the
|
|
61
|
+
* per-node outcomes differ.
|
|
62
|
+
*/
|
|
63
|
+
export interface NodeActivationMultiStatusResponse {
|
|
64
|
+
responses: Array<NodeActivationSuccessResult | NodeActivationFailureResult>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Response from `activateDeactivateNodes`. When every node has the same
|
|
68
|
+
* outcome the backend returns a single 200 success; otherwise 207 with
|
|
69
|
+
* per-node results. A uniform failure rejects with `ESPAPIError`.
|
|
70
|
+
*/
|
|
71
|
+
export type ActivateDeactivateNodesResponse = ESPAPISuccessResponse | NodeActivationMultiStatusResponse;
|
|
42
72
|
/** Parameters for listing node tags or tag values. */
|
|
43
73
|
export interface GetNodeTagsParams {
|
|
44
74
|
/** Filter by tag name to retrieve its associated tag values. */
|
|
@@ -159,14 +159,40 @@ export interface CreateOTAJobQueryOptions {
|
|
|
159
159
|
/** Serialise OTA delivery per local network. */
|
|
160
160
|
network_serialised?: boolean;
|
|
161
161
|
}
|
|
162
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* Parameters for listing or searching OTA jobs.
|
|
164
|
+
*
|
|
165
|
+
* Without a filter the backend returns a page of jobs, scoped by `archived`
|
|
166
|
+
* and `all`. `ota_job_name` and `ota_image_id` switch it to a search.
|
|
167
|
+
*/
|
|
163
168
|
export interface GetOTAJobParams {
|
|
164
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* Filter by specific OTA job ID.
|
|
171
|
+
*
|
|
172
|
+
* @deprecated The backend answers an ID lookup with a single job, not a
|
|
173
|
+
* list. Pass {@link GetOTAJobByIdParams} so `getJob` returns `OTAJobInfo`.
|
|
174
|
+
*/
|
|
165
175
|
ota_job_id?: string;
|
|
166
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Return jobs whose name contains this text. Case-sensitive. Covers archived
|
|
178
|
+
* and unarchived jobs alike: `archived` and `all` are ignored.
|
|
179
|
+
*/
|
|
180
|
+
ota_job_name?: string;
|
|
181
|
+
/** Return every job created from this OTA image. Honours `archived`. */
|
|
182
|
+
ota_image_id?: string;
|
|
183
|
+
/** Maximum number of records to return (backend default and maximum: 25). */
|
|
167
184
|
num_records?: string;
|
|
168
|
-
/** Job ID to start pagination from. */
|
|
185
|
+
/** Job ID to start pagination from (the previous page's `next_id`). */
|
|
169
186
|
start_id?: string;
|
|
187
|
+
/** List archived jobs instead of unarchived ones. Defaults to `false`. */
|
|
188
|
+
archived?: boolean;
|
|
189
|
+
/** List archived and unarchived jobs together. Defaults to `false`. */
|
|
190
|
+
all?: boolean;
|
|
191
|
+
}
|
|
192
|
+
/** Parameters for fetching a single OTA job by ID. */
|
|
193
|
+
export interface GetOTAJobByIdParams {
|
|
194
|
+
/** ID of the OTA job to fetch. */
|
|
195
|
+
ota_job_id: string;
|
|
170
196
|
}
|
|
171
197
|
/** Parameters for updating an OTA job. */
|
|
172
198
|
export interface UpdateOTAJobParams {
|
|
@@ -368,11 +394,19 @@ export interface OTAJobRetriggerResponse {
|
|
|
368
394
|
}
|
|
369
395
|
/** Paginated response containing a list of OTA jobs. */
|
|
370
396
|
export interface GetOTAJobsResponse {
|
|
371
|
-
/**
|
|
372
|
-
|
|
373
|
-
/** ID to use for fetching the next page. */
|
|
397
|
+
/** OTA jobs on this page. */
|
|
398
|
+
otaJobs?: OTAJobInfo[];
|
|
399
|
+
/** ID to use for fetching the next page. Absent on the last page. */
|
|
374
400
|
next_id?: string;
|
|
375
|
-
/**
|
|
401
|
+
/**
|
|
402
|
+
* @deprecated Never returned by the backend; read `otaJobs` instead.
|
|
403
|
+
* Will be removed in the next minor release.
|
|
404
|
+
*/
|
|
405
|
+
ota_update_jobs?: OTAJobInfo[];
|
|
406
|
+
/**
|
|
407
|
+
* @deprecated Never returned by the backend. Will be removed in the next
|
|
408
|
+
* minor release.
|
|
409
|
+
*/
|
|
376
410
|
total?: number;
|
|
377
411
|
}
|
|
378
412
|
/** Per-node OTA status row (GET admin/otajob/status). */
|
|
@@ -29,7 +29,7 @@ export type { GetDashboardUpdateStatusResponse, GetDashboardVersionMappingRespon
|
|
|
29
29
|
export type { LicenseFileInfo, GetLicenseFileResponse, GetLicenseQuotaResponse, } from "./license.cjs";
|
|
30
30
|
export type { GenerateNodeIdsResponse, GetNodeIdsResponse, NodeCertificateInfo, GetNodeCertificatesResponse, NodeCertificateRegistrationStatusResponse, GetMQTTHostResponse, } from "./node_registration.cjs";
|
|
31
31
|
export type { GetDeploymentDetailsResponse } from "./deployment_details.cjs";
|
|
32
|
-
export type { GetCommonCustomDataResponse } from "./common_custom_data.cjs";
|
|
32
|
+
export type { CommonCustomDataItem, GetCommonCustomDataResponse, } from "./common_custom_data.cjs";
|
|
33
33
|
export type { GetDeploymentSettingsResponse, GetRbacDeploymentSettingResponse, RbacConfigurationValue, } from "./deployment_setting.cjs";
|
|
34
34
|
export type { GetNotificationsResponse } from "./configuration.cjs";
|
|
35
35
|
export type { GetIoTDeviceRateRuleResponse } from "./iot_device_rate_limit.cjs";
|
|
@@ -38,6 +38,7 @@ export type { CustomMessageTemplateInfo, GetCustomMessageTemplatesResponse, } fr
|
|
|
38
38
|
export type { MobilePlatformInfo, CreateMobilePlatformResponse, GetMobilePlatformsResponse, } from "./mobile_platform.cjs";
|
|
39
39
|
export type { PassthroughConfigInfo, CreatePassthroughConfigResponse, GetPassthroughConfigResponse, } from "./passthrough.cjs";
|
|
40
40
|
export type { GetNodeCACertificateResponse } from "./node_certificate_ca.cjs";
|
|
41
|
+
export type { InitiateClaimResponse, VerifyClaimResponse } from "./claim.cjs";
|
|
41
42
|
export type { WebhookIntegrationInfo, GetWebhookIntegrationsResponse, WebhookEventMappingInfo, GetWebhookEventMappingResponse, } from "./webhook.cjs";
|
|
42
43
|
export type { StatsCount, StatsObject, GetStatsInfoResponse, } from "./statistical_service.cjs";
|
|
43
44
|
export type { MailFailureInfo, GetMailFailuresResponse } from "./mail_failure.cjs";
|
|
@@ -63,8 +63,11 @@ export interface WebhookIntegrationInfo {
|
|
|
63
63
|
}
|
|
64
64
|
/** Response containing a list of webhook integrations. */
|
|
65
65
|
export interface GetWebhookIntegrationsResponse {
|
|
66
|
-
/**
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Array of webhook integration details.
|
|
68
|
+
* The backend returns `null` when no integrations are configured.
|
|
69
|
+
*/
|
|
70
|
+
integration_info_list?: WebhookIntegrationInfo[] | null;
|
|
68
71
|
}
|
|
69
72
|
/** Details of a webhook event mapping. */
|
|
70
73
|
export interface WebhookEventMappingInfo {
|
|
@@ -94,6 +94,8 @@ declare const APIEndpoints: {
|
|
|
94
94
|
readonly ADMIN_MATTER_BATCH: "admin/matter/batch";
|
|
95
95
|
readonly ADMIN_MATTER_BATCH_NODES: "admin/matter/batch/nodes";
|
|
96
96
|
readonly ADMIN_MAIL_FAILURES: "admin/mail_failures";
|
|
97
|
+
readonly CLAIM_INITIATE: "claim/initiate";
|
|
98
|
+
readonly CLAIM_VERIFY: "claim/verify";
|
|
97
99
|
};
|
|
98
100
|
declare const StorageKeys: {
|
|
99
101
|
readonly ACCESSTOKEN: "com.esprmbase.accessToken";
|
|
@@ -104,6 +106,8 @@ declare const ConfigErrorCodes: {
|
|
|
104
106
|
readonly SDK_NOT_CONFIGURED: "SDK_NOT_CONFIGURED";
|
|
105
107
|
readonly INVALID_CONFIG_OBJECT: "INVALID_CONFIG_OBJECT";
|
|
106
108
|
readonly INVALID_BASE_URL: "INVALID_BASE_URL";
|
|
109
|
+
readonly INVALID_CLAIMING_BASE_URL: "INVALID_CLAIMING_BASE_URL";
|
|
110
|
+
readonly CLAIMING_NOT_CONFIGURED: "CLAIMING_NOT_CONFIGURED";
|
|
107
111
|
};
|
|
108
112
|
declare const ValidationErrorCodes: {
|
|
109
113
|
readonly MISSING_LOGIN_PASSWORD: "MISSING_LOGIN_PASSWORD";
|
|
@@ -151,6 +155,13 @@ declare const APICallValidationErrorCodes: {
|
|
|
151
155
|
readonly MISSING_BATCH_ID: "MISSING_BATCH_ID";
|
|
152
156
|
readonly MISSING_CANCEL_COMMAND_SCOPE: "MISSING_CANCEL_COMMAND_SCOPE";
|
|
153
157
|
readonly CMD_ID_REQUIRES_NODE_ID: "CMD_ID_REQUIRES_NODE_ID";
|
|
158
|
+
readonly MISSING_COMMON_CUSTOM_DATA_NAME: "MISSING_COMMON_CUSTOM_DATA_NAME";
|
|
159
|
+
readonly MISSING_COMMON_CUSTOM_DATA_VALUE: "MISSING_COMMON_CUSTOM_DATA_VALUE";
|
|
160
|
+
readonly MISSING_MAC_ADDRESS: "MISSING_MAC_ADDRESS";
|
|
161
|
+
readonly MISSING_CLAIM_PLATFORM: "MISSING_CLAIM_PLATFORM";
|
|
162
|
+
readonly MISSING_CSR: "MISSING_CSR";
|
|
163
|
+
readonly MISSING_NODE_IDS: "MISSING_NODE_IDS";
|
|
164
|
+
readonly TOO_MANY_NODE_IDS: "TOO_MANY_NODE_IDS";
|
|
154
165
|
};
|
|
155
166
|
declare const TokenErrorCodes: {
|
|
156
167
|
readonly MISSING_ACCESS_TOKEN: "MISSING_ACCESS_TOKEN";
|
|
@@ -176,9 +187,11 @@ declare const DEFAULT_REST_API_VERSION = "v1";
|
|
|
176
187
|
declare const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
177
188
|
/** Tokens expiring within this many seconds are refreshed proactively. */
|
|
178
189
|
declare const TOKEN_EXPIRY_MARGIN_SECONDS = 30;
|
|
190
|
+
/** Backend limit on node IDs per `PUT admin/nodes` activation request. */
|
|
191
|
+
declare const MAX_NODE_ACTIVATION_BATCH_SIZE = 25;
|
|
179
192
|
/** errorCode values the SDK itself sets on ESPAPIError for non-HTTP failures. */
|
|
180
193
|
declare const APIErrorCodes: {
|
|
181
194
|
readonly REQUEST_TIMEOUT: "REQUEST_TIMEOUT";
|
|
182
195
|
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
183
196
|
};
|
|
184
|
-
export { HTTPMethods, APIEndpoints, StorageKeys, ConfigErrorCodes, ValidationErrorCodes, StorageAdapterErrorCodes, APICallValidationErrorCodes, TokenErrorCodes, ErrorLabels, HTTPStatusCodes, AdditionalInfo, DEFAULT_REST_API_VERSION, DEFAULT_REQUEST_TIMEOUT_MS, TOKEN_EXPIRY_MARGIN_SECONDS, APIErrorCodes, };
|
|
197
|
+
export { HTTPMethods, APIEndpoints, StorageKeys, ConfigErrorCodes, ValidationErrorCodes, StorageAdapterErrorCodes, APICallValidationErrorCodes, TokenErrorCodes, ErrorLabels, HTTPStatusCodes, AdditionalInfo, DEFAULT_REST_API_VERSION, DEFAULT_REQUEST_TIMEOUT_MS, TOKEN_EXPIRY_MARGIN_SECONDS, APIErrorCodes, MAX_NODE_ACTIVATION_BATCH_SIZE, };
|
|
@@ -7,6 +7,8 @@ declare const configErrorMessages: {
|
|
|
7
7
|
SDK_NOT_CONFIGURED: string;
|
|
8
8
|
INVALID_CONFIG_OBJECT: string;
|
|
9
9
|
INVALID_BASE_URL: string;
|
|
10
|
+
INVALID_CLAIMING_BASE_URL: string;
|
|
11
|
+
CLAIMING_NOT_CONFIGURED: string;
|
|
10
12
|
};
|
|
11
13
|
declare const validationErrorMessages: {
|
|
12
14
|
MISSING_LOGIN_PASSWORD: string;
|
|
@@ -18,6 +20,8 @@ declare const storageAdapterErrorMessages: {
|
|
|
18
20
|
};
|
|
19
21
|
declare const apiCallValidationErrorMessages: {
|
|
20
22
|
MISSING_NODE_ID: string;
|
|
23
|
+
MISSING_NODE_IDS: string;
|
|
24
|
+
TOO_MANY_NODE_IDS: string;
|
|
21
25
|
MISSING_OTA_IMAGE_ID: string;
|
|
22
26
|
MISSING_ARCHIVE_FLAG: string;
|
|
23
27
|
MISSING_OTA_JOB_ID: string;
|
|
@@ -54,6 +58,11 @@ declare const apiCallValidationErrorMessages: {
|
|
|
54
58
|
MISSING_BATCH_ID: string;
|
|
55
59
|
MISSING_CANCEL_COMMAND_SCOPE: string;
|
|
56
60
|
CMD_ID_REQUIRES_NODE_ID: string;
|
|
61
|
+
MISSING_COMMON_CUSTOM_DATA_NAME: string;
|
|
62
|
+
MISSING_COMMON_CUSTOM_DATA_VALUE: string;
|
|
63
|
+
MISSING_MAC_ADDRESS: string;
|
|
64
|
+
MISSING_CLAIM_PLATFORM: string;
|
|
65
|
+
MISSING_CSR: string;
|
|
57
66
|
};
|
|
58
67
|
declare const tokenErrorMessages: {
|
|
59
68
|
MISSING_ACCESS_TOKEN: string;
|
|
@@ -7,5 +7,6 @@ import { ESPRMBaseConfig } from "../../types/config.cjs";
|
|
|
7
7
|
export declare class ConfigValidator {
|
|
8
8
|
static validateConfig(config: ESPRMBaseConfig): void;
|
|
9
9
|
private static validateConfigObject;
|
|
10
|
+
private static validateClaimingBaseUrl;
|
|
10
11
|
private static validateBaseUrl;
|
|
11
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@espressif/rainmaker-admin-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Espressif's Rainmaker Admin SDK enables seamless integration of admin applications with the ESP Rainmaker ecosystem.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Espressif Systems (Shanghai) CO LTD",
|
|
@@ -527,6 +527,16 @@
|
|
|
527
527
|
"default": "./dist/cjs/entries/ESPRMBase.cjs"
|
|
528
528
|
}
|
|
529
529
|
},
|
|
530
|
+
"./ESPRMClaim": {
|
|
531
|
+
"import": {
|
|
532
|
+
"types": "./dist/types/entries/ESPRMClaim.d.ts",
|
|
533
|
+
"default": "./dist/esm/entries/ESPRMClaim.js"
|
|
534
|
+
},
|
|
535
|
+
"require": {
|
|
536
|
+
"types": "./dist/types-cjs/entries/ESPRMClaim.d.cts",
|
|
537
|
+
"default": "./dist/cjs/entries/ESPRMClaim.cjs"
|
|
538
|
+
}
|
|
539
|
+
},
|
|
530
540
|
"./ESPRMUser": {
|
|
531
541
|
"import": {
|
|
532
542
|
"types": "./dist/types/entries/ESPRMUser.d.ts",
|