@dronedeploy/rocos-js-sdk 3.0.1-alpha.7 → 3.0.1-alpha.8
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/constants/api.d.ts +1 -0
- package/cjs/constants/api.js +2 -1
- package/cjs/models/HttpError.d.ts +5 -0
- package/cjs/models/HttpError.js +12 -0
- package/cjs/models/IProject.d.ts +2 -0
- package/cjs/models/IProjectInfo.d.ts +14 -0
- package/cjs/models/IProjectInfo.js +2 -0
- package/cjs/models/index.d.ts +2 -0
- package/cjs/models/index.js +2 -0
- package/cjs/services/BaseServiceAbstract.js +2 -9
- package/cjs/services/ProjectService.d.ts +5 -9
- package/cjs/services/ProjectService.js +5 -2
- package/esm/constants/api.d.ts +1 -0
- package/esm/constants/api.js +1 -0
- package/esm/models/HttpError.d.ts +5 -0
- package/esm/models/HttpError.js +8 -0
- package/esm/models/IProject.d.ts +2 -0
- package/esm/models/IProjectInfo.d.ts +14 -0
- package/esm/models/IProjectInfo.js +1 -0
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/services/BaseServiceAbstract.js +2 -9
- package/esm/services/ProjectService.d.ts +5 -9
- package/esm/services/ProjectService.js +5 -2
- package/package.json +1 -1
package/cjs/constants/api.d.ts
CHANGED
@@ -132,3 +132,4 @@ export declare const API_PROJECT_WORKFLOW_URL = "https://{url}/projects/{project
|
|
132
132
|
export declare const API_PROJECT_WORKFLOW_ID_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}";
|
133
133
|
export declare const API_PROJECT_WORKFLOW_ASSET_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets";
|
134
134
|
export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments";
|
135
|
+
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
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_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_FUNCTION_POD_URL = exports.API_PROJECT_FUNCTION_RUN_URL = exports.API_PROJECT_FUNCTION_ID_URL = exports.API_PROJECT_FUNCTION_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_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_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 = exports.API_PROJECT_ROBOT_DASHBOARD_ID_URL = exports.API_PROJECT_ROBOT_DASHBOARD_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 = exports.API_PROJECT_ROBOT_DASHBOARD_ID_URL = exports.API_PROJECT_ROBOT_DASHBOARD_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';
|
@@ -137,3 +137,4 @@ exports.API_PROJECT_WORKFLOW_URL = 'https://{url}/projects/{projectId}/automate/
|
|
137
137
|
exports.API_PROJECT_WORKFLOW_ID_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}';
|
138
138
|
exports.API_PROJECT_WORKFLOW_ASSET_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets';
|
139
139
|
exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments';
|
140
|
+
exports.API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.HttpError = void 0;
|
4
|
+
class HttpError extends Error {
|
5
|
+
constructor(response, payload) {
|
6
|
+
super(response.statusText);
|
7
|
+
this.response = response;
|
8
|
+
this.payload = payload;
|
9
|
+
this.name = 'HttpError';
|
10
|
+
}
|
11
|
+
}
|
12
|
+
exports.HttpError = HttpError;
|
package/cjs/models/IProject.d.ts
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
export interface IProjectInfo {
|
2
|
+
id: string;
|
3
|
+
name: string;
|
4
|
+
linkedProjectId?: string;
|
5
|
+
description: string;
|
6
|
+
userCount: number;
|
7
|
+
robotCount: number;
|
8
|
+
linkedProjectName?: string;
|
9
|
+
linkedProjectThumbnail?: string;
|
10
|
+
location?: {
|
11
|
+
lng: number;
|
12
|
+
lat: number;
|
13
|
+
};
|
14
|
+
}
|
package/cjs/models/index.d.ts
CHANGED
@@ -34,6 +34,7 @@ export * from './maps/Map';
|
|
34
34
|
export * from './projects/ProjectUser';
|
35
35
|
export * from './CallsignStatus';
|
36
36
|
export * from './ExportDataQuery';
|
37
|
+
export * from './HttpError';
|
37
38
|
export * from './IBaseService';
|
38
39
|
export * from './IConfigGroup';
|
39
40
|
export * from './IDebugLevel';
|
@@ -45,6 +46,7 @@ export * from './IOperation';
|
|
45
46
|
export * from './IPersonalAccessToken';
|
46
47
|
export * from './IProject';
|
47
48
|
export * from './IProjectApplication';
|
49
|
+
export * from './IProjectInfo';
|
48
50
|
export * from './IRobot';
|
49
51
|
export * from './IRobotConfig';
|
50
52
|
export * from './IRobotPlugin';
|
package/cjs/models/index.js
CHANGED
@@ -50,6 +50,7 @@ __exportStar(require("./maps/Map"), exports);
|
|
50
50
|
__exportStar(require("./projects/ProjectUser"), exports);
|
51
51
|
__exportStar(require("./CallsignStatus"), exports);
|
52
52
|
__exportStar(require("./ExportDataQuery"), exports);
|
53
|
+
__exportStar(require("./HttpError"), exports);
|
53
54
|
__exportStar(require("./IBaseService"), exports);
|
54
55
|
__exportStar(require("./IConfigGroup"), exports);
|
55
56
|
__exportStar(require("./IDebugLevel"), exports);
|
@@ -61,6 +62,7 @@ __exportStar(require("./IOperation"), exports);
|
|
61
62
|
__exportStar(require("./IPersonalAccessToken"), exports);
|
62
63
|
__exportStar(require("./IProject"), exports);
|
63
64
|
__exportStar(require("./IProjectApplication"), exports);
|
65
|
+
__exportStar(require("./IProjectInfo"), exports);
|
64
66
|
__exportStar(require("./IRobot"), exports);
|
65
67
|
__exportStar(require("./IRobotConfig"), exports);
|
66
68
|
__exportStar(require("./IRobotPlugin"), exports);
|
@@ -4,13 +4,6 @@ exports.BaseServiceAbstract = void 0;
|
|
4
4
|
const models_1 = require("../models");
|
5
5
|
const helpers_1 = require("../helpers");
|
6
6
|
const RocosStore_1 = require("../store/RocosStore");
|
7
|
-
class HttpError extends Error {
|
8
|
-
constructor(response) {
|
9
|
-
super(response.statusText);
|
10
|
-
this.response = response;
|
11
|
-
this.name = 'HttpError';
|
12
|
-
}
|
13
|
-
}
|
14
7
|
class BaseServiceAbstract {
|
15
8
|
constructor(config) {
|
16
9
|
this.config = config;
|
@@ -57,7 +50,7 @@ class BaseServiceAbstract {
|
|
57
50
|
const message = errorMessage;
|
58
51
|
this.logger.error(message, e);
|
59
52
|
let httpError = new models_1.RocosError(message);
|
60
|
-
if (e instanceof HttpError) {
|
53
|
+
if (e instanceof models_1.HttpError) {
|
61
54
|
httpError = this.getError(e);
|
62
55
|
httpError.statusCode = e?.response?.status;
|
63
56
|
}
|
@@ -71,7 +64,7 @@ class BaseServiceAbstract {
|
|
71
64
|
if (!res.ok) {
|
72
65
|
const payload = await res.text();
|
73
66
|
this.logger.warn('Failed HTTP Response', { status: res.statusText, payload, response: res });
|
74
|
-
throw new HttpError(res);
|
67
|
+
throw new models_1.HttpError(res, payload);
|
75
68
|
}
|
76
69
|
switch (responseType) {
|
77
70
|
case 'raw':
|
@@ -1,10 +1,5 @@
|
|
1
|
-
import { RocosError } from '../models
|
1
|
+
import { IBaseService, IOperation, IProject, IProjectInfo, IRocosSDKConfig, ProjectUser, RocosError } from '../models';
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
|
-
import { IBaseService } from '../models/IBaseService';
|
4
|
-
import { IOperation } from '../models/IOperation';
|
5
|
-
import { IProject } from '../models/IProject';
|
6
|
-
import { IRocosSDKConfig } from '../models/IRocosSDKConfig';
|
7
|
-
import { ProjectUser } from '../models';
|
8
3
|
export declare class ProjectService extends BaseServiceAbstract implements IBaseService {
|
9
4
|
constructor(config: IRocosSDKConfig);
|
10
5
|
protected getError(e: Error): RocosError;
|
@@ -18,7 +13,7 @@ export declare class ProjectService extends BaseServiceAbstract implements IBase
|
|
18
13
|
/**
|
19
14
|
* Get projects list by current account info
|
20
15
|
*/
|
21
|
-
list(): Promise<
|
16
|
+
list(): Promise<IProjectInfo[]>;
|
22
17
|
/**
|
23
18
|
* Update project information.
|
24
19
|
*
|
@@ -31,7 +26,7 @@ export declare class ProjectService extends BaseServiceAbstract implements IBase
|
|
31
26
|
*
|
32
27
|
* @param projectId - Project Id
|
33
28
|
*/
|
34
|
-
info(projectId: string): Promise<
|
29
|
+
info(projectId: string): Promise<IProjectInfo>;
|
35
30
|
/**
|
36
31
|
* Delete project by account id and project id.
|
37
32
|
*
|
@@ -44,7 +39,7 @@ export declare class ProjectService extends BaseServiceAbstract implements IBase
|
|
44
39
|
*
|
45
40
|
* @param accountId - Account Id
|
46
41
|
*/
|
47
|
-
projectsUnderAccount(accountId: string): Promise<
|
42
|
+
projectsUnderAccount(accountId: string): Promise<IProjectInfo[]>;
|
48
43
|
/**
|
49
44
|
* Create a project under a specified account
|
50
45
|
*
|
@@ -107,4 +102,5 @@ export declare class ProjectService extends BaseServiceAbstract implements IBase
|
|
107
102
|
* @returns Returns list of users for a given project
|
108
103
|
*/
|
109
104
|
listUsers(projectId: string): Promise<ProjectUser[]>;
|
105
|
+
getProjectByLinkedProjectId(linkedProjectId: string): Promise<IProject>;
|
110
106
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ProjectService = void 0;
|
4
4
|
const api_1 = require("../constants/api");
|
5
|
-
const
|
5
|
+
const models_1 = require("../models");
|
6
6
|
const BaseServiceAbstract_1 = require("./BaseServiceAbstract");
|
7
7
|
const RocosLogger_1 = require("../logger/RocosLogger");
|
8
8
|
const formatServiceUrl_1 = require("../helpers/formatServiceUrl");
|
@@ -12,7 +12,7 @@ class ProjectService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
12
12
|
this.logger = RocosLogger_1.RocosLogger.getInstance(`ProjectService(${this.config.url})`);
|
13
13
|
}
|
14
14
|
getError(e) {
|
15
|
-
return new
|
15
|
+
return new models_1.RocosError(e, models_1.errorCodes.PROJECT_SERVICE_ERROR);
|
16
16
|
}
|
17
17
|
getStatus() {
|
18
18
|
return true;
|
@@ -160,5 +160,8 @@ class ProjectService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
160
160
|
async listUsers(projectId) {
|
161
161
|
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_USERS_URL, { url: this.config.url, projectId }, this.config.insecure), 'Failed to get project users list.');
|
162
162
|
}
|
163
|
+
async getProjectByLinkedProjectId(linkedProjectId) {
|
164
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_LINKED_PROJECT_URL, { url: this.config.url, linkedProjectId }, this.config.insecure), `Failed to get project info for linked project ID: ${linkedProjectId}.`);
|
165
|
+
}
|
163
166
|
}
|
164
167
|
exports.ProjectService = ProjectService;
|
package/esm/constants/api.d.ts
CHANGED
@@ -132,3 +132,4 @@ export declare const API_PROJECT_WORKFLOW_URL = "https://{url}/projects/{project
|
|
132
132
|
export declare const API_PROJECT_WORKFLOW_ID_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}";
|
133
133
|
export declare const API_PROJECT_WORKFLOW_ASSET_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets";
|
134
134
|
export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments";
|
135
|
+
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
package/esm/constants/api.js
CHANGED
@@ -132,3 +132,4 @@ export const API_PROJECT_WORKFLOW_URL = 'https://{url}/projects/{projectId}/auto
|
|
132
132
|
export const API_PROJECT_WORKFLOW_ID_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}';
|
133
133
|
export const API_PROJECT_WORKFLOW_ASSET_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets';
|
134
134
|
export const API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments';
|
135
|
+
export const API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
package/esm/models/IProject.d.ts
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
export interface IProjectInfo {
|
2
|
+
id: string;
|
3
|
+
name: string;
|
4
|
+
linkedProjectId?: string;
|
5
|
+
description: string;
|
6
|
+
userCount: number;
|
7
|
+
robotCount: number;
|
8
|
+
linkedProjectName?: string;
|
9
|
+
linkedProjectThumbnail?: string;
|
10
|
+
location?: {
|
11
|
+
lng: number;
|
12
|
+
lat: number;
|
13
|
+
};
|
14
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/esm/models/index.d.ts
CHANGED
@@ -34,6 +34,7 @@ export * from './maps/Map';
|
|
34
34
|
export * from './projects/ProjectUser';
|
35
35
|
export * from './CallsignStatus';
|
36
36
|
export * from './ExportDataQuery';
|
37
|
+
export * from './HttpError';
|
37
38
|
export * from './IBaseService';
|
38
39
|
export * from './IConfigGroup';
|
39
40
|
export * from './IDebugLevel';
|
@@ -45,6 +46,7 @@ export * from './IOperation';
|
|
45
46
|
export * from './IPersonalAccessToken';
|
46
47
|
export * from './IProject';
|
47
48
|
export * from './IProjectApplication';
|
49
|
+
export * from './IProjectInfo';
|
48
50
|
export * from './IRobot';
|
49
51
|
export * from './IRobotConfig';
|
50
52
|
export * from './IRobotPlugin';
|
package/esm/models/index.js
CHANGED
@@ -34,6 +34,7 @@ export * from './maps/Map';
|
|
34
34
|
export * from './projects/ProjectUser';
|
35
35
|
export * from './CallsignStatus';
|
36
36
|
export * from './ExportDataQuery';
|
37
|
+
export * from './HttpError';
|
37
38
|
export * from './IBaseService';
|
38
39
|
export * from './IConfigGroup';
|
39
40
|
export * from './IDebugLevel';
|
@@ -45,6 +46,7 @@ export * from './IOperation';
|
|
45
46
|
export * from './IPersonalAccessToken';
|
46
47
|
export * from './IProject';
|
47
48
|
export * from './IProjectApplication';
|
49
|
+
export * from './IProjectInfo';
|
48
50
|
export * from './IRobot';
|
49
51
|
export * from './IRobotConfig';
|
50
52
|
export * from './IRobotPlugin';
|
@@ -1,13 +1,6 @@
|
|
1
|
-
import { RocosError } from '../models';
|
1
|
+
import { RocosError, HttpError } from '../models';
|
2
2
|
import { getURLSearchParams } from '../helpers';
|
3
3
|
import { RocosStore } from '../store/RocosStore';
|
4
|
-
class HttpError extends Error {
|
5
|
-
constructor(response) {
|
6
|
-
super(response.statusText);
|
7
|
-
this.response = response;
|
8
|
-
this.name = 'HttpError';
|
9
|
-
}
|
10
|
-
}
|
11
4
|
export class BaseServiceAbstract {
|
12
5
|
constructor(config) {
|
13
6
|
this.config = config;
|
@@ -68,7 +61,7 @@ export class BaseServiceAbstract {
|
|
68
61
|
if (!res.ok) {
|
69
62
|
const payload = await res.text();
|
70
63
|
this.logger.warn('Failed HTTP Response', { status: res.statusText, payload, response: res });
|
71
|
-
throw new HttpError(res);
|
64
|
+
throw new HttpError(res, payload);
|
72
65
|
}
|
73
66
|
switch (responseType) {
|
74
67
|
case 'raw':
|
@@ -1,10 +1,5 @@
|
|
1
|
-
import { RocosError } from '../models
|
1
|
+
import { IBaseService, IOperation, IProject, IProjectInfo, IRocosSDKConfig, ProjectUser, RocosError } from '../models';
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
|
-
import { IBaseService } from '../models/IBaseService';
|
4
|
-
import { IOperation } from '../models/IOperation';
|
5
|
-
import { IProject } from '../models/IProject';
|
6
|
-
import { IRocosSDKConfig } from '../models/IRocosSDKConfig';
|
7
|
-
import { ProjectUser } from '../models';
|
8
3
|
export declare class ProjectService extends BaseServiceAbstract implements IBaseService {
|
9
4
|
constructor(config: IRocosSDKConfig);
|
10
5
|
protected getError(e: Error): RocosError;
|
@@ -18,7 +13,7 @@ export declare class ProjectService extends BaseServiceAbstract implements IBase
|
|
18
13
|
/**
|
19
14
|
* Get projects list by current account info
|
20
15
|
*/
|
21
|
-
list(): Promise<
|
16
|
+
list(): Promise<IProjectInfo[]>;
|
22
17
|
/**
|
23
18
|
* Update project information.
|
24
19
|
*
|
@@ -31,7 +26,7 @@ export declare class ProjectService extends BaseServiceAbstract implements IBase
|
|
31
26
|
*
|
32
27
|
* @param projectId - Project Id
|
33
28
|
*/
|
34
|
-
info(projectId: string): Promise<
|
29
|
+
info(projectId: string): Promise<IProjectInfo>;
|
35
30
|
/**
|
36
31
|
* Delete project by account id and project id.
|
37
32
|
*
|
@@ -44,7 +39,7 @@ export declare class ProjectService extends BaseServiceAbstract implements IBase
|
|
44
39
|
*
|
45
40
|
* @param accountId - Account Id
|
46
41
|
*/
|
47
|
-
projectsUnderAccount(accountId: string): Promise<
|
42
|
+
projectsUnderAccount(accountId: string): Promise<IProjectInfo[]>;
|
48
43
|
/**
|
49
44
|
* Create a project under a specified account
|
50
45
|
*
|
@@ -107,4 +102,5 @@ export declare class ProjectService extends BaseServiceAbstract implements IBase
|
|
107
102
|
* @returns Returns list of users for a given project
|
108
103
|
*/
|
109
104
|
listUsers(projectId: string): Promise<ProjectUser[]>;
|
105
|
+
getProjectByLinkedProjectId(linkedProjectId: string): Promise<IProject>;
|
110
106
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { API_ACCOUNT_PROJECT_ID_URL, API_ACCOUNT_PROJECT_URL, API_PROJECT_ID_URL, API_PROJECT_OPERATION_ID_URL, API_PROJECT_OPERATION_URL, API_PROJECT_URL, API_PROJECT_USERS_URL, API_TEMPLATE_PROVISION_ID_URL, API_TEMPLATE_PROVISION_URL, } from '../constants/api';
|
2
|
-
import { RocosError,
|
1
|
+
import { API_ACCOUNT_PROJECT_ID_URL, API_ACCOUNT_PROJECT_URL, API_LINKED_PROJECT_URL, API_PROJECT_ID_URL, API_PROJECT_OPERATION_ID_URL, API_PROJECT_OPERATION_URL, API_PROJECT_URL, API_PROJECT_USERS_URL, API_TEMPLATE_PROVISION_ID_URL, API_TEMPLATE_PROVISION_URL, } from '../constants/api';
|
2
|
+
import { errorCodes, RocosError, } from '../models';
|
3
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
4
|
import { RocosLogger } from '../logger/RocosLogger';
|
5
5
|
import { formatServiceUrl } from '../helpers/formatServiceUrl';
|
@@ -157,4 +157,7 @@ export class ProjectService extends BaseServiceAbstract {
|
|
157
157
|
async listUsers(projectId) {
|
158
158
|
return this.callGet(formatServiceUrl(API_PROJECT_USERS_URL, { url: this.config.url, projectId }, this.config.insecure), 'Failed to get project users list.');
|
159
159
|
}
|
160
|
+
async getProjectByLinkedProjectId(linkedProjectId) {
|
161
|
+
return this.callGet(formatServiceUrl(API_LINKED_PROJECT_URL, { url: this.config.url, linkedProjectId }, this.config.insecure), `Failed to get project info for linked project ID: ${linkedProjectId}.`);
|
162
|
+
}
|
160
163
|
}
|