@dronedeploy/rocos-js-sdk 3.0.16 → 3.0.18
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 +2 -1
- package/cjs/RocosSDK.js +6 -0
- package/cjs/constants/api.d.ts +6 -0
- package/cjs/constants/api.js +10 -3
- package/cjs/models/ConnectionStatus.d.ts +6 -0
- package/cjs/models/ConnectionStatus.js +2 -0
- package/cjs/models/IRobot.d.ts +5 -0
- package/cjs/models/RocosError.d.ts +1 -0
- package/cjs/models/RocosError.js +1 -0
- package/cjs/models/ServiceEnum.d.ts +1 -0
- package/cjs/models/ServiceEnum.js +1 -0
- package/cjs/models/index.d.ts +1 -0
- package/cjs/models/index.js +1 -0
- package/cjs/models/params/ICallerParams.d.ts +1 -0
- package/cjs/models/tag/Tag.d.ts +11 -0
- package/cjs/models/tag/Tag.js +2 -0
- package/cjs/services/CallerService.js +11 -27
- package/cjs/services/EnvironmentService.d.ts +7 -0
- package/cjs/services/EnvironmentService.js +7 -0
- package/cjs/services/RobotService.d.ts +7 -1
- package/cjs/services/RobotService.js +9 -0
- package/cjs/services/TagService.d.ts +14 -0
- package/cjs/services/TagService.js +48 -0
- 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 +2 -1
- package/esm/RocosSDK.js +7 -1
- package/esm/constants/api.d.ts +6 -0
- package/esm/constants/api.js +6 -0
- package/esm/models/ConnectionStatus.d.ts +6 -0
- package/esm/models/ConnectionStatus.js +1 -0
- package/esm/models/IRobot.d.ts +5 -0
- package/esm/models/RocosError.d.ts +1 -0
- package/esm/models/RocosError.js +1 -0
- package/esm/models/ServiceEnum.d.ts +1 -0
- package/esm/models/ServiceEnum.js +1 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/params/ICallerParams.d.ts +1 -0
- package/esm/models/tag/Tag.d.ts +11 -0
- package/esm/models/tag/Tag.js +1 -0
- package/esm/services/CallerService.js +12 -28
- package/esm/services/EnvironmentService.d.ts +7 -0
- package/esm/services/EnvironmentService.js +7 -0
- package/esm/services/RobotService.d.ts +7 -1
- package/esm/services/RobotService.js +10 -1
- package/esm/services/TagService.d.ts +14 -0
- package/esm/services/TagService.js +44 -0
- 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, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TargetService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TagService, TargetService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
2
2
|
import { IBaseService, IDebugLevel, ServiceEnum } from './models';
|
3
3
|
export declare abstract class IRocosSDK {
|
4
4
|
abstract getService<T extends IBaseService>(_name: ServiceEnum): T;
|
@@ -29,6 +29,7 @@ export declare abstract class IRocosSDK {
|
|
29
29
|
abstract getEvaluatorService(): EvaluatorService;
|
30
30
|
abstract getDeviceCredentialsService(): DeviceCredentialsService;
|
31
31
|
abstract getTargetService(): TargetService;
|
32
|
+
abstract getTagService(): TagService;
|
32
33
|
abstract cleanup(): Promise<boolean>;
|
33
34
|
abstract enableDebugMode(on: boolean): void;
|
34
35
|
abstract setDebugLevel(level: IDebugLevel): void;
|
package/cjs/RocosSDK.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TargetService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TagService, TargetService, 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';
|
@@ -140,6 +140,7 @@ export declare class RocosSDK implements IRocosSDK {
|
|
140
140
|
* @returns AssetService
|
141
141
|
*/
|
142
142
|
getTargetService(): TargetService;
|
143
|
+
getTagService(): TagService;
|
143
144
|
get platformTimeOffset(): number;
|
144
145
|
get platformTime(): number;
|
145
146
|
/**
|
package/cjs/RocosSDK.js
CHANGED
@@ -113,6 +113,9 @@ class RocosSDK {
|
|
113
113
|
case models_1.ServiceEnum.TARGET:
|
114
114
|
this.services[name] = new services_1.TargetService(config);
|
115
115
|
break;
|
116
|
+
case models_1.ServiceEnum.TAG:
|
117
|
+
this.services[name] = new services_1.TagService(config);
|
118
|
+
break;
|
116
119
|
}
|
117
120
|
}
|
118
121
|
this.logger.debug(`Found service ${name}.`);
|
@@ -296,6 +299,9 @@ class RocosSDK {
|
|
296
299
|
getTargetService() {
|
297
300
|
return this.getService(models_1.ServiceEnum.TARGET);
|
298
301
|
}
|
302
|
+
getTagService() {
|
303
|
+
return this.getService(models_1.ServiceEnum.TAG);
|
304
|
+
}
|
299
305
|
get platformTimeOffset() {
|
300
306
|
return services_1.PlatFormTimeService.getInstance(this.getTimeSyncerService())?.platformTimeOffset;
|
301
307
|
}
|
package/cjs/constants/api.d.ts
CHANGED
@@ -42,6 +42,7 @@ export declare const API_PROJECT_MISSION_ASSET_PATH_URL = "https://{url}/project
|
|
42
42
|
export declare const API_PROJECT_MAPPED_ASSETS_PATH_URL = "https://{url}/projects/{projectId}/mappedassets";
|
43
43
|
export declare const API_PROJECT_MAPPED_ASSET_PATH_URL = "https://{url}/projects/{projectId}/mappedassets/{assetId}";
|
44
44
|
export declare const API_PROJECT_ROBOT_URL = "https://{url}/projects/{projectId}/robots";
|
45
|
+
export declare const API_ACCOUNT_ROBOT_URL = "https://{url}/accounts/{accountId}/robots";
|
45
46
|
export declare const API_PROJECT_ROBOT_ID_URL = "https://{url}/projects/{projectId}/robots/{callsign}";
|
46
47
|
export declare const API_PROJECT_ROBOT_ATTRIBUTES_URL = "https://{url}/projects/{projectId}/robots/{callsign}/attributes";
|
47
48
|
export declare const API_PROJECT_ROBOT_DEFINITION_URL = "https://{url}/projects/{projectId}/robots/{callsign}/robot-definitions";
|
@@ -147,3 +148,8 @@ export declare const API_PROJECT_WORKFLOW_IMPORT_URL = "https://{url}/projects/{
|
|
147
148
|
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
148
149
|
export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
|
149
150
|
export declare const API_DEVICE_CREDENTIALS_AUTH_URL = "https://{url}/device-credentials/auth";
|
151
|
+
export declare const API_PROJECT_ROBOT_TAGS_URL = "https://{url}/projects/{projectId}/robots/{callsign}/tags";
|
152
|
+
export declare const API_PROJECT_TAG_ROBOTS_URL = "https://{url}/projects/{projectId}/tags/{tag}/robots";
|
153
|
+
export declare const API_PROJECT_PROFILE_TAGS_URL = "https://{url}/projects/{projectId}/profiles/{profileId}/tags";
|
154
|
+
export declare const API_PROJECT_PROFILE_TAG_URL = "https://{url}/projects/{projectId}/profiles/{profileId}/tags/{tag}";
|
155
|
+
export declare const API_PROJECT_ROBOT_TAG_URL = "https://{url}/projects/{projectId}/robots/{callsign}/tags/{tag}";
|
package/cjs/constants/api.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.
|
5
|
-
exports.API_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_WORKFLOW_IMPORT_URL = exports.API_PROJECT_WORKFLOW_EXPORT_URL = exports.API_PROJECT_WORKFLOW_AFFECTED_URL = exports.API_PROJECT_ROBOT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_PROFILE_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_ROBOT_NO_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_ROBOT_DEPLOYMENTS_URL = exports.API_PROJECT_WORKFLOW_ASSET_ID_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_GRAPHS_ASSETS_URL = exports.API_GRAPHS_ASSETS_UPLOAD_URL = exports.API_GRAPHS_TARGETS_URL = exports.API_GRAPHS_TARGET_UPLOAD_URL = exports.API_GRAPHS_OBSERVATION_KEYS_URL = exports.API_GRAPHS_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA = exports.API_GRAPHS_MAPS_GEOJSON_URL = exports.API_GRAPHS_MAPS_DEPLOY_URL = exports.API_GRAPHS_MAPS_COPY_URL = exports.API_GRAPHS_MAP_ID_URL = exports.API_GRAPHS_MAPS_MERGE_URL = exports.API_GRAPHS_MAPS_DEPLOYED_URL = exports.API_GRAPHS_MAPS_URL = exports.API_DD_INTEGRATION_LOCATIONS_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;
|
3
|
+
exports.API_PROJECT_ROBOT_EVENT_URL = 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_ACCOUNT_ROBOT_URL = exports.API_PROJECT_ROBOT_URL = exports.API_PROJECT_MAPPED_ASSET_PATH_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_EXTERNAL_PROJECTS_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_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_OTP_AUTH_URL = exports.API_OTP_URL = exports.API_USER_TOKEN_URL = exports.API_USER_URL = exports.API_ADMIN_USER_INVITATION_URL = exports.API_APPLICATION_AUTH_URL = void 0;
|
4
|
+
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_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_ENVIRONMENT_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_CONFIGS_CONNECTION_URL = exports.API_PROJECT_ROBOT_CONFIGS_CONNECTIONS_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 = void 0;
|
5
|
+
exports.API_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_WORKFLOW_IMPORT_URL = exports.API_PROJECT_WORKFLOW_EXPORT_URL = exports.API_PROJECT_WORKFLOW_AFFECTED_URL = exports.API_PROJECT_ROBOT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_PROFILE_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_ROBOT_NO_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_ROBOT_DEPLOYMENTS_URL = exports.API_PROJECT_WORKFLOW_ASSET_ID_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_GRAPHS_ASSETS_URL = exports.API_GRAPHS_ASSETS_UPLOAD_URL = exports.API_GRAPHS_TARGETS_URL = exports.API_GRAPHS_TARGET_UPLOAD_URL = exports.API_GRAPHS_OBSERVATION_KEYS_URL = exports.API_GRAPHS_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA = exports.API_GRAPHS_MAPS_GEOJSON_URL = exports.API_GRAPHS_MAPS_DEPLOY_URL = exports.API_GRAPHS_MAPS_COPY_URL = exports.API_GRAPHS_MAP_ID_URL = exports.API_GRAPHS_MAPS_MERGE_URL = exports.API_GRAPHS_MAPS_DEPLOYED_URL = exports.API_GRAPHS_MAPS_URL = exports.API_DD_INTEGRATION_LOCATIONS_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 = exports.API_PROJECT_ROBOT_DASHBOARD_ID_URL = void 0;
|
6
|
+
exports.API_PROJECT_ROBOT_TAG_URL = exports.API_PROJECT_PROFILE_TAG_URL = exports.API_PROJECT_PROFILE_TAGS_URL = exports.API_PROJECT_TAG_ROBOTS_URL = exports.API_PROJECT_ROBOT_TAGS_URL = void 0;
|
6
7
|
exports.API_APPLICATION_AUTH_URL = 'https://{url}/applications/auth';
|
7
8
|
exports.API_ADMIN_USER_INVITATION_URL = 'https://{url}/admin/users/invitations';
|
8
9
|
exports.API_USER_URL = 'https://{url}/users';
|
@@ -47,6 +48,7 @@ exports.API_PROJECT_MISSION_ASSET_PATH_URL = 'https://{url}/projects/{projectId}
|
|
47
48
|
exports.API_PROJECT_MAPPED_ASSETS_PATH_URL = 'https://{url}/projects/{projectId}/mappedassets';
|
48
49
|
exports.API_PROJECT_MAPPED_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/mappedassets/{assetId}';
|
49
50
|
exports.API_PROJECT_ROBOT_URL = 'https://{url}/projects/{projectId}/robots';
|
51
|
+
exports.API_ACCOUNT_ROBOT_URL = 'https://{url}/accounts/{accountId}/robots';
|
50
52
|
exports.API_PROJECT_ROBOT_ID_URL = 'https://{url}/projects/{projectId}/robots/{callsign}';
|
51
53
|
exports.API_PROJECT_ROBOT_ATTRIBUTES_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/attributes';
|
52
54
|
exports.API_PROJECT_ROBOT_DEFINITION_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/robot-definitions';
|
@@ -152,3 +154,8 @@ exports.API_PROJECT_WORKFLOW_IMPORT_URL = 'https://{url}/projects/{projectId}/au
|
|
152
154
|
exports.API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
153
155
|
exports.API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
|
154
156
|
exports.API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
|
157
|
+
exports.API_PROJECT_ROBOT_TAGS_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/tags';
|
158
|
+
exports.API_PROJECT_TAG_ROBOTS_URL = 'https://{url}/projects/{projectId}/tags/{tag}/robots';
|
159
|
+
exports.API_PROJECT_PROFILE_TAGS_URL = 'https://{url}/projects/{projectId}/profiles/{profileId}/tags';
|
160
|
+
exports.API_PROJECT_PROFILE_TAG_URL = 'https://{url}/projects/{projectId}/profiles/{profileId}/tags/{tag}';
|
161
|
+
exports.API_PROJECT_ROBOT_TAG_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/tags/{tag}';
|
package/cjs/models/IRobot.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ConnectionStatus } from './ConnectionStatus';
|
1
2
|
import { RobotModeType } from './types';
|
2
3
|
export interface IRobot {
|
3
4
|
tags?: string[];
|
@@ -16,3 +17,7 @@ export interface IRobot {
|
|
16
17
|
robotDefinitionName?: string;
|
17
18
|
robotDefinitionTags?: string[];
|
18
19
|
}
|
20
|
+
export type IRobotListItem = IRobot & {
|
21
|
+
linkedProjectId?: string;
|
22
|
+
connection?: ConnectionStatus;
|
23
|
+
};
|
package/cjs/models/RocosError.js
CHANGED
@@ -30,6 +30,7 @@ exports.errorCodes = {
|
|
30
30
|
DEVICE_CREDENTIALS_SERVICE_ERROR: 'DEVICE_CREDENTIALS_SERVICE_ERROR',
|
31
31
|
TARGET_SERVICE_ERROR: 'TARGET_SERVICE_ERROR',
|
32
32
|
ENVIRONMENT_SERVICE_ERROR: 'ENVIRONMENT_SERVICE_ERROR',
|
33
|
+
TAG_SERVICE_ERROR: 'TAG_SERVICE_ERROR',
|
33
34
|
};
|
34
35
|
class RocosError extends Error {
|
35
36
|
constructor(err, code, statusCode) {
|
@@ -26,6 +26,7 @@ var ServiceEnum;
|
|
26
26
|
ServiceEnum["SEARCH"] = "search";
|
27
27
|
ServiceEnum["SPOT_PROVISIONER"] = "spot_provisioner";
|
28
28
|
ServiceEnum["STREAM"] = "stream";
|
29
|
+
ServiceEnum["TAG"] = "tag";
|
29
30
|
ServiceEnum["TARGET"] = "target";
|
30
31
|
ServiceEnum["TELEMETRY"] = "telemetry";
|
31
32
|
ServiceEnum["TIME_SYNCER"] = "time_syncer";
|
package/cjs/models/index.d.ts
CHANGED
@@ -37,6 +37,7 @@ export * from './maps/Panorama';
|
|
37
37
|
export * from './projects/ProjectUser';
|
38
38
|
export * from './projects/ExternalProject';
|
39
39
|
export * from './projects/NewProjectRequest';
|
40
|
+
export * from './tag/Tag';
|
40
41
|
export * from './target/Target';
|
41
42
|
export * from './ExportDataQuery';
|
42
43
|
export * from './HttpError';
|
package/cjs/models/index.js
CHANGED
@@ -53,6 +53,7 @@ __exportStar(require("./maps/Panorama"), exports);
|
|
53
53
|
__exportStar(require("./projects/ProjectUser"), exports);
|
54
54
|
__exportStar(require("./projects/ExternalProject"), exports);
|
55
55
|
__exportStar(require("./projects/NewProjectRequest"), exports);
|
56
|
+
__exportStar(require("./tag/Tag"), exports);
|
56
57
|
__exportStar(require("./target/Target"), exports);
|
57
58
|
__exportStar(require("./ExportDataQuery"), exports);
|
58
59
|
__exportStar(require("./HttpError"), exports);
|
@@ -8,40 +8,22 @@ const callerMessageHelpers_1 = require("../helpers/callerMessageHelpers");
|
|
8
8
|
const BaseStreamService_1 = require("./BaseStreamService");
|
9
9
|
const CallerStream_1 = require("../api/streams/caller/CallerStream");
|
10
10
|
const identifier_1 = require("../constants/identifier");
|
11
|
-
const
|
11
|
+
const helpers_1 = require("../helpers");
|
12
12
|
const uuid_1 = require("uuid");
|
13
13
|
class CallerService extends BaseStreamService_1.BaseStreamService {
|
14
14
|
constructor(config) {
|
15
15
|
super('CallerService', config);
|
16
16
|
}
|
17
17
|
invokeRequest(params) {
|
18
|
-
|
19
|
-
let subscription;
|
20
|
-
this.createStream()
|
21
|
-
.then((stream) => {
|
22
|
-
subscription = stream.invokeRequest(params).subscribe(subject);
|
23
|
-
})
|
24
|
-
.catch((e) => {
|
18
|
+
return (0, rxjs_1.from)(this.createStream()).pipe((0, rxjs_1.switchMap)((stream) => stream.invokeRequest(params)), (0, operators_1.catchError)((e) => {
|
25
19
|
this.logger.info('invokeRequest error', e);
|
26
|
-
|
27
|
-
});
|
28
|
-
return subject.asObservable().pipe((0, operators_1.finalize)(() => {
|
29
|
-
subscription?.unsubscribe();
|
20
|
+
return (0, rxjs_1.throwError)(() => e);
|
30
21
|
}));
|
31
22
|
}
|
32
23
|
cancelRequest(params) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
.then((stream) => {
|
37
|
-
subscription = stream.cancelRequest(params).subscribe(subject);
|
38
|
-
})
|
39
|
-
.catch((e) => {
|
40
|
-
this.logger.info('invokeRequest error', e);
|
41
|
-
subject.error(e);
|
42
|
-
});
|
43
|
-
return subject.asObservable().pipe((0, operators_1.finalize)(() => {
|
44
|
-
subscription?.unsubscribe();
|
24
|
+
return (0, rxjs_1.from)(this.createStream()).pipe((0, rxjs_1.switchMap)((stream) => stream.cancelRequest(params)), (0, operators_1.catchError)((e) => {
|
25
|
+
this.logger.info('cancelRequest error', e);
|
26
|
+
return (0, rxjs_1.throwError)(() => e);
|
45
27
|
}));
|
46
28
|
}
|
47
29
|
/** Call a service and return the response(s).
|
@@ -55,8 +37,10 @@ class CallerService extends BaseStreamService_1.BaseStreamService {
|
|
55
37
|
* @see call
|
56
38
|
*/
|
57
39
|
callRaw(params) {
|
58
|
-
const { component, topic } = (0,
|
59
|
-
const payloadString =
|
40
|
+
const { component, topic } = (0, helpers_1.splitRobotTopic)(params.source);
|
41
|
+
const payloadString = params.options?.rawPayload
|
42
|
+
? String(params.payload ?? '')
|
43
|
+
: JSON.stringify(params.payload ?? {});
|
60
44
|
const source$ = this.invokeRequest({
|
61
45
|
uid: params.options?.uid ?? (0, uuid_1.v4)(),
|
62
46
|
projectId: params.projectId,
|
@@ -67,7 +51,7 @@ class CallerService extends BaseStreamService_1.BaseStreamService {
|
|
67
51
|
responseLevelNumber: models_1.RocosResponseLevel.ALL,
|
68
52
|
payload: payloadString,
|
69
53
|
query: params.options?.query,
|
70
|
-
}).pipe((0, rxjs_1.mergeMap)(callerMessageHelpers_1.getResponses), (0, callerMessageHelpers_1.handleChunkedMessages)());
|
54
|
+
}).pipe((0, rxjs_1.mergeMap)(callerMessageHelpers_1.getResponses), (0, callerMessageHelpers_1.handleChunkedMessages)(), (0, rxjs_1.share)());
|
71
55
|
const result$ = source$.pipe((0, operators_1.filter)((x) => x.result !== undefined), (0, rxjs_1.map)((x) => x.result), (0, rxjs_1.take)(1));
|
72
56
|
const resultNotifier$ = result$.pipe((0, rxjs_1.map)((x) => {
|
73
57
|
if (x.status !== models_1.ResultStatus.COMPLETE_SUCCESS)
|
@@ -17,12 +17,19 @@ export declare class EnvironmentService extends BaseServiceAbstract implements I
|
|
17
17
|
* Set Environment
|
18
18
|
*
|
19
19
|
* @param projectId - Project Id
|
20
|
+
* @param scene - The complete scene to be stored.
|
21
|
+
* CAUTION: This will delete the existing environment and create
|
22
|
+
* a new one. Think of this as a "reset" for the environment.
|
23
|
+
* This will cause ALL edges to other objects (assets, panos, etc) to be removed.
|
20
24
|
*/
|
21
25
|
set(projectId: string, scene: unknown): Promise<void>;
|
22
26
|
/**
|
23
27
|
* Update Environment
|
24
28
|
*
|
25
29
|
* @param projectId - Project Id
|
30
|
+
* @param scene - The new complete scene to be stored.
|
31
|
+
* This will update the environment with the new scene. Any nodes or edges
|
32
|
+
* not in this scene will be droppend and their edges will be removed.
|
26
33
|
*/
|
27
34
|
update(projectId: string, scene: unknown): Promise<void>;
|
28
35
|
/**
|
@@ -32,6 +32,10 @@ class EnvironmentService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
32
32
|
* Set Environment
|
33
33
|
*
|
34
34
|
* @param projectId - Project Id
|
35
|
+
* @param scene - The complete scene to be stored.
|
36
|
+
* CAUTION: This will delete the existing environment and create
|
37
|
+
* a new one. Think of this as a "reset" for the environment.
|
38
|
+
* This will cause ALL edges to other objects (assets, panos, etc) to be removed.
|
35
39
|
*/
|
36
40
|
async set(projectId, scene) {
|
37
41
|
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ENVIRONMENT_URL, { url: this.config.url, projectId }, this.config.insecure), scene, `Failed to set environment for ${projectId}.`);
|
@@ -40,6 +44,9 @@ class EnvironmentService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
40
44
|
* Update Environment
|
41
45
|
*
|
42
46
|
* @param projectId - Project Id
|
47
|
+
* @param scene - The new complete scene to be stored.
|
48
|
+
* This will update the environment with the new scene. Any nodes or edges
|
49
|
+
* not in this scene will be droppend and their edges will be removed.
|
43
50
|
*/
|
44
51
|
async update(projectId, scene) {
|
45
52
|
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ENVIRONMENT_URL, { url: this.config.url, projectId }, this.config.insecure), scene, `Failed to update environment for ${projectId}.`);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IBaseService, IConnectedCallsign, IRobot, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
|
1
|
+
import { IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
3
|
export declare class RobotService extends BaseServiceAbstract implements IBaseService {
|
4
4
|
constructor(config: IRocosSDKConfig);
|
@@ -10,6 +10,12 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
|
|
10
10
|
* @param projectId - Project Id
|
11
11
|
*/
|
12
12
|
getRobots(projectId: string): Promise<IRobot[]>;
|
13
|
+
/**
|
14
|
+
* Get a list of robots by account id.
|
15
|
+
*
|
16
|
+
* @param accountId - Account Id
|
17
|
+
*/
|
18
|
+
getRobotsByAccountId(accountId: string): Promise<IRobotListItem[]>;
|
13
19
|
/**
|
14
20
|
* Create a new robot.
|
15
21
|
*
|
@@ -27,6 +27,15 @@ class RobotService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
27
27
|
const data = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_URL, { url: this.config.url, projectId }, this.config.insecure), `Failed to get robots list for ${projectId}.`);
|
28
28
|
return data.map((item) => (0, cleanObject_1.cleanObject)(new models_1.Robot(item)));
|
29
29
|
}
|
30
|
+
/**
|
31
|
+
* Get a list of robots by account id.
|
32
|
+
*
|
33
|
+
* @param accountId - Account Id
|
34
|
+
*/
|
35
|
+
async getRobotsByAccountId(accountId) {
|
36
|
+
const data = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ACCOUNT_ROBOT_URL, { url: this.config.url, accountId }, this.config.insecure), `Failed to get robots list for organization: ${accountId}.`);
|
37
|
+
return data;
|
38
|
+
}
|
30
39
|
/**
|
31
40
|
* Create a new robot.
|
32
41
|
*
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { IBaseService, IRocosSDKConfig, RobotsByTagResponse, RocosError, TagResponse } from '../models';
|
2
|
+
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
|
+
export declare class TagService extends BaseServiceAbstract implements IBaseService {
|
4
|
+
constructor(config: IRocosSDKConfig);
|
5
|
+
getStatus(): boolean;
|
6
|
+
getTagsByRobot(projectId: string, callsign: string): Promise<TagResponse>;
|
7
|
+
getRobotsByTag(projectId: string, tag: string): Promise<RobotsByTagResponse>;
|
8
|
+
getTagsByProfileId(projectId: string, profileId: string): Promise<TagResponse>;
|
9
|
+
createTagForRobot(projectId: string, callsign: string, tag: string): Promise<void>;
|
10
|
+
deleteTagForRobot(projectId: string, callsign: string, tag: string): Promise<void>;
|
11
|
+
createTagForProfile(projectId: string, profileId: string, tag: string): Promise<void>;
|
12
|
+
deleteTagForProfile(projectId: string, profileId: string, tag: string): Promise<void>;
|
13
|
+
protected getError(e: Error): RocosError;
|
14
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TagService = 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
|
+
class TagService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
10
|
+
constructor(config) {
|
11
|
+
super(config);
|
12
|
+
this.logger = RocosLogger_1.RocosLogger.getInstance(`TagService(${this.config.url})`);
|
13
|
+
}
|
14
|
+
getStatus() {
|
15
|
+
return true;
|
16
|
+
}
|
17
|
+
async getTagsByRobot(projectId, callsign) {
|
18
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_TAGS_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), `Failed to get tags for robot ${callsign} in project ${projectId}.`);
|
19
|
+
}
|
20
|
+
async getRobotsByTag(projectId, tag) {
|
21
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_TAG_ROBOTS_URL, { url: this.config.url, projectId, tag }, this.config.insecure), `Failed to get robots for tag ${tag} in project ${projectId}.`);
|
22
|
+
}
|
23
|
+
async getTagsByProfileId(projectId, profileId) {
|
24
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_PROFILE_TAGS_URL, { url: this.config.url, projectId, profileId }, this.config.insecure), `Failed to get tags for profile ${profileId} in project ${projectId}.`);
|
25
|
+
}
|
26
|
+
async createTagForRobot(projectId, callsign, tag) {
|
27
|
+
const url = (0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_TAGS_URL, { url: this.config.url, projectId, callsign }, this.config.insecure);
|
28
|
+
const body = { tag };
|
29
|
+
return this.callPost(url, body, `Failed to create tag ${tag} for robot ${callsign} in project ${projectId}.`);
|
30
|
+
}
|
31
|
+
async deleteTagForRobot(projectId, callsign, tag) {
|
32
|
+
const url = (0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_TAG_URL, { url: this.config.url, projectId, callsign, tag }, this.config.insecure);
|
33
|
+
return this.callDelete(url, `Failed to delete tag ${tag} for robot ${callsign} in project ${projectId}.`);
|
34
|
+
}
|
35
|
+
async createTagForProfile(projectId, profileId, tag) {
|
36
|
+
const url = (0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_PROFILE_TAGS_URL, { url: this.config.url, projectId, profileId }, this.config.insecure);
|
37
|
+
const body = { tag };
|
38
|
+
return this.callPost(url, body, `Failed to create tag ${tag} for profile ${profileId} in project ${projectId}.`);
|
39
|
+
}
|
40
|
+
async deleteTagForProfile(projectId, profileId, tag) {
|
41
|
+
const url = (0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_PROFILE_TAG_URL, { url: this.config.url, projectId, profileId, tag }, this.config.insecure);
|
42
|
+
return this.callDelete(url, `Failed to delete tag ${tag} for profile ${profileId} in project ${projectId}.`);
|
43
|
+
}
|
44
|
+
getError(e) {
|
45
|
+
return new models_1.RocosError(e, models_1.errorCodes.TAG_SERVICE_ERROR);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
exports.TagService = TagService;
|
package/cjs/services/index.d.ts
CHANGED
@@ -22,6 +22,7 @@ export * from './SearchService';
|
|
22
22
|
export * from './SpotProvisioningService';
|
23
23
|
export * from './SpotProvisioningServiceNode';
|
24
24
|
export * from './StreamService';
|
25
|
+
export * from './TagService';
|
25
26
|
export * from './TargetService';
|
26
27
|
export * from './TelemetryService';
|
27
28
|
export * from './TimeSyncerService';
|
package/cjs/services/index.js
CHANGED
@@ -38,6 +38,7 @@ __exportStar(require("./SearchService"), exports);
|
|
38
38
|
__exportStar(require("./SpotProvisioningService"), exports);
|
39
39
|
__exportStar(require("./SpotProvisioningServiceNode"), exports);
|
40
40
|
__exportStar(require("./StreamService"), exports);
|
41
|
+
__exportStar(require("./TagService"), exports);
|
41
42
|
__exportStar(require("./TargetService"), exports);
|
42
43
|
__exportStar(require("./TelemetryService"), exports);
|
43
44
|
__exportStar(require("./TimeSyncerService"), exports);
|
package/esm/IRocosSDK.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TargetService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TagService, TargetService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
2
2
|
import { IBaseService, IDebugLevel, ServiceEnum } from './models';
|
3
3
|
export declare abstract class IRocosSDK {
|
4
4
|
abstract getService<T extends IBaseService>(_name: ServiceEnum): T;
|
@@ -29,6 +29,7 @@ export declare abstract class IRocosSDK {
|
|
29
29
|
abstract getEvaluatorService(): EvaluatorService;
|
30
30
|
abstract getDeviceCredentialsService(): DeviceCredentialsService;
|
31
31
|
abstract getTargetService(): TargetService;
|
32
|
+
abstract getTagService(): TagService;
|
32
33
|
abstract cleanup(): Promise<boolean>;
|
33
34
|
abstract enableDebugMode(on: boolean): void;
|
34
35
|
abstract setDebugLevel(level: IDebugLevel): void;
|
package/esm/RocosSDK.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TargetService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TagService, TargetService, 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';
|
@@ -140,6 +140,7 @@ export declare class RocosSDK implements IRocosSDK {
|
|
140
140
|
* @returns AssetService
|
141
141
|
*/
|
142
142
|
getTargetService(): TargetService;
|
143
|
+
getTagService(): TagService;
|
143
144
|
get platformTimeOffset(): number;
|
144
145
|
get platformTime(): number;
|
145
146
|
/**
|
package/esm/RocosSDK.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, PlatFormTimeService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TargetService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService, } from './services';
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EnvironmentService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, PlatFormTimeService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TagService, TargetService, 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';
|
@@ -110,6 +110,9 @@ export class RocosSDK {
|
|
110
110
|
case ServiceEnum.TARGET:
|
111
111
|
this.services[name] = new TargetService(config);
|
112
112
|
break;
|
113
|
+
case ServiceEnum.TAG:
|
114
|
+
this.services[name] = new TagService(config);
|
115
|
+
break;
|
113
116
|
}
|
114
117
|
}
|
115
118
|
this.logger.debug(`Found service ${name}.`);
|
@@ -293,6 +296,9 @@ export class RocosSDK {
|
|
293
296
|
getTargetService() {
|
294
297
|
return this.getService(ServiceEnum.TARGET);
|
295
298
|
}
|
299
|
+
getTagService() {
|
300
|
+
return this.getService(ServiceEnum.TAG);
|
301
|
+
}
|
296
302
|
get platformTimeOffset() {
|
297
303
|
return PlatFormTimeService.getInstance(this.getTimeSyncerService())?.platformTimeOffset;
|
298
304
|
}
|
package/esm/constants/api.d.ts
CHANGED
@@ -42,6 +42,7 @@ export declare const API_PROJECT_MISSION_ASSET_PATH_URL = "https://{url}/project
|
|
42
42
|
export declare const API_PROJECT_MAPPED_ASSETS_PATH_URL = "https://{url}/projects/{projectId}/mappedassets";
|
43
43
|
export declare const API_PROJECT_MAPPED_ASSET_PATH_URL = "https://{url}/projects/{projectId}/mappedassets/{assetId}";
|
44
44
|
export declare const API_PROJECT_ROBOT_URL = "https://{url}/projects/{projectId}/robots";
|
45
|
+
export declare const API_ACCOUNT_ROBOT_URL = "https://{url}/accounts/{accountId}/robots";
|
45
46
|
export declare const API_PROJECT_ROBOT_ID_URL = "https://{url}/projects/{projectId}/robots/{callsign}";
|
46
47
|
export declare const API_PROJECT_ROBOT_ATTRIBUTES_URL = "https://{url}/projects/{projectId}/robots/{callsign}/attributes";
|
47
48
|
export declare const API_PROJECT_ROBOT_DEFINITION_URL = "https://{url}/projects/{projectId}/robots/{callsign}/robot-definitions";
|
@@ -147,3 +148,8 @@ export declare const API_PROJECT_WORKFLOW_IMPORT_URL = "https://{url}/projects/{
|
|
147
148
|
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
148
149
|
export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
|
149
150
|
export declare const API_DEVICE_CREDENTIALS_AUTH_URL = "https://{url}/device-credentials/auth";
|
151
|
+
export declare const API_PROJECT_ROBOT_TAGS_URL = "https://{url}/projects/{projectId}/robots/{callsign}/tags";
|
152
|
+
export declare const API_PROJECT_TAG_ROBOTS_URL = "https://{url}/projects/{projectId}/tags/{tag}/robots";
|
153
|
+
export declare const API_PROJECT_PROFILE_TAGS_URL = "https://{url}/projects/{projectId}/profiles/{profileId}/tags";
|
154
|
+
export declare const API_PROJECT_PROFILE_TAG_URL = "https://{url}/projects/{projectId}/profiles/{profileId}/tags/{tag}";
|
155
|
+
export declare const API_PROJECT_ROBOT_TAG_URL = "https://{url}/projects/{projectId}/robots/{callsign}/tags/{tag}";
|
package/esm/constants/api.js
CHANGED
@@ -42,6 +42,7 @@ export const API_PROJECT_MISSION_ASSET_PATH_URL = 'https://{url}/projects/{proje
|
|
42
42
|
export const API_PROJECT_MAPPED_ASSETS_PATH_URL = 'https://{url}/projects/{projectId}/mappedassets';
|
43
43
|
export const API_PROJECT_MAPPED_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/mappedassets/{assetId}';
|
44
44
|
export const API_PROJECT_ROBOT_URL = 'https://{url}/projects/{projectId}/robots';
|
45
|
+
export const API_ACCOUNT_ROBOT_URL = 'https://{url}/accounts/{accountId}/robots';
|
45
46
|
export const API_PROJECT_ROBOT_ID_URL = 'https://{url}/projects/{projectId}/robots/{callsign}';
|
46
47
|
export const API_PROJECT_ROBOT_ATTRIBUTES_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/attributes';
|
47
48
|
export const API_PROJECT_ROBOT_DEFINITION_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/robot-definitions';
|
@@ -147,3 +148,8 @@ export const API_PROJECT_WORKFLOW_IMPORT_URL = 'https://{url}/projects/{projectI
|
|
147
148
|
export const API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
148
149
|
export const API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
|
149
150
|
export const API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
|
151
|
+
export const API_PROJECT_ROBOT_TAGS_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/tags';
|
152
|
+
export const API_PROJECT_TAG_ROBOTS_URL = 'https://{url}/projects/{projectId}/tags/{tag}/robots';
|
153
|
+
export const API_PROJECT_PROFILE_TAGS_URL = 'https://{url}/projects/{projectId}/profiles/{profileId}/tags';
|
154
|
+
export const API_PROJECT_PROFILE_TAG_URL = 'https://{url}/projects/{projectId}/profiles/{profileId}/tags/{tag}';
|
155
|
+
export const API_PROJECT_ROBOT_TAG_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/tags/{tag}';
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/esm/models/IRobot.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ConnectionStatus } from './ConnectionStatus';
|
1
2
|
import { RobotModeType } from './types';
|
2
3
|
export interface IRobot {
|
3
4
|
tags?: string[];
|
@@ -16,3 +17,7 @@ export interface IRobot {
|
|
16
17
|
robotDefinitionName?: string;
|
17
18
|
robotDefinitionTags?: string[];
|
18
19
|
}
|
20
|
+
export type IRobotListItem = IRobot & {
|
21
|
+
linkedProjectId?: string;
|
22
|
+
connection?: ConnectionStatus;
|
23
|
+
};
|
package/esm/models/RocosError.js
CHANGED
@@ -27,6 +27,7 @@ export const errorCodes = {
|
|
27
27
|
DEVICE_CREDENTIALS_SERVICE_ERROR: 'DEVICE_CREDENTIALS_SERVICE_ERROR',
|
28
28
|
TARGET_SERVICE_ERROR: 'TARGET_SERVICE_ERROR',
|
29
29
|
ENVIRONMENT_SERVICE_ERROR: 'ENVIRONMENT_SERVICE_ERROR',
|
30
|
+
TAG_SERVICE_ERROR: 'TAG_SERVICE_ERROR',
|
30
31
|
};
|
31
32
|
export class RocosError extends Error {
|
32
33
|
constructor(err, code, statusCode) {
|
@@ -23,6 +23,7 @@ export var ServiceEnum;
|
|
23
23
|
ServiceEnum["SEARCH"] = "search";
|
24
24
|
ServiceEnum["SPOT_PROVISIONER"] = "spot_provisioner";
|
25
25
|
ServiceEnum["STREAM"] = "stream";
|
26
|
+
ServiceEnum["TAG"] = "tag";
|
26
27
|
ServiceEnum["TARGET"] = "target";
|
27
28
|
ServiceEnum["TELEMETRY"] = "telemetry";
|
28
29
|
ServiceEnum["TIME_SYNCER"] = "time_syncer";
|
package/esm/models/index.d.ts
CHANGED
@@ -37,6 +37,7 @@ export * from './maps/Panorama';
|
|
37
37
|
export * from './projects/ProjectUser';
|
38
38
|
export * from './projects/ExternalProject';
|
39
39
|
export * from './projects/NewProjectRequest';
|
40
|
+
export * from './tag/Tag';
|
40
41
|
export * from './target/Target';
|
41
42
|
export * from './ExportDataQuery';
|
42
43
|
export * from './HttpError';
|
package/esm/models/index.js
CHANGED
@@ -37,6 +37,7 @@ export * from './maps/Panorama';
|
|
37
37
|
export * from './projects/ProjectUser';
|
38
38
|
export * from './projects/ExternalProject';
|
39
39
|
export * from './projects/NewProjectRequest';
|
40
|
+
export * from './tag/Tag';
|
40
41
|
export * from './target/Target';
|
41
42
|
export * from './ExportDataQuery';
|
42
43
|
export * from './HttpError';
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,44 +1,26 @@
|
|
1
1
|
import { ResultStatus, RocosResponseLevel, } from '../models';
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import { from, map, mergeMap, share, switchMap, take, takeUntil, throwError } from 'rxjs';
|
3
|
+
import { catchError, filter } from 'rxjs/operators';
|
4
4
|
import { getResponses, handleChunkedMessages } from '../helpers/callerMessageHelpers';
|
5
5
|
import { BaseStreamService } from './BaseStreamService';
|
6
6
|
import { CallerStream } from '../api/streams/caller/CallerStream';
|
7
7
|
import { IDENTIFIER_NAME_CALLER } from '../constants/identifier';
|
8
|
-
import { splitRobotTopic } from '../helpers
|
8
|
+
import { splitRobotTopic } from '../helpers';
|
9
9
|
import { v4 } from 'uuid';
|
10
10
|
export class CallerService extends BaseStreamService {
|
11
11
|
constructor(config) {
|
12
12
|
super('CallerService', config);
|
13
13
|
}
|
14
14
|
invokeRequest(params) {
|
15
|
-
|
16
|
-
let subscription;
|
17
|
-
this.createStream()
|
18
|
-
.then((stream) => {
|
19
|
-
subscription = stream.invokeRequest(params).subscribe(subject);
|
20
|
-
})
|
21
|
-
.catch((e) => {
|
15
|
+
return from(this.createStream()).pipe(switchMap((stream) => stream.invokeRequest(params)), catchError((e) => {
|
22
16
|
this.logger.info('invokeRequest error', e);
|
23
|
-
|
24
|
-
});
|
25
|
-
return subject.asObservable().pipe(finalize(() => {
|
26
|
-
subscription?.unsubscribe();
|
17
|
+
return throwError(() => e);
|
27
18
|
}));
|
28
19
|
}
|
29
20
|
cancelRequest(params) {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
.then((stream) => {
|
34
|
-
subscription = stream.cancelRequest(params).subscribe(subject);
|
35
|
-
})
|
36
|
-
.catch((e) => {
|
37
|
-
this.logger.info('invokeRequest error', e);
|
38
|
-
subject.error(e);
|
39
|
-
});
|
40
|
-
return subject.asObservable().pipe(finalize(() => {
|
41
|
-
subscription?.unsubscribe();
|
21
|
+
return from(this.createStream()).pipe(switchMap((stream) => stream.cancelRequest(params)), catchError((e) => {
|
22
|
+
this.logger.info('cancelRequest error', e);
|
23
|
+
return throwError(() => e);
|
42
24
|
}));
|
43
25
|
}
|
44
26
|
/** Call a service and return the response(s).
|
@@ -53,7 +35,9 @@ export class CallerService extends BaseStreamService {
|
|
53
35
|
*/
|
54
36
|
callRaw(params) {
|
55
37
|
const { component, topic } = splitRobotTopic(params.source);
|
56
|
-
const payloadString =
|
38
|
+
const payloadString = params.options?.rawPayload
|
39
|
+
? String(params.payload ?? '')
|
40
|
+
: JSON.stringify(params.payload ?? {});
|
57
41
|
const source$ = this.invokeRequest({
|
58
42
|
uid: params.options?.uid ?? v4(),
|
59
43
|
projectId: params.projectId,
|
@@ -64,7 +48,7 @@ export class CallerService extends BaseStreamService {
|
|
64
48
|
responseLevelNumber: RocosResponseLevel.ALL,
|
65
49
|
payload: payloadString,
|
66
50
|
query: params.options?.query,
|
67
|
-
}).pipe(mergeMap(getResponses), handleChunkedMessages());
|
51
|
+
}).pipe(mergeMap(getResponses), handleChunkedMessages(), share());
|
68
52
|
const result$ = source$.pipe(filter((x) => x.result !== undefined), map((x) => x.result), take(1));
|
69
53
|
const resultNotifier$ = result$.pipe(map((x) => {
|
70
54
|
if (x.status !== ResultStatus.COMPLETE_SUCCESS)
|
@@ -17,12 +17,19 @@ export declare class EnvironmentService extends BaseServiceAbstract implements I
|
|
17
17
|
* Set Environment
|
18
18
|
*
|
19
19
|
* @param projectId - Project Id
|
20
|
+
* @param scene - The complete scene to be stored.
|
21
|
+
* CAUTION: This will delete the existing environment and create
|
22
|
+
* a new one. Think of this as a "reset" for the environment.
|
23
|
+
* This will cause ALL edges to other objects (assets, panos, etc) to be removed.
|
20
24
|
*/
|
21
25
|
set(projectId: string, scene: unknown): Promise<void>;
|
22
26
|
/**
|
23
27
|
* Update Environment
|
24
28
|
*
|
25
29
|
* @param projectId - Project Id
|
30
|
+
* @param scene - The new complete scene to be stored.
|
31
|
+
* This will update the environment with the new scene. Any nodes or edges
|
32
|
+
* not in this scene will be droppend and their edges will be removed.
|
26
33
|
*/
|
27
34
|
update(projectId: string, scene: unknown): Promise<void>;
|
28
35
|
/**
|
@@ -29,6 +29,10 @@ export class EnvironmentService extends BaseServiceAbstract {
|
|
29
29
|
* Set Environment
|
30
30
|
*
|
31
31
|
* @param projectId - Project Id
|
32
|
+
* @param scene - The complete scene to be stored.
|
33
|
+
* CAUTION: This will delete the existing environment and create
|
34
|
+
* a new one. Think of this as a "reset" for the environment.
|
35
|
+
* This will cause ALL edges to other objects (assets, panos, etc) to be removed.
|
32
36
|
*/
|
33
37
|
async set(projectId, scene) {
|
34
38
|
return this.callPost(formatServiceUrl(API_PROJECT_ENVIRONMENT_URL, { url: this.config.url, projectId }, this.config.insecure), scene, `Failed to set environment for ${projectId}.`);
|
@@ -37,6 +41,9 @@ export class EnvironmentService extends BaseServiceAbstract {
|
|
37
41
|
* Update Environment
|
38
42
|
*
|
39
43
|
* @param projectId - Project Id
|
44
|
+
* @param scene - The new complete scene to be stored.
|
45
|
+
* This will update the environment with the new scene. Any nodes or edges
|
46
|
+
* not in this scene will be droppend and their edges will be removed.
|
40
47
|
*/
|
41
48
|
async update(projectId, scene) {
|
42
49
|
return this.callPut(formatServiceUrl(API_PROJECT_ENVIRONMENT_URL, { url: this.config.url, projectId }, this.config.insecure), scene, `Failed to update environment for ${projectId}.`);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IBaseService, IConnectedCallsign, IRobot, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
|
1
|
+
import { IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
3
|
export declare class RobotService extends BaseServiceAbstract implements IBaseService {
|
4
4
|
constructor(config: IRocosSDKConfig);
|
@@ -10,6 +10,12 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
|
|
10
10
|
* @param projectId - Project Id
|
11
11
|
*/
|
12
12
|
getRobots(projectId: string): Promise<IRobot[]>;
|
13
|
+
/**
|
14
|
+
* Get a list of robots by account id.
|
15
|
+
*
|
16
|
+
* @param accountId - Account Id
|
17
|
+
*/
|
18
|
+
getRobotsByAccountId(accountId: string): Promise<IRobotListItem[]>;
|
13
19
|
/**
|
14
20
|
* Create a new robot.
|
15
21
|
*
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { API_PROJECT_PROFILE_DASHBOARD_CUSTOM_WIDGET_URL, API_PROJECT_PROFILE_DASHBOARD_ID_URL, API_PROJECT_PROFILE_DASHBOARD_URL, API_PROJECT_ROBOT_AGENT_URL, API_PROJECT_ROBOT_ATTRIBUTES_URL, API_PROJECT_ROBOT_BUTTON_URL, API_PROJECT_ROBOT_COMMAND2_URL, API_PROJECT_ROBOT_COMMAND_URL, API_PROJECT_ROBOT_CONFIGS_CONNECTIONS_URL, API_PROJECT_ROBOT_CONFIGS_CONNECTION_URL, API_PROJECT_ROBOT_DASHBOARD_CUSTOM_WIDGET_URL, API_PROJECT_ROBOT_DASHBOARD_ID_URL, API_PROJECT_ROBOT_DASHBOARD_URL, API_PROJECT_ROBOT_GAMEPAD_URL, API_PROJECT_ROBOT_ID_URL, API_PROJECT_ROBOT_REGISTER_URL, API_PROJECT_ROBOT_SETTING_URL, API_PROJECT_ROBOT_TRIGGER_URL, API_PROJECT_ROBOT_URL, API_PROJECT_VROBOT_DEPLOY_URL, API_PROJECT_VROBOT_DETAILS_URL, API_SOURCE_SCHEMA_URL, API_TEMPLATE_DEPLOY_URL, } from '../constants/api';
|
1
|
+
import { API_ACCOUNT_ROBOT_URL, API_PROJECT_PROFILE_DASHBOARD_CUSTOM_WIDGET_URL, API_PROJECT_PROFILE_DASHBOARD_ID_URL, API_PROJECT_PROFILE_DASHBOARD_URL, API_PROJECT_ROBOT_AGENT_URL, API_PROJECT_ROBOT_ATTRIBUTES_URL, API_PROJECT_ROBOT_BUTTON_URL, API_PROJECT_ROBOT_COMMAND2_URL, API_PROJECT_ROBOT_COMMAND_URL, API_PROJECT_ROBOT_CONFIGS_CONNECTIONS_URL, API_PROJECT_ROBOT_CONFIGS_CONNECTION_URL, API_PROJECT_ROBOT_DASHBOARD_CUSTOM_WIDGET_URL, API_PROJECT_ROBOT_DASHBOARD_ID_URL, API_PROJECT_ROBOT_DASHBOARD_URL, API_PROJECT_ROBOT_GAMEPAD_URL, API_PROJECT_ROBOT_ID_URL, API_PROJECT_ROBOT_REGISTER_URL, API_PROJECT_ROBOT_SETTING_URL, API_PROJECT_ROBOT_TRIGGER_URL, API_PROJECT_ROBOT_URL, API_PROJECT_VROBOT_DEPLOY_URL, API_PROJECT_VROBOT_DETAILS_URL, API_SOURCE_SCHEMA_URL, API_TEMPLATE_DEPLOY_URL, } from '../constants/api';
|
2
2
|
import { Robot, RobotTemplate, RocosError, errorCodes, } from '../models';
|
3
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
4
|
import { RocosLogger } from '../logger/RocosLogger';
|
@@ -24,6 +24,15 @@ export class RobotService extends BaseServiceAbstract {
|
|
24
24
|
const data = await this.callGet(formatServiceUrl(API_PROJECT_ROBOT_URL, { url: this.config.url, projectId }, this.config.insecure), `Failed to get robots list for ${projectId}.`);
|
25
25
|
return data.map((item) => cleanObject(new Robot(item)));
|
26
26
|
}
|
27
|
+
/**
|
28
|
+
* Get a list of robots by account id.
|
29
|
+
*
|
30
|
+
* @param accountId - Account Id
|
31
|
+
*/
|
32
|
+
async getRobotsByAccountId(accountId) {
|
33
|
+
const data = await this.callGet(formatServiceUrl(API_ACCOUNT_ROBOT_URL, { url: this.config.url, accountId }, this.config.insecure), `Failed to get robots list for organization: ${accountId}.`);
|
34
|
+
return data;
|
35
|
+
}
|
27
36
|
/**
|
28
37
|
* Create a new robot.
|
29
38
|
*
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { IBaseService, IRocosSDKConfig, RobotsByTagResponse, RocosError, TagResponse } from '../models';
|
2
|
+
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
|
+
export declare class TagService extends BaseServiceAbstract implements IBaseService {
|
4
|
+
constructor(config: IRocosSDKConfig);
|
5
|
+
getStatus(): boolean;
|
6
|
+
getTagsByRobot(projectId: string, callsign: string): Promise<TagResponse>;
|
7
|
+
getRobotsByTag(projectId: string, tag: string): Promise<RobotsByTagResponse>;
|
8
|
+
getTagsByProfileId(projectId: string, profileId: string): Promise<TagResponse>;
|
9
|
+
createTagForRobot(projectId: string, callsign: string, tag: string): Promise<void>;
|
10
|
+
deleteTagForRobot(projectId: string, callsign: string, tag: string): Promise<void>;
|
11
|
+
createTagForProfile(projectId: string, profileId: string, tag: string): Promise<void>;
|
12
|
+
deleteTagForProfile(projectId: string, profileId: string, tag: string): Promise<void>;
|
13
|
+
protected getError(e: Error): RocosError;
|
14
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { API_PROJECT_PROFILE_TAGS_URL, API_PROJECT_PROFILE_TAG_URL, API_PROJECT_ROBOT_TAGS_URL, API_PROJECT_ROBOT_TAG_URL, API_PROJECT_TAG_ROBOTS_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
|
+
export class TagService extends BaseServiceAbstract {
|
7
|
+
constructor(config) {
|
8
|
+
super(config);
|
9
|
+
this.logger = RocosLogger.getInstance(`TagService(${this.config.url})`);
|
10
|
+
}
|
11
|
+
getStatus() {
|
12
|
+
return true;
|
13
|
+
}
|
14
|
+
async getTagsByRobot(projectId, callsign) {
|
15
|
+
return this.callGet(formatServiceUrl(API_PROJECT_ROBOT_TAGS_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), `Failed to get tags for robot ${callsign} in project ${projectId}.`);
|
16
|
+
}
|
17
|
+
async getRobotsByTag(projectId, tag) {
|
18
|
+
return this.callGet(formatServiceUrl(API_PROJECT_TAG_ROBOTS_URL, { url: this.config.url, projectId, tag }, this.config.insecure), `Failed to get robots for tag ${tag} in project ${projectId}.`);
|
19
|
+
}
|
20
|
+
async getTagsByProfileId(projectId, profileId) {
|
21
|
+
return this.callGet(formatServiceUrl(API_PROJECT_PROFILE_TAGS_URL, { url: this.config.url, projectId, profileId }, this.config.insecure), `Failed to get tags for profile ${profileId} in project ${projectId}.`);
|
22
|
+
}
|
23
|
+
async createTagForRobot(projectId, callsign, tag) {
|
24
|
+
const url = formatServiceUrl(API_PROJECT_ROBOT_TAGS_URL, { url: this.config.url, projectId, callsign }, this.config.insecure);
|
25
|
+
const body = { tag };
|
26
|
+
return this.callPost(url, body, `Failed to create tag ${tag} for robot ${callsign} in project ${projectId}.`);
|
27
|
+
}
|
28
|
+
async deleteTagForRobot(projectId, callsign, tag) {
|
29
|
+
const url = formatServiceUrl(API_PROJECT_ROBOT_TAG_URL, { url: this.config.url, projectId, callsign, tag }, this.config.insecure);
|
30
|
+
return this.callDelete(url, `Failed to delete tag ${tag} for robot ${callsign} in project ${projectId}.`);
|
31
|
+
}
|
32
|
+
async createTagForProfile(projectId, profileId, tag) {
|
33
|
+
const url = formatServiceUrl(API_PROJECT_PROFILE_TAGS_URL, { url: this.config.url, projectId, profileId }, this.config.insecure);
|
34
|
+
const body = { tag };
|
35
|
+
return this.callPost(url, body, `Failed to create tag ${tag} for profile ${profileId} in project ${projectId}.`);
|
36
|
+
}
|
37
|
+
async deleteTagForProfile(projectId, profileId, tag) {
|
38
|
+
const url = formatServiceUrl(API_PROJECT_PROFILE_TAG_URL, { url: this.config.url, projectId, profileId, tag }, this.config.insecure);
|
39
|
+
return this.callDelete(url, `Failed to delete tag ${tag} for profile ${profileId} in project ${projectId}.`);
|
40
|
+
}
|
41
|
+
getError(e) {
|
42
|
+
return new RocosError(e, errorCodes.TAG_SERVICE_ERROR);
|
43
|
+
}
|
44
|
+
}
|
package/esm/services/index.d.ts
CHANGED
@@ -22,6 +22,7 @@ export * from './SearchService';
|
|
22
22
|
export * from './SpotProvisioningService';
|
23
23
|
export * from './SpotProvisioningServiceNode';
|
24
24
|
export * from './StreamService';
|
25
|
+
export * from './TagService';
|
25
26
|
export * from './TargetService';
|
26
27
|
export * from './TelemetryService';
|
27
28
|
export * from './TimeSyncerService';
|
package/esm/services/index.js
CHANGED
@@ -22,6 +22,7 @@ export * from './SearchService';
|
|
22
22
|
export * from './SpotProvisioningService';
|
23
23
|
export * from './SpotProvisioningServiceNode';
|
24
24
|
export * from './StreamService';
|
25
|
+
export * from './TagService';
|
25
26
|
export * from './TargetService';
|
26
27
|
export * from './TelemetryService';
|
27
28
|
export * from './TimeSyncerService';
|