@dronedeploy/rocos-js-sdk 3.0.1-alpha.15 → 3.0.1-alpha.16
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/cjs/IRocosSDK.d.ts +2 -1
- package/cjs/RocosSDK.d.ts +7 -2
- package/cjs/RocosSDK.js +11 -1
- package/cjs/constants/api.d.ts +4 -2
- package/cjs/constants/api.js +5 -3
- package/cjs/models/RocosError.d.ts +1 -0
- package/cjs/models/RocosError.js +1 -0
- package/cjs/models/ServiceEnum.d.ts +2 -1
- package/cjs/models/ServiceEnum.js +1 -0
- package/cjs/models/device-credentials/DeviceCredentials.d.ts +46 -0
- package/cjs/models/device-credentials/DeviceCredentials.js +2 -0
- package/cjs/node/RocosSDKNode.d.ts +2 -1
- package/cjs/node/RocosSDKNode.js +6 -0
- package/cjs/services/DeviceCredentialsService.d.ts +15 -0
- package/cjs/services/DeviceCredentialsService.js +50 -0
- package/cjs/services/MapService.d.ts +1 -1
- package/cjs/services/MapService.js +1 -1
- package/cjs/services/ProfileService.d.ts +2 -1
- package/cjs/services/ProfileService.js +9 -3
- package/cjs/services/index.d.ts +1 -0
- package/cjs/services/index.js +1 -0
- package/esm/IRocosSDK.d.ts +2 -1
- package/esm/RocosSDK.d.ts +7 -2
- package/esm/RocosSDK.js +12 -2
- package/esm/constants/api.d.ts +4 -2
- package/esm/constants/api.js +4 -2
- package/esm/models/RocosError.d.ts +1 -0
- package/esm/models/RocosError.js +1 -0
- package/esm/models/ServiceEnum.d.ts +2 -1
- package/esm/models/ServiceEnum.js +1 -0
- package/esm/models/device-credentials/DeviceCredentials.d.ts +46 -0
- package/esm/models/device-credentials/DeviceCredentials.js +1 -0
- package/esm/node/RocosSDKNode.d.ts +2 -1
- package/esm/node/RocosSDKNode.js +7 -1
- package/esm/services/DeviceCredentialsService.d.ts +15 -0
- package/esm/services/DeviceCredentialsService.js +46 -0
- package/esm/services/MapService.d.ts +1 -1
- package/esm/services/MapService.js +1 -1
- package/esm/services/ProfileService.d.ts +2 -1
- package/esm/services/ProfileService.js +9 -3
- package/esm/services/index.d.ts +1 -0
- package/esm/services/index.js +1 -0
- package/package.json +1 -1
package/cjs/IRocosSDK.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
|
2
2
|
import { IBaseService, IDebugLevel, ServiceEnum } from './models';
|
|
3
3
|
import { RTPWebRTCService } from './services/RTPWebRTCService';
|
|
4
4
|
export declare abstract class IRocosSDK {
|
|
@@ -27,6 +27,7 @@ export declare abstract class IRocosSDK {
|
|
|
27
27
|
abstract getSpotProvisionerService(): SpotProvisioningService | SpotProvisioningServiceNode;
|
|
28
28
|
abstract getIntegrationService(): IntegrationService;
|
|
29
29
|
abstract getEvaluatorService(): EvaluatorService;
|
|
30
|
+
abstract getDeviceCredentialsService(): DeviceCredentialsService;
|
|
30
31
|
abstract cleanup(): Promise<boolean>;
|
|
31
32
|
abstract enableDebugMode(on: boolean): void;
|
|
32
33
|
abstract setDebugLevel(level: IDebugLevel): void;
|
package/cjs/RocosSDK.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
|
2
2
|
import { AuthorisedConfig, IBaseService, IDebugLevel, IRocosSDKConfig, ServiceEnum } from './models';
|
|
3
3
|
import { IRocosSDK } from './IRocosSDK';
|
|
4
4
|
import { Logger } from 'loglevel';
|
|
@@ -19,7 +19,7 @@ export declare class RocosSDK implements IRocosSDK {
|
|
|
19
19
|
*/
|
|
20
20
|
getService<T extends IBaseService>(name: ServiceEnum): T;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Gets the authentication service.
|
|
23
23
|
*/
|
|
24
24
|
getAuthService(): AuthService;
|
|
25
25
|
/**
|
|
@@ -126,6 +126,11 @@ export declare class RocosSDK implements IRocosSDK {
|
|
|
126
126
|
* @returns EvaluatorService
|
|
127
127
|
*/
|
|
128
128
|
getEvaluatorService(): EvaluatorService;
|
|
129
|
+
/**
|
|
130
|
+
* Gets the device credentials service.
|
|
131
|
+
* @returns DeviceCredentialsService
|
|
132
|
+
*/
|
|
133
|
+
getDeviceCredentialsService(): DeviceCredentialsService;
|
|
129
134
|
get platformTimeOffset(): number;
|
|
130
135
|
get platformTime(): number;
|
|
131
136
|
/**
|
package/cjs/RocosSDK.js
CHANGED
|
@@ -104,13 +104,16 @@ class RocosSDK {
|
|
|
104
104
|
case models_1.ServiceEnum.EVALUATOR:
|
|
105
105
|
this.services[name] = new services_1.EvaluatorService(config);
|
|
106
106
|
break;
|
|
107
|
+
case models_1.ServiceEnum.DEVICE_CREDENTIALS:
|
|
108
|
+
this.services[name] = new services_1.DeviceCredentialsService(config);
|
|
109
|
+
break;
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
this.logger.debug(`Found service ${name}.`);
|
|
110
113
|
return this.services[name];
|
|
111
114
|
}
|
|
112
115
|
/**
|
|
113
|
-
*
|
|
116
|
+
* Gets the authentication service.
|
|
114
117
|
*/
|
|
115
118
|
getAuthService() {
|
|
116
119
|
return this.getService(models_1.ServiceEnum.AUTH);
|
|
@@ -267,6 +270,13 @@ class RocosSDK {
|
|
|
267
270
|
getEvaluatorService() {
|
|
268
271
|
return this.getService(models_1.ServiceEnum.EVALUATOR);
|
|
269
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Gets the device credentials service.
|
|
275
|
+
* @returns DeviceCredentialsService
|
|
276
|
+
*/
|
|
277
|
+
getDeviceCredentialsService() {
|
|
278
|
+
return this.getService(models_1.ServiceEnum.DEVICE_CREDENTIALS);
|
|
279
|
+
}
|
|
270
280
|
get platformTimeOffset() {
|
|
271
281
|
return services_1.PlatFormTimeService.getInstance(this.getTimeSyncerService())?.platformTimeOffset;
|
|
272
282
|
}
|
package/cjs/constants/api.d.ts
CHANGED
|
@@ -82,8 +82,8 @@ export declare const API_PROJECT_DEFINITION_ACTION_URL = "https://{url}/projects
|
|
|
82
82
|
export declare const API_PROJECT_DEFINITION_BUTTON_URL = "https://{url}/projects/{projectId}/robot-definitions/{definitionId}/buttons";
|
|
83
83
|
export declare const API_PROJECT_DEFINITION_TRIGGER_URL = "https://{url}/projects/{projectId}/robot-definitions/{definitionId}/triggers";
|
|
84
84
|
export declare const API_PROJECT_DEFINITION_GAMEPAD_URL = "https://{url}/projects/{projectId}/robot-definitions/{definitionId}/gamepads";
|
|
85
|
-
export declare const API_PROJECT_DEFINITION_EXPORT = "https://{url}/projects/{projectId}/robot-definitions/{definitionId}/export";
|
|
86
|
-
export declare const API_PROJECT_DEFINITION_IMPORT = "https://{url}/projects/{projectId}/robot-definitions/import";
|
|
85
|
+
export declare const API_PROJECT_DEFINITION_EXPORT = "https://{url}/import-export/projects/{projectId}/robot-definitions/{definitionId}/export";
|
|
86
|
+
export declare const API_PROJECT_DEFINITION_IMPORT = "https://{url}/import-export/projects/{projectId}/robot-definitions/import";
|
|
87
87
|
export declare const API_PROJECT_GROUP_TYPE_URL = "https://{url}/projects/{projectId}/config-groups/{type}";
|
|
88
88
|
export declare const API_PROJECT_GROUP_TYPE_ID_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}";
|
|
89
89
|
export declare const API_PROJECT_GROUP_TYPE_PUBLISH_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/publish";
|
|
@@ -131,3 +131,5 @@ export declare const API_PROJECT_WORKFLOW_ID_URL = "https://{url}/projects/{proj
|
|
|
131
131
|
export declare const API_PROJECT_WORKFLOW_ASSET_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets";
|
|
132
132
|
export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments";
|
|
133
133
|
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
|
134
|
+
export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
|
|
135
|
+
export declare const API_DEVICE_CREDENTIALS_AUTH_URL = "https://{url}/device-credentials/auth";
|
package/cjs/constants/api.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.API_PROJECT_ROBOT_REGISTER_URL = exports.API_PROJECT_ROBOT_DEFINITION_URL = exports.API_PROJECT_ROBOT_ATTRIBUTES_URL = exports.API_PROJECT_ROBOT_ID_URL = exports.API_PROJECT_ROBOT_URL = exports.API_PROJECT_MAPPED_ASSETS_PATH_URL = exports.API_PROJECT_MISSION_ASSET_PATH_URL = exports.API_PROJECT_MISSION_ASSETS_PATH_URL = exports.API_PROJECT_FLOW_ASSET_PATH_URL = exports.API_PROJECT_ROBOT_ASSET_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATION_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATIONS_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL = exports.API_PROJECT_ASSET_PROFILES_SYNC_DEFINITION_PATH_URL = exports.API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL = exports.API_PROJECT_ASSET_PATH_URL = exports.API_PROJECT_ASSET_URL = exports.API_PROJECT_USERS_URL = exports.API_PROJECT_ID_URL = exports.API_PROJECT_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_ID_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_URL = exports.API_ACCOUNT_PROJECT_USER_ID_URL = exports.API_ACCOUNT_PROJECT_USER_URL = exports.API_ACCOUNT_PROJECT_ID_URL = exports.API_ACCOUNT_PROJECT_URL = exports.API_SERVER_TIME_URL = exports.API_ACCOUNT_INTEGRATION_TYPE_URL = exports.API_ACCOUNT_INTEGRATION_URL = exports.API_ACCOUNT_SETTINGS_URL = exports.API_AUTH_USER_ACCOUNT_USER_ID_URL = exports.API_AUTH_USER_ACCOUNT_USER_URL = exports.API_ACCOUNT_ACTIVATE_URL = exports.API_ACCOUNT_ID_URL = exports.API_ACCOUNT_URL = exports.API_USER_PAT_TOKEN_URL = exports.API_USER_PAT_URL = exports.API_USER_VERIFY_EMAIL_URL = exports.API_USER_INVITATION_CHECK_URL = exports.API_USER_INVITATION_ACCEPT_URL = exports.API_USER_INVITATION_URL = exports.API_USER_PASSWORD_FORGOT_URL = exports.API_USER_PASSWORD_RESET_URL = exports.API_OTP_AUTH_URL = exports.API_OTP_URL = exports.API_USER_TOKEN_URL = exports.API_USER_AUTH_URL = exports.API_USER_URL = exports.API_ADMIN_USER_INVITATION_URL = exports.API_APPLICATION_AUTH_URL = void 0;
|
|
4
4
|
exports.API_PROJECT_ROBOT_DASHBOARD_ID_URL = exports.API_PROJECT_ROBOT_DASHBOARD_URL = exports.API_PROJECT_STREAM_CALLSIGN_URL = exports.API_PROJECT_STREAM_DATA_URL = exports.API_PROJECT_STREAM_ID_URL = exports.API_PROJECT_STREAM_URL = exports.API_PROJECT_EXPORT_URL = exports.API_PROJECT_GROUP_TYPE_OWNER_OVERRIDE_URL = exports.API_PROJECT_GROUP_TYPE_OWNER_ID_URL = exports.API_PROJECT_GROUP_TYPE_VERSION_URL = exports.API_PROJECT_GROUP_TYPE_CONFIG_URL = exports.API_PROJECT_GROUP_TYPE_PUBLISH_URL = exports.API_PROJECT_GROUP_TYPE_ID_URL = exports.API_PROJECT_GROUP_TYPE_URL = exports.API_PROJECT_DEFINITION_IMPORT = exports.API_PROJECT_DEFINITION_EXPORT = exports.API_PROJECT_DEFINITION_GAMEPAD_URL = exports.API_PROJECT_DEFINITION_TRIGGER_URL = exports.API_PROJECT_DEFINITION_BUTTON_URL = exports.API_PROJECT_DEFINITION_ACTION_URL = exports.API_PROJECT_DEFINITION_EVENT_URL = exports.API_PROJECT_DEFINITION_COMMAND2_URL = exports.API_PROJECT_DEFINITION_COMMAND_URL = exports.API_PROJECT_DEFINITION_AGENT_URL = exports.API_PROJECT_DEFINITION_SETTING_URL = exports.API_PROJECT_DEFINITION_BLOB_URL = exports.API_PROJECT_DEFINITION_DASHBOARD_URL = exports.API_PROJECT_DEFINITION_COPY_URL = exports.API_PROJECT_DEFINITION_STREAM_URL = exports.API_PROJECT_DEFINITION_ID_URL = exports.API_PROJECT_DEFINITION_URL = exports.API_PROJECT_VROBOT_DEPLOY_URL = exports.API_PROJECT_VROBOT_DETAILS_URL = exports.API_PROJECT_COLLECTION_DOCS_URL = exports.API_PROJECT_COLLECTION_ID_URL = exports.API_PROJECT_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_DASHBOARD_WIDGET_URL = exports.API_PROJECT_DASHBOARD_ID_URL = exports.API_PROJECT_DASHBOARD_URL = exports.API_PROJECT_OPERATION_ID_URL = exports.API_PROJECT_OPERATION_URL = exports.API_PROJECT_ROBOT_GAMEPAD_URL = exports.API_PROJECT_ROBOT_TRIGGER_URL = exports.API_PROJECT_ROBOT_BUTTON_URL = exports.API_PROJECT_ROBOT_COMMAND2_URL = exports.API_PROJECT_ROBOT_COMMAND_URL = exports.API_PROJECT_ROBOT_AGENT_URL = exports.API_PROJECT_ROBOT_SETTING_URL = exports.API_PROJECT_ROBOT_EVENT_HISTORY_URL = exports.API_PROJECT_ROBOT_EVENT_URL = void 0;
|
|
5
|
-
exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_OBSERVATION_KEYS_URL = exports.API_OBSERVATIONS_URL = exports.API_MAPS_PANORAMA_OBSERVATIONS_URL = exports.API_MAPS_GEOJSON_URL = exports.API_MAPS_DEPLOY_URL = exports.API_MAPS_COPY_URL = exports.API_MAP_ID_URL = exports.API_MAPS_MERGE_URL = exports.API_MAPS_DEPLOYED_URL = exports.API_MAPS_URL = exports.API_DD_INTEGRATION_ISSUES_URL = exports.API_DD_INTEGRATION_OVERLAYS_URL = exports.API_DD_INTEGRATION_PLAN_BY_ID_URL = exports.API_DD_INTEGRATION_PLANS_URL = exports.API_SPOTTY_URL = exports.API_PROJECT_SCHEDULES_URL = exports.API_SOURCE_ID_URL = exports.API_SOURCE_URL = exports.API_SOURCE_SCHEMA_URL = exports.API_TEMPLATE_EXPORTER_URL = exports.API_TEMPLATE_PROVISION_ID_URL = exports.API_TEMPLATE_PROVISION_URL = exports.API_TEMPLATE_DEPLOY_URL = exports.API_PROJECT_PROFILE_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_PROFILE_DASHBOARD_ID_URL = exports.API_PROJECT_PROFILE_DASHBOARD_URL = exports.API_PROJECT_CALLSIGN_STREAM_URL = exports.API_PROJECT_ROBOT_DASHBOARD_CUSTOM_WIDGET_URL = void 0;
|
|
5
|
+
exports.API_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_OBSERVATION_KEYS_URL = exports.API_OBSERVATIONS_URL = exports.API_MAPS_PANORAMA_OBSERVATIONS_URL = exports.API_MAPS_GEOJSON_URL = exports.API_MAPS_DEPLOY_URL = exports.API_MAPS_COPY_URL = exports.API_MAP_ID_URL = exports.API_MAPS_MERGE_URL = exports.API_MAPS_DEPLOYED_URL = exports.API_MAPS_URL = exports.API_DD_INTEGRATION_ISSUES_URL = exports.API_DD_INTEGRATION_OVERLAYS_URL = exports.API_DD_INTEGRATION_PLAN_BY_ID_URL = exports.API_DD_INTEGRATION_PLANS_URL = exports.API_SPOTTY_URL = exports.API_PROJECT_SCHEDULES_URL = exports.API_SOURCE_ID_URL = exports.API_SOURCE_URL = exports.API_SOURCE_SCHEMA_URL = exports.API_TEMPLATE_EXPORTER_URL = exports.API_TEMPLATE_PROVISION_ID_URL = exports.API_TEMPLATE_PROVISION_URL = exports.API_TEMPLATE_DEPLOY_URL = exports.API_PROJECT_PROFILE_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_PROFILE_DASHBOARD_ID_URL = exports.API_PROJECT_PROFILE_DASHBOARD_URL = exports.API_PROJECT_CALLSIGN_STREAM_URL = exports.API_PROJECT_ROBOT_DASHBOARD_CUSTOM_WIDGET_URL = void 0;
|
|
6
6
|
exports.API_APPLICATION_AUTH_URL = 'https://{url}/applications/auth';
|
|
7
7
|
exports.API_ADMIN_USER_INVITATION_URL = 'https://{url}/admin/users/invitations';
|
|
8
8
|
exports.API_USER_URL = 'https://{url}/users';
|
|
@@ -87,8 +87,8 @@ exports.API_PROJECT_DEFINITION_ACTION_URL = 'https://{url}/projects/{projectId}/
|
|
|
87
87
|
exports.API_PROJECT_DEFINITION_BUTTON_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/buttons';
|
|
88
88
|
exports.API_PROJECT_DEFINITION_TRIGGER_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/triggers';
|
|
89
89
|
exports.API_PROJECT_DEFINITION_GAMEPAD_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/gamepads';
|
|
90
|
-
exports.API_PROJECT_DEFINITION_EXPORT = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/export';
|
|
91
|
-
exports.API_PROJECT_DEFINITION_IMPORT = 'https://{url}/projects/{projectId}/robot-definitions/import';
|
|
90
|
+
exports.API_PROJECT_DEFINITION_EXPORT = 'https://{url}/import-export/projects/{projectId}/robot-definitions/{definitionId}/export';
|
|
91
|
+
exports.API_PROJECT_DEFINITION_IMPORT = 'https://{url}/import-export/projects/{projectId}/robot-definitions/import';
|
|
92
92
|
exports.API_PROJECT_GROUP_TYPE_URL = 'https://{url}/projects/{projectId}/config-groups/{type}';
|
|
93
93
|
exports.API_PROJECT_GROUP_TYPE_ID_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}';
|
|
94
94
|
exports.API_PROJECT_GROUP_TYPE_PUBLISH_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/publish';
|
|
@@ -136,3 +136,5 @@ exports.API_PROJECT_WORKFLOW_ID_URL = 'https://{url}/projects/{projectId}/automa
|
|
|
136
136
|
exports.API_PROJECT_WORKFLOW_ASSET_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets';
|
|
137
137
|
exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments';
|
|
138
138
|
exports.API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
|
139
|
+
exports.API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
|
|
140
|
+
exports.API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
|
package/cjs/models/RocosError.js
CHANGED
|
@@ -27,6 +27,7 @@ exports.errorCodes = {
|
|
|
27
27
|
MAPS_SERVICE_ERROR: 'MAPS_SERVICE_ERROR',
|
|
28
28
|
EVALUATOR_SERVICE_ERROR: 'EVALUATOR_SERVICE_ERROR',
|
|
29
29
|
WEBRTC_SERVICE_ERROR: 'WEBRTC_SERVICE_ERROR',
|
|
30
|
+
DEVICE_CREDENTIALS_SERVICE_ERROR: 'DEVICE_CREDENTIALS_SERVICE_ERROR',
|
|
30
31
|
};
|
|
31
32
|
class RocosError extends Error {
|
|
32
33
|
constructor(err, code, statusCode) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface DeviceCredentials {
|
|
2
|
+
[component: string]: {
|
|
3
|
+
[system: string]: DeviceCredential;
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
export interface DeviceCredential {
|
|
7
|
+
/**
|
|
8
|
+
* Device ID or username
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Device secret or password
|
|
13
|
+
*/
|
|
14
|
+
key: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DeviceCredentialCreate {
|
|
17
|
+
/**
|
|
18
|
+
* Will automatically be generated if not provided
|
|
19
|
+
*/
|
|
20
|
+
id?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Will automatically be generated if not provided
|
|
23
|
+
*/
|
|
24
|
+
key?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The agent component the credentials are for e.g. dji, spot, etc.
|
|
27
|
+
*/
|
|
28
|
+
component: string;
|
|
29
|
+
/**
|
|
30
|
+
* The system the credentials are for e.g. mqtt, rtmp, etc.
|
|
31
|
+
*/
|
|
32
|
+
system: string;
|
|
33
|
+
}
|
|
34
|
+
export interface DeviceCredentialAuth extends DeviceCredential {
|
|
35
|
+
/**
|
|
36
|
+
* The agent component the credentials are for e.g. dji, spot, etc.
|
|
37
|
+
*/
|
|
38
|
+
component: string;
|
|
39
|
+
/**
|
|
40
|
+
* The system the credentials are for e.g. mqtt, rtmp, etc.
|
|
41
|
+
*/
|
|
42
|
+
system: string;
|
|
43
|
+
}
|
|
44
|
+
export interface DeviceCredentialAuthResult {
|
|
45
|
+
result: 'allow' | 'deny';
|
|
46
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EvaluatorService, ScheduleService } from '../services';
|
|
1
|
+
import { DeviceCredentialsService, EvaluatorService, ScheduleService } from '../services';
|
|
2
2
|
import { IBaseService, ServiceEnum } from '../models';
|
|
3
3
|
import { CallerServiceNode } from '../services/CallerServiceNode';
|
|
4
4
|
import { CommandServiceNode } from '../services/CommandServiceNode';
|
|
@@ -48,4 +48,5 @@ export declare class RocosSDKNode extends RocosSDK {
|
|
|
48
48
|
* @deprecated Not supported in Node.js
|
|
49
49
|
*/
|
|
50
50
|
getRTPWebRTCService(): never;
|
|
51
|
+
getDeviceCredentialsService(): DeviceCredentialsService;
|
|
51
52
|
}
|
package/cjs/node/RocosSDKNode.js
CHANGED
|
@@ -81,6 +81,9 @@ class RocosSDKNode extends RocosSDK_1.RocosSDK {
|
|
|
81
81
|
case models_1.ServiceEnum.MAP:
|
|
82
82
|
this.services[name] = new services_1.MapService(config);
|
|
83
83
|
break;
|
|
84
|
+
case models_1.ServiceEnum.DEVICE_CREDENTIALS:
|
|
85
|
+
this.services[name] = new services_1.DeviceCredentialsService(config);
|
|
86
|
+
break;
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
this.logger.debug(`Found service ${name}.`);
|
|
@@ -143,5 +146,8 @@ class RocosSDKNode extends RocosSDK_1.RocosSDK {
|
|
|
143
146
|
getRTPWebRTCService() {
|
|
144
147
|
throw new Error('WebRTC service is not supported in NodeJS');
|
|
145
148
|
}
|
|
149
|
+
getDeviceCredentialsService() {
|
|
150
|
+
return this.getService(models_1.ServiceEnum.DEVICE_CREDENTIALS);
|
|
151
|
+
}
|
|
146
152
|
}
|
|
147
153
|
exports.RocosSDKNode = RocosSDKNode;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DeviceCredentialAuth, DeviceCredentialAuthResult, DeviceCredentialCreate, DeviceCredentials } from '../models/device-credentials/DeviceCredentials';
|
|
2
|
+
import { IBaseService, IRocosSDKConfig, RocosError } from '../models';
|
|
3
|
+
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
4
|
+
/**
|
|
5
|
+
* Manage external devices authenticating with the platform
|
|
6
|
+
*/
|
|
7
|
+
export declare class DeviceCredentialsService extends BaseServiceAbstract implements IBaseService {
|
|
8
|
+
constructor(config: IRocosSDKConfig);
|
|
9
|
+
getStatus(): boolean;
|
|
10
|
+
protected getError(e: Error): RocosError;
|
|
11
|
+
list(projectId: string, callsign: string): Promise<DeviceCredentials>;
|
|
12
|
+
create(projectId: string, callsign: string, credentials: DeviceCredentialCreate): Promise<DeviceCredentialCreate>;
|
|
13
|
+
delete(projectId: string, callsign: string, component: string, system: string): Promise<void>;
|
|
14
|
+
auth(credentials: DeviceCredentialAuth): Promise<DeviceCredentialAuthResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceCredentialsService = void 0;
|
|
4
|
+
const api_1 = require("../constants/api");
|
|
5
|
+
const models_1 = require("../models");
|
|
6
|
+
const BaseServiceAbstract_1 = require("./BaseServiceAbstract");
|
|
7
|
+
const RocosLogger_1 = require("../logger/RocosLogger");
|
|
8
|
+
const formatServiceUrl_1 = require("../helpers/formatServiceUrl");
|
|
9
|
+
/**
|
|
10
|
+
* Manage external devices authenticating with the platform
|
|
11
|
+
*/
|
|
12
|
+
class DeviceCredentialsService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
15
|
+
this.logger = RocosLogger_1.RocosLogger.getInstance(`DeviceCredentials(${this.config.url})`);
|
|
16
|
+
}
|
|
17
|
+
getStatus() {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
getError(e) {
|
|
21
|
+
return new models_1.RocosError(e, models_1.errorCodes.DEVICE_CREDENTIALS_SERVICE_ERROR);
|
|
22
|
+
}
|
|
23
|
+
list(projectId, callsign) {
|
|
24
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_DEVICE_CREDENTIALS_URL, {
|
|
25
|
+
url: this.config.url,
|
|
26
|
+
projectId,
|
|
27
|
+
callsign,
|
|
28
|
+
}, this.config.insecure), 'Failed to get device credentials.');
|
|
29
|
+
}
|
|
30
|
+
create(projectId, callsign, credentials) {
|
|
31
|
+
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_DEVICE_CREDENTIALS_URL, {
|
|
32
|
+
url: this.config.url,
|
|
33
|
+
projectId,
|
|
34
|
+
callsign,
|
|
35
|
+
}, this.config.insecure), credentials, 'Failed to create device credentials.');
|
|
36
|
+
}
|
|
37
|
+
delete(projectId, callsign, component, system) {
|
|
38
|
+
return this.callDelete((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_DEVICE_CREDENTIALS_URL, {
|
|
39
|
+
url: this.config.url,
|
|
40
|
+
projectId,
|
|
41
|
+
callsign,
|
|
42
|
+
}, this.config.insecure), 'Failed to delete device credentials.', { component, system });
|
|
43
|
+
}
|
|
44
|
+
auth(credentials) {
|
|
45
|
+
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_DEVICE_CREDENTIALS_AUTH_URL, {
|
|
46
|
+
url: this.config.url,
|
|
47
|
+
}, this.config.insecure), credentials, 'Failed to delete device credentials.');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.DeviceCredentialsService = DeviceCredentialsService;
|
|
@@ -2,7 +2,7 @@ import { IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
|
|
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
3
3
|
import { Observation } from '../models/maps/Panorama';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Maps service for managing robot maps in the cloud and on robots
|
|
6
6
|
*/
|
|
7
7
|
export declare class MapService extends BaseServiceAbstract implements IBaseService {
|
|
8
8
|
constructor(config: IRocosSDKConfig);
|
|
@@ -7,7 +7,7 @@ const BaseServiceAbstract_1 = require("./BaseServiceAbstract");
|
|
|
7
7
|
const RocosLogger_1 = require("../logger/RocosLogger");
|
|
8
8
|
const formatServiceUrl_1 = require("../helpers/formatServiceUrl");
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Maps service for managing robot maps in the cloud and on robots
|
|
11
11
|
*/
|
|
12
12
|
class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
13
13
|
constructor(config) {
|
|
@@ -249,10 +249,11 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
|
249
249
|
* @param projectId - Project Id
|
|
250
250
|
* @param profileData - Robot definition data
|
|
251
251
|
* @param newName - Optional new name for the robot definition. If not provided, the name from the imported definition will be used.
|
|
252
|
+
* @param newDescription - Optional new description for the robot definition. If not provided, the description from the imported definition will be used.
|
|
252
253
|
*
|
|
253
254
|
* @see export
|
|
254
255
|
*/
|
|
255
|
-
import(projectId: string, profileData:
|
|
256
|
+
import(projectId: string, profileData: Blob | File, newName?: string, newDescription?: string): Promise<{
|
|
256
257
|
profileId: string;
|
|
257
258
|
}>;
|
|
258
259
|
/**
|
|
@@ -367,14 +367,20 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
|
367
367
|
* @param projectId - Project Id
|
|
368
368
|
* @param profileData - Robot definition data
|
|
369
369
|
* @param newName - Optional new name for the robot definition. If not provided, the name from the imported definition will be used.
|
|
370
|
+
* @param newDescription - Optional new description for the robot definition. If not provided, the description from the imported definition will be used.
|
|
370
371
|
*
|
|
371
372
|
* @see export
|
|
372
373
|
*/
|
|
373
|
-
async import(projectId, profileData, newName) {
|
|
374
|
+
async import(projectId, profileData, newName, newDescription) {
|
|
375
|
+
const formData = new FormData();
|
|
374
376
|
if (newName) {
|
|
375
|
-
|
|
377
|
+
formData.append('name', newName);
|
|
376
378
|
}
|
|
377
|
-
|
|
379
|
+
if (newDescription) {
|
|
380
|
+
formData.append('description', newDescription);
|
|
381
|
+
}
|
|
382
|
+
formData.append('file', profileData);
|
|
383
|
+
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_IMPORT, { url: this.config.url, projectId }, this.config.insecure), formData, `Failed to import robot definition for ${projectId}.`);
|
|
378
384
|
}
|
|
379
385
|
/**
|
|
380
386
|
* Update gamepads for a robot definition
|
package/cjs/services/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './CommandService';
|
|
|
5
5
|
export * from './ConfigGroupService';
|
|
6
6
|
export * from './ControlService';
|
|
7
7
|
export * from './DashboardService';
|
|
8
|
+
export * from './DeviceCredentialsService';
|
|
8
9
|
export * from './EventService';
|
|
9
10
|
export * from './FileAccessorService';
|
|
10
11
|
export * from './IntegrationService';
|
package/cjs/services/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./CommandService"), exports);
|
|
|
21
21
|
__exportStar(require("./ConfigGroupService"), exports);
|
|
22
22
|
__exportStar(require("./ControlService"), exports);
|
|
23
23
|
__exportStar(require("./DashboardService"), exports);
|
|
24
|
+
__exportStar(require("./DeviceCredentialsService"), exports);
|
|
24
25
|
__exportStar(require("./EventService"), exports);
|
|
25
26
|
__exportStar(require("./FileAccessorService"), exports);
|
|
26
27
|
__exportStar(require("./IntegrationService"), exports);
|
package/esm/IRocosSDK.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
|
2
2
|
import { IBaseService, IDebugLevel, ServiceEnum } from './models';
|
|
3
3
|
import { RTPWebRTCService } from './services/RTPWebRTCService';
|
|
4
4
|
export declare abstract class IRocosSDK {
|
|
@@ -27,6 +27,7 @@ export declare abstract class IRocosSDK {
|
|
|
27
27
|
abstract getSpotProvisionerService(): SpotProvisioningService | SpotProvisioningServiceNode;
|
|
28
28
|
abstract getIntegrationService(): IntegrationService;
|
|
29
29
|
abstract getEvaluatorService(): EvaluatorService;
|
|
30
|
+
abstract getDeviceCredentialsService(): DeviceCredentialsService;
|
|
30
31
|
abstract cleanup(): Promise<boolean>;
|
|
31
32
|
abstract enableDebugMode(on: boolean): void;
|
|
32
33
|
abstract setDebugLevel(level: IDebugLevel): void;
|
package/esm/RocosSDK.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
|
2
2
|
import { AuthorisedConfig, IBaseService, IDebugLevel, IRocosSDKConfig, ServiceEnum } from './models';
|
|
3
3
|
import { IRocosSDK } from './IRocosSDK';
|
|
4
4
|
import { Logger } from 'loglevel';
|
|
@@ -19,7 +19,7 @@ export declare class RocosSDK implements IRocosSDK {
|
|
|
19
19
|
*/
|
|
20
20
|
getService<T extends IBaseService>(name: ServiceEnum): T;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Gets the authentication service.
|
|
23
23
|
*/
|
|
24
24
|
getAuthService(): AuthService;
|
|
25
25
|
/**
|
|
@@ -126,6 +126,11 @@ export declare class RocosSDK implements IRocosSDK {
|
|
|
126
126
|
* @returns EvaluatorService
|
|
127
127
|
*/
|
|
128
128
|
getEvaluatorService(): EvaluatorService;
|
|
129
|
+
/**
|
|
130
|
+
* Gets the device credentials service.
|
|
131
|
+
* @returns DeviceCredentialsService
|
|
132
|
+
*/
|
|
133
|
+
getDeviceCredentialsService(): DeviceCredentialsService;
|
|
129
134
|
get platformTimeOffset(): number;
|
|
130
135
|
get platformTime(): number;
|
|
131
136
|
/**
|
package/esm/RocosSDK.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, PlatFormTimeService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService, } from './services';
|
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, PlatFormTimeService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService, } from './services';
|
|
2
2
|
import { ServiceEnum } from './models';
|
|
3
3
|
import { RocosLogger } from './logger/RocosLogger';
|
|
4
4
|
import { RocosStore } from './store/RocosStore';
|
|
@@ -101,13 +101,16 @@ export class RocosSDK {
|
|
|
101
101
|
case ServiceEnum.EVALUATOR:
|
|
102
102
|
this.services[name] = new EvaluatorService(config);
|
|
103
103
|
break;
|
|
104
|
+
case ServiceEnum.DEVICE_CREDENTIALS:
|
|
105
|
+
this.services[name] = new DeviceCredentialsService(config);
|
|
106
|
+
break;
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
this.logger.debug(`Found service ${name}.`);
|
|
107
110
|
return this.services[name];
|
|
108
111
|
}
|
|
109
112
|
/**
|
|
110
|
-
*
|
|
113
|
+
* Gets the authentication service.
|
|
111
114
|
*/
|
|
112
115
|
getAuthService() {
|
|
113
116
|
return this.getService(ServiceEnum.AUTH);
|
|
@@ -264,6 +267,13 @@ export class RocosSDK {
|
|
|
264
267
|
getEvaluatorService() {
|
|
265
268
|
return this.getService(ServiceEnum.EVALUATOR);
|
|
266
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Gets the device credentials service.
|
|
272
|
+
* @returns DeviceCredentialsService
|
|
273
|
+
*/
|
|
274
|
+
getDeviceCredentialsService() {
|
|
275
|
+
return this.getService(ServiceEnum.DEVICE_CREDENTIALS);
|
|
276
|
+
}
|
|
267
277
|
get platformTimeOffset() {
|
|
268
278
|
return PlatFormTimeService.getInstance(this.getTimeSyncerService())?.platformTimeOffset;
|
|
269
279
|
}
|
package/esm/constants/api.d.ts
CHANGED
|
@@ -82,8 +82,8 @@ export declare const API_PROJECT_DEFINITION_ACTION_URL = "https://{url}/projects
|
|
|
82
82
|
export declare const API_PROJECT_DEFINITION_BUTTON_URL = "https://{url}/projects/{projectId}/robot-definitions/{definitionId}/buttons";
|
|
83
83
|
export declare const API_PROJECT_DEFINITION_TRIGGER_URL = "https://{url}/projects/{projectId}/robot-definitions/{definitionId}/triggers";
|
|
84
84
|
export declare const API_PROJECT_DEFINITION_GAMEPAD_URL = "https://{url}/projects/{projectId}/robot-definitions/{definitionId}/gamepads";
|
|
85
|
-
export declare const API_PROJECT_DEFINITION_EXPORT = "https://{url}/projects/{projectId}/robot-definitions/{definitionId}/export";
|
|
86
|
-
export declare const API_PROJECT_DEFINITION_IMPORT = "https://{url}/projects/{projectId}/robot-definitions/import";
|
|
85
|
+
export declare const API_PROJECT_DEFINITION_EXPORT = "https://{url}/import-export/projects/{projectId}/robot-definitions/{definitionId}/export";
|
|
86
|
+
export declare const API_PROJECT_DEFINITION_IMPORT = "https://{url}/import-export/projects/{projectId}/robot-definitions/import";
|
|
87
87
|
export declare const API_PROJECT_GROUP_TYPE_URL = "https://{url}/projects/{projectId}/config-groups/{type}";
|
|
88
88
|
export declare const API_PROJECT_GROUP_TYPE_ID_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}";
|
|
89
89
|
export declare const API_PROJECT_GROUP_TYPE_PUBLISH_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/publish";
|
|
@@ -131,3 +131,5 @@ export declare const API_PROJECT_WORKFLOW_ID_URL = "https://{url}/projects/{proj
|
|
|
131
131
|
export declare const API_PROJECT_WORKFLOW_ASSET_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets";
|
|
132
132
|
export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments";
|
|
133
133
|
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
|
134
|
+
export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
|
|
135
|
+
export declare const API_DEVICE_CREDENTIALS_AUTH_URL = "https://{url}/device-credentials/auth";
|
package/esm/constants/api.js
CHANGED
|
@@ -82,8 +82,8 @@ export const API_PROJECT_DEFINITION_ACTION_URL = 'https://{url}/projects/{projec
|
|
|
82
82
|
export const API_PROJECT_DEFINITION_BUTTON_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/buttons';
|
|
83
83
|
export const API_PROJECT_DEFINITION_TRIGGER_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/triggers';
|
|
84
84
|
export const API_PROJECT_DEFINITION_GAMEPAD_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/gamepads';
|
|
85
|
-
export const API_PROJECT_DEFINITION_EXPORT = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/export';
|
|
86
|
-
export const API_PROJECT_DEFINITION_IMPORT = 'https://{url}/projects/{projectId}/robot-definitions/import';
|
|
85
|
+
export const API_PROJECT_DEFINITION_EXPORT = 'https://{url}/import-export/projects/{projectId}/robot-definitions/{definitionId}/export';
|
|
86
|
+
export const API_PROJECT_DEFINITION_IMPORT = 'https://{url}/import-export/projects/{projectId}/robot-definitions/import';
|
|
87
87
|
export const API_PROJECT_GROUP_TYPE_URL = 'https://{url}/projects/{projectId}/config-groups/{type}';
|
|
88
88
|
export const API_PROJECT_GROUP_TYPE_ID_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}';
|
|
89
89
|
export const API_PROJECT_GROUP_TYPE_PUBLISH_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/publish';
|
|
@@ -131,3 +131,5 @@ export const API_PROJECT_WORKFLOW_ID_URL = 'https://{url}/projects/{projectId}/a
|
|
|
131
131
|
export const API_PROJECT_WORKFLOW_ASSET_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets';
|
|
132
132
|
export const API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments';
|
|
133
133
|
export const API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
|
134
|
+
export const API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
|
|
135
|
+
export const API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
|
package/esm/models/RocosError.js
CHANGED
|
@@ -24,6 +24,7 @@ export const errorCodes = {
|
|
|
24
24
|
MAPS_SERVICE_ERROR: 'MAPS_SERVICE_ERROR',
|
|
25
25
|
EVALUATOR_SERVICE_ERROR: 'EVALUATOR_SERVICE_ERROR',
|
|
26
26
|
WEBRTC_SERVICE_ERROR: 'WEBRTC_SERVICE_ERROR',
|
|
27
|
+
DEVICE_CREDENTIALS_SERVICE_ERROR: 'DEVICE_CREDENTIALS_SERVICE_ERROR',
|
|
27
28
|
};
|
|
28
29
|
export class RocosError extends Error {
|
|
29
30
|
constructor(err, code, statusCode) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface DeviceCredentials {
|
|
2
|
+
[component: string]: {
|
|
3
|
+
[system: string]: DeviceCredential;
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
export interface DeviceCredential {
|
|
7
|
+
/**
|
|
8
|
+
* Device ID or username
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Device secret or password
|
|
13
|
+
*/
|
|
14
|
+
key: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DeviceCredentialCreate {
|
|
17
|
+
/**
|
|
18
|
+
* Will automatically be generated if not provided
|
|
19
|
+
*/
|
|
20
|
+
id?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Will automatically be generated if not provided
|
|
23
|
+
*/
|
|
24
|
+
key?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The agent component the credentials are for e.g. dji, spot, etc.
|
|
27
|
+
*/
|
|
28
|
+
component: string;
|
|
29
|
+
/**
|
|
30
|
+
* The system the credentials are for e.g. mqtt, rtmp, etc.
|
|
31
|
+
*/
|
|
32
|
+
system: string;
|
|
33
|
+
}
|
|
34
|
+
export interface DeviceCredentialAuth extends DeviceCredential {
|
|
35
|
+
/**
|
|
36
|
+
* The agent component the credentials are for e.g. dji, spot, etc.
|
|
37
|
+
*/
|
|
38
|
+
component: string;
|
|
39
|
+
/**
|
|
40
|
+
* The system the credentials are for e.g. mqtt, rtmp, etc.
|
|
41
|
+
*/
|
|
42
|
+
system: string;
|
|
43
|
+
}
|
|
44
|
+
export interface DeviceCredentialAuthResult {
|
|
45
|
+
result: 'allow' | 'deny';
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EvaluatorService, ScheduleService } from '../services';
|
|
1
|
+
import { DeviceCredentialsService, EvaluatorService, ScheduleService } from '../services';
|
|
2
2
|
import { IBaseService, ServiceEnum } from '../models';
|
|
3
3
|
import { CallerServiceNode } from '../services/CallerServiceNode';
|
|
4
4
|
import { CommandServiceNode } from '../services/CommandServiceNode';
|
|
@@ -48,4 +48,5 @@ export declare class RocosSDKNode extends RocosSDK {
|
|
|
48
48
|
* @deprecated Not supported in Node.js
|
|
49
49
|
*/
|
|
50
50
|
getRTPWebRTCService(): never;
|
|
51
|
+
getDeviceCredentialsService(): DeviceCredentialsService;
|
|
51
52
|
}
|
package/esm/node/RocosSDKNode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetStorageService, AuthService, ConfigGroupService, DashboardService, EventService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, ScheduleService, SpotProvisioningServiceNode, StreamService, UserService, } from '../services';
|
|
1
|
+
import { AssetStorageService, AuthService, ConfigGroupService, DashboardService, DeviceCredentialsService, EventService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, ScheduleService, SpotProvisioningServiceNode, StreamService, UserService, } from '../services';
|
|
2
2
|
import { ServiceEnum } from '../models';
|
|
3
3
|
import { CallerServiceNode } from '../services/CallerServiceNode';
|
|
4
4
|
import { CommandServiceNode } from '../services/CommandServiceNode';
|
|
@@ -78,6 +78,9 @@ export class RocosSDKNode extends RocosSDK {
|
|
|
78
78
|
case ServiceEnum.MAP:
|
|
79
79
|
this.services[name] = new MapService(config);
|
|
80
80
|
break;
|
|
81
|
+
case ServiceEnum.DEVICE_CREDENTIALS:
|
|
82
|
+
this.services[name] = new DeviceCredentialsService(config);
|
|
83
|
+
break;
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
this.logger.debug(`Found service ${name}.`);
|
|
@@ -140,4 +143,7 @@ export class RocosSDKNode extends RocosSDK {
|
|
|
140
143
|
getRTPWebRTCService() {
|
|
141
144
|
throw new Error('WebRTC service is not supported in NodeJS');
|
|
142
145
|
}
|
|
146
|
+
getDeviceCredentialsService() {
|
|
147
|
+
return this.getService(ServiceEnum.DEVICE_CREDENTIALS);
|
|
148
|
+
}
|
|
143
149
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DeviceCredentialAuth, DeviceCredentialAuthResult, DeviceCredentialCreate, DeviceCredentials } from '../models/device-credentials/DeviceCredentials';
|
|
2
|
+
import { IBaseService, IRocosSDKConfig, RocosError } from '../models';
|
|
3
|
+
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
4
|
+
/**
|
|
5
|
+
* Manage external devices authenticating with the platform
|
|
6
|
+
*/
|
|
7
|
+
export declare class DeviceCredentialsService extends BaseServiceAbstract implements IBaseService {
|
|
8
|
+
constructor(config: IRocosSDKConfig);
|
|
9
|
+
getStatus(): boolean;
|
|
10
|
+
protected getError(e: Error): RocosError;
|
|
11
|
+
list(projectId: string, callsign: string): Promise<DeviceCredentials>;
|
|
12
|
+
create(projectId: string, callsign: string, credentials: DeviceCredentialCreate): Promise<DeviceCredentialCreate>;
|
|
13
|
+
delete(projectId: string, callsign: string, component: string, system: string): Promise<void>;
|
|
14
|
+
auth(credentials: DeviceCredentialAuth): Promise<DeviceCredentialAuthResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { API_DEVICE_CREDENTIALS_AUTH_URL, API_DEVICE_CREDENTIALS_URL } from '../constants/api';
|
|
2
|
+
import { RocosError, errorCodes } from '../models';
|
|
3
|
+
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
4
|
+
import { RocosLogger } from '../logger/RocosLogger';
|
|
5
|
+
import { formatServiceUrl } from '../helpers/formatServiceUrl';
|
|
6
|
+
/**
|
|
7
|
+
* Manage external devices authenticating with the platform
|
|
8
|
+
*/
|
|
9
|
+
export class DeviceCredentialsService extends BaseServiceAbstract {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
this.logger = RocosLogger.getInstance(`DeviceCredentials(${this.config.url})`);
|
|
13
|
+
}
|
|
14
|
+
getStatus() {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
getError(e) {
|
|
18
|
+
return new RocosError(e, errorCodes.DEVICE_CREDENTIALS_SERVICE_ERROR);
|
|
19
|
+
}
|
|
20
|
+
list(projectId, callsign) {
|
|
21
|
+
return this.callGet(formatServiceUrl(API_DEVICE_CREDENTIALS_URL, {
|
|
22
|
+
url: this.config.url,
|
|
23
|
+
projectId,
|
|
24
|
+
callsign,
|
|
25
|
+
}, this.config.insecure), 'Failed to get device credentials.');
|
|
26
|
+
}
|
|
27
|
+
create(projectId, callsign, credentials) {
|
|
28
|
+
return this.callPost(formatServiceUrl(API_DEVICE_CREDENTIALS_URL, {
|
|
29
|
+
url: this.config.url,
|
|
30
|
+
projectId,
|
|
31
|
+
callsign,
|
|
32
|
+
}, this.config.insecure), credentials, 'Failed to create device credentials.');
|
|
33
|
+
}
|
|
34
|
+
delete(projectId, callsign, component, system) {
|
|
35
|
+
return this.callDelete(formatServiceUrl(API_DEVICE_CREDENTIALS_URL, {
|
|
36
|
+
url: this.config.url,
|
|
37
|
+
projectId,
|
|
38
|
+
callsign,
|
|
39
|
+
}, this.config.insecure), 'Failed to delete device credentials.', { component, system });
|
|
40
|
+
}
|
|
41
|
+
auth(credentials) {
|
|
42
|
+
return this.callPost(formatServiceUrl(API_DEVICE_CREDENTIALS_AUTH_URL, {
|
|
43
|
+
url: this.config.url,
|
|
44
|
+
}, this.config.insecure), credentials, 'Failed to delete device credentials.');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -2,7 +2,7 @@ import { IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
|
|
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
3
3
|
import { Observation } from '../models/maps/Panorama';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Maps service for managing robot maps in the cloud and on robots
|
|
6
6
|
*/
|
|
7
7
|
export declare class MapService extends BaseServiceAbstract implements IBaseService {
|
|
8
8
|
constructor(config: IRocosSDKConfig);
|
|
@@ -4,7 +4,7 @@ import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
|
4
4
|
import { RocosLogger } from '../logger/RocosLogger';
|
|
5
5
|
import { formatServiceUrl } from '../helpers/formatServiceUrl';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Maps service for managing robot maps in the cloud and on robots
|
|
8
8
|
*/
|
|
9
9
|
export class MapService extends BaseServiceAbstract {
|
|
10
10
|
constructor(config) {
|
|
@@ -249,10 +249,11 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
|
249
249
|
* @param projectId - Project Id
|
|
250
250
|
* @param profileData - Robot definition data
|
|
251
251
|
* @param newName - Optional new name for the robot definition. If not provided, the name from the imported definition will be used.
|
|
252
|
+
* @param newDescription - Optional new description for the robot definition. If not provided, the description from the imported definition will be used.
|
|
252
253
|
*
|
|
253
254
|
* @see export
|
|
254
255
|
*/
|
|
255
|
-
import(projectId: string, profileData:
|
|
256
|
+
import(projectId: string, profileData: Blob | File, newName?: string, newDescription?: string): Promise<{
|
|
256
257
|
profileId: string;
|
|
257
258
|
}>;
|
|
258
259
|
/**
|
|
@@ -364,14 +364,20 @@ export class ProfileService extends BaseServiceAbstract {
|
|
|
364
364
|
* @param projectId - Project Id
|
|
365
365
|
* @param profileData - Robot definition data
|
|
366
366
|
* @param newName - Optional new name for the robot definition. If not provided, the name from the imported definition will be used.
|
|
367
|
+
* @param newDescription - Optional new description for the robot definition. If not provided, the description from the imported definition will be used.
|
|
367
368
|
*
|
|
368
369
|
* @see export
|
|
369
370
|
*/
|
|
370
|
-
async import(projectId, profileData, newName) {
|
|
371
|
+
async import(projectId, profileData, newName, newDescription) {
|
|
372
|
+
const formData = new FormData();
|
|
371
373
|
if (newName) {
|
|
372
|
-
|
|
374
|
+
formData.append('name', newName);
|
|
373
375
|
}
|
|
374
|
-
|
|
376
|
+
if (newDescription) {
|
|
377
|
+
formData.append('description', newDescription);
|
|
378
|
+
}
|
|
379
|
+
formData.append('file', profileData);
|
|
380
|
+
return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_IMPORT, { url: this.config.url, projectId }, this.config.insecure), formData, `Failed to import robot definition for ${projectId}.`);
|
|
375
381
|
}
|
|
376
382
|
/**
|
|
377
383
|
* Update gamepads for a robot definition
|
package/esm/services/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './CommandService';
|
|
|
5
5
|
export * from './ConfigGroupService';
|
|
6
6
|
export * from './ControlService';
|
|
7
7
|
export * from './DashboardService';
|
|
8
|
+
export * from './DeviceCredentialsService';
|
|
8
9
|
export * from './EventService';
|
|
9
10
|
export * from './FileAccessorService';
|
|
10
11
|
export * from './IntegrationService';
|
package/esm/services/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './CommandService';
|
|
|
5
5
|
export * from './ConfigGroupService';
|
|
6
6
|
export * from './ControlService';
|
|
7
7
|
export * from './DashboardService';
|
|
8
|
+
export * from './DeviceCredentialsService';
|
|
8
9
|
export * from './EventService';
|
|
9
10
|
export * from './FileAccessorService';
|
|
10
11
|
export * from './IntegrationService';
|