@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.
@@ -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}";
@@ -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,5 @@
1
+ export declare class HttpError extends Error {
2
+ response: Response;
3
+ payload: string;
4
+ constructor(response: Response, payload: string);
5
+ }
@@ -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;
@@ -1,4 +1,6 @@
1
1
  export interface IProject {
2
+ id: string;
2
3
  name: string;
4
+ linkedProjectId?: string;
3
5
  description: string;
4
6
  }
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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';
@@ -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/RocosError';
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<any>;
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<IProject>;
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<IProject[]>;
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 RocosError_1 = require("../models/RocosError");
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 RocosError_1.RocosError(e, RocosError_1.errorCodes.PROJECT_SERVICE_ERROR);
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;
@@ -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}";
@@ -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}';
@@ -0,0 +1,5 @@
1
+ export declare class HttpError extends Error {
2
+ response: Response;
3
+ payload: string;
4
+ constructor(response: Response, payload: string);
5
+ }
@@ -0,0 +1,8 @@
1
+ export class HttpError extends Error {
2
+ constructor(response, payload) {
3
+ super(response.statusText);
4
+ this.response = response;
5
+ this.payload = payload;
6
+ this.name = 'HttpError';
7
+ }
8
+ }
@@ -1,4 +1,6 @@
1
1
  export interface IProject {
2
+ id: string;
2
3
  name: string;
4
+ linkedProjectId?: string;
3
5
  description: string;
4
6
  }
@@ -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 {};
@@ -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';
@@ -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/RocosError';
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<any>;
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<IProject>;
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<IProject[]>;
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, errorCodes } from '../models/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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "3.0.1-alpha.7",
3
+ "version": "3.0.1-alpha.8",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",