@dronedeploy/rocos-js-sdk 3.0.1-alpha.7 → 3.0.1-alpha.9
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/asset-storage/SyncIntegrations.d.ts +1 -1
- package/cjs/models/index.d.ts +2 -0
- package/cjs/models/index.js +2 -0
- package/cjs/services/AssetStorageService.d.ts +10 -18
- package/cjs/services/AssetStorageService.js +8 -8
- package/cjs/services/BaseServiceAbstract.d.ts +1 -1
- package/cjs/services/BaseServiceAbstract.js +4 -11
- 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/asset-storage/SyncIntegrations.d.ts +1 -1
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/services/AssetStorageService.d.ts +10 -18
- package/esm/services/AssetStorageService.js +7 -7
- package/esm/services/BaseServiceAbstract.d.ts +1 -1
- package/esm/services/BaseServiceAbstract.js +4 -11
- 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);
|
@@ -1,9 +1,5 @@
|
|
1
|
-
import { AssetItemModel, AssetItemWithObservationsModel,
|
2
|
-
import { RocosError } from '../models/RocosError';
|
1
|
+
import { AssetItemModel, AssetItemWithObservationsModel, AssetSyncDefinitionsModel, AssetSyncIntegrationModel, AssetSyncIntegrationProviderModel, CreateAssetSyncIntegrationModel, IBaseService, IRocosSDKConfig, RocosError } from '../models';
|
3
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
|
-
import { IBaseService } from '../models/IBaseService';
|
5
|
-
import { IRocosSDKConfig } from '../models/IRocosSDKConfig';
|
6
|
-
import { CreateAssetSyncIntegrationModel } from '../models/asset-storage/SyncIntegrations';
|
7
3
|
export declare class AssetStorageService extends BaseServiceAbstract implements IBaseService {
|
8
4
|
constructor(config: IRocosSDKConfig);
|
9
5
|
protected getError(e: Error): RocosError;
|
@@ -15,7 +11,7 @@ export declare class AssetStorageService extends BaseServiceAbstract implements
|
|
15
11
|
* @param filePath - Path to asset file
|
16
12
|
* @param file - File payload
|
17
13
|
*/
|
18
|
-
create(projectId: string, filePath: string, file: File): Promise<
|
14
|
+
create(projectId: string, filePath: string, file: File): Promise<AssetItemModel>;
|
19
15
|
/**
|
20
16
|
* Update a project asset
|
21
17
|
*
|
@@ -23,28 +19,23 @@ export declare class AssetStorageService extends BaseServiceAbstract implements
|
|
23
19
|
* @param filePath - Path to asset file
|
24
20
|
* @param file - File payload
|
25
21
|
*/
|
26
|
-
update(projectId: string, filePath: string, file: File): Promise<
|
22
|
+
update(projectId: string, filePath: string, file: File): Promise<AssetItemModel>;
|
27
23
|
/**
|
28
24
|
* Delete a project asset
|
29
25
|
*
|
30
26
|
* @param projectId - Project Id
|
31
27
|
* @param filePath - Path to asset file
|
32
28
|
*/
|
33
|
-
delete(projectId: string, filePath: string): Promise<
|
34
|
-
|
35
|
-
|
36
|
-
*
|
37
|
-
* @param projectId - Project Id
|
38
|
-
* @param filePath - Path to asset file
|
39
|
-
*/
|
40
|
-
list(projectId: string, filePath?: string): Promise<any>;
|
29
|
+
delete(projectId: string, filePath: string): Promise<unknown>;
|
30
|
+
list(projectId: string): Promise<AssetItemModel[]>;
|
31
|
+
list(projectId: string, filePath: string): Promise<unknown>;
|
41
32
|
/**
|
42
33
|
* Get a project asset
|
43
34
|
*
|
44
35
|
* @param projectId - Project Id
|
45
36
|
* @param filePath - Path to asset file
|
46
37
|
*/
|
47
|
-
getAsset(projectId: string, filePath: string): Promise<
|
38
|
+
getAsset(projectId: string, filePath: string): Promise<Blob>;
|
48
39
|
/**
|
49
40
|
* List assets for a robot
|
50
41
|
*
|
@@ -91,8 +82,9 @@ export declare class AssetStorageService extends BaseServiceAbstract implements
|
|
91
82
|
* @param projectId
|
92
83
|
* @param callsign
|
93
84
|
* @param definition
|
85
|
+
* @param syncNow - Sync configured paths immediately
|
94
86
|
*/
|
95
|
-
setRobotSyncDefinitions(projectId: string, callsign: string, definition:
|
87
|
+
setRobotSyncDefinitions(projectId: string, callsign: string, definition: AssetSyncDefinitionsModel, syncNow?: boolean): Promise<AssetSyncDefinitionsModel>;
|
96
88
|
/**
|
97
89
|
* Get Robot Sync Definitions
|
98
90
|
* @param projectId
|
@@ -105,7 +97,7 @@ export declare class AssetStorageService extends BaseServiceAbstract implements
|
|
105
97
|
* @param profileId
|
106
98
|
* @param definition
|
107
99
|
*/
|
108
|
-
setProfileSyncDefinitions(projectId: string, profileId: string, definition:
|
100
|
+
setProfileSyncDefinitions(projectId: string, profileId: string, definition: AssetSyncDefinitionsModel): Promise<AssetSyncDefinitionsModel>;
|
109
101
|
/**
|
110
102
|
* Get Profile Sync Definitions
|
111
103
|
* @param projectId
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.AssetStorageService = 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 AssetStorageService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
12
12
|
this.logger = RocosLogger_1.RocosLogger.getInstance(`AssetStorageService(${this.config.url})`);
|
13
13
|
}
|
14
14
|
getError(e) {
|
15
|
-
return new
|
15
|
+
return new models_1.RocosError(e, models_1.errorCodes.ASSET_STORAGE_SERVICE_ERROR);
|
16
16
|
}
|
17
17
|
getStatus() {
|
18
18
|
return true;
|
@@ -24,7 +24,6 @@ class AssetStorageService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
24
24
|
* @param filePath - Path to asset file
|
25
25
|
* @param file - File payload
|
26
26
|
*/
|
27
|
-
// TODO: map the response object
|
28
27
|
async create(projectId, filePath, file) {
|
29
28
|
const formData = new FormData();
|
30
29
|
formData.append('file', file);
|
@@ -37,7 +36,6 @@ class AssetStorageService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
37
36
|
* @param filePath - Path to asset file
|
38
37
|
* @param file - File payload
|
39
38
|
*/
|
40
|
-
// TODO: map the response object
|
41
39
|
async update(projectId, filePath, file) {
|
42
40
|
const formData = new FormData();
|
43
41
|
formData.append('file', file);
|
@@ -59,7 +57,6 @@ class AssetStorageService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
59
57
|
* @param projectId - Project Id
|
60
58
|
* @param filePath - Path to asset file
|
61
59
|
*/
|
62
|
-
// TODO: map the response object
|
63
60
|
async list(projectId, filePath) {
|
64
61
|
let url = '';
|
65
62
|
if (filePath) {
|
@@ -76,7 +73,6 @@ class AssetStorageService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
76
73
|
* @param projectId - Project Id
|
77
74
|
* @param filePath - Path to asset file
|
78
75
|
*/
|
79
|
-
// TODO: map the response object
|
80
76
|
async getAsset(projectId, filePath) {
|
81
77
|
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ASSET_PATH_URL, { url: this.config.url, projectId, filePath }, this.config.insecure), `Failed to get asset for ${projectId}, filePath ${filePath}.`, undefined, {
|
82
78
|
responseType: 'blob',
|
@@ -143,14 +139,18 @@ class AssetStorageService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
143
139
|
* @param projectId
|
144
140
|
* @param callsign
|
145
141
|
* @param definition
|
142
|
+
* @param syncNow - Sync configured paths immediately
|
146
143
|
*/
|
147
|
-
setRobotSyncDefinitions(projectId, callsign, definition) {
|
144
|
+
setRobotSyncDefinitions(projectId, callsign, definition, syncNow = false) {
|
145
|
+
const url = (0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL, { url: this.config.url, projectId, callsign }, this.config.insecure);
|
148
146
|
const httpOptions = {
|
149
147
|
headers: {
|
150
148
|
'content-type': 'application/json',
|
151
149
|
},
|
152
150
|
};
|
153
|
-
return this.callPost(
|
151
|
+
return this.callPost(url, definition, `Failed to update asset for ${projectId}, callsign ${callsign}.`, httpOptions, {
|
152
|
+
syncNow,
|
153
|
+
});
|
154
154
|
}
|
155
155
|
/**
|
156
156
|
* Get Robot Sync Definitions
|
@@ -21,7 +21,7 @@ export declare abstract class BaseServiceAbstract {
|
|
21
21
|
protected logger: Logger;
|
22
22
|
protected constructor(config: IRocosSDKConfig);
|
23
23
|
protected abstract getError(e: Error): RocosError;
|
24
|
-
protected callPost<Response = unknown, Payload = unknown>(url: string, payload: Payload, errorMessage: string, config?: RequestConfig): Promise<Response>;
|
24
|
+
protected callPost<Response = unknown, Payload = unknown>(url: string, payload: Payload, errorMessage: string, config?: RequestConfig, params?: QueryParams): Promise<Response>;
|
25
25
|
protected callPut<Response = unknown, Payload = unknown>(url: string, payload: Payload, errorMessage: string, config?: RequestConfig): Promise<Response>;
|
26
26
|
protected callDelete<Response = unknown, Payload = unknown>(url: string, errorMessage: string, payload?: Payload): Promise<Response>;
|
27
27
|
protected callGet<Response = unknown>(url: string, errorMessage: string, params?: QueryParams, config?: RequestConfig): Promise<Response>;
|
@@ -4,19 +4,12 @@ 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;
|
17
10
|
}
|
18
|
-
async callPost(url, payload, errorMessage, config) {
|
19
|
-
return this.call(url, 'POST', { errorMessage, payload, config });
|
11
|
+
async callPost(url, payload, errorMessage, config, params) {
|
12
|
+
return this.call(url, 'POST', { errorMessage, payload, config, params });
|
20
13
|
}
|
21
14
|
async callPut(url, payload, errorMessage, config) {
|
22
15
|
return this.call(url, 'PUT', { errorMessage, payload, 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,9 +1,5 @@
|
|
1
|
-
import { AssetItemModel, AssetItemWithObservationsModel,
|
2
|
-
import { RocosError } from '../models/RocosError';
|
1
|
+
import { AssetItemModel, AssetItemWithObservationsModel, AssetSyncDefinitionsModel, AssetSyncIntegrationModel, AssetSyncIntegrationProviderModel, CreateAssetSyncIntegrationModel, IBaseService, IRocosSDKConfig, RocosError } from '../models';
|
3
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
|
-
import { IBaseService } from '../models/IBaseService';
|
5
|
-
import { IRocosSDKConfig } from '../models/IRocosSDKConfig';
|
6
|
-
import { CreateAssetSyncIntegrationModel } from '../models/asset-storage/SyncIntegrations';
|
7
3
|
export declare class AssetStorageService extends BaseServiceAbstract implements IBaseService {
|
8
4
|
constructor(config: IRocosSDKConfig);
|
9
5
|
protected getError(e: Error): RocosError;
|
@@ -15,7 +11,7 @@ export declare class AssetStorageService extends BaseServiceAbstract implements
|
|
15
11
|
* @param filePath - Path to asset file
|
16
12
|
* @param file - File payload
|
17
13
|
*/
|
18
|
-
create(projectId: string, filePath: string, file: File): Promise<
|
14
|
+
create(projectId: string, filePath: string, file: File): Promise<AssetItemModel>;
|
19
15
|
/**
|
20
16
|
* Update a project asset
|
21
17
|
*
|
@@ -23,28 +19,23 @@ export declare class AssetStorageService extends BaseServiceAbstract implements
|
|
23
19
|
* @param filePath - Path to asset file
|
24
20
|
* @param file - File payload
|
25
21
|
*/
|
26
|
-
update(projectId: string, filePath: string, file: File): Promise<
|
22
|
+
update(projectId: string, filePath: string, file: File): Promise<AssetItemModel>;
|
27
23
|
/**
|
28
24
|
* Delete a project asset
|
29
25
|
*
|
30
26
|
* @param projectId - Project Id
|
31
27
|
* @param filePath - Path to asset file
|
32
28
|
*/
|
33
|
-
delete(projectId: string, filePath: string): Promise<
|
34
|
-
|
35
|
-
|
36
|
-
*
|
37
|
-
* @param projectId - Project Id
|
38
|
-
* @param filePath - Path to asset file
|
39
|
-
*/
|
40
|
-
list(projectId: string, filePath?: string): Promise<any>;
|
29
|
+
delete(projectId: string, filePath: string): Promise<unknown>;
|
30
|
+
list(projectId: string): Promise<AssetItemModel[]>;
|
31
|
+
list(projectId: string, filePath: string): Promise<unknown>;
|
41
32
|
/**
|
42
33
|
* Get a project asset
|
43
34
|
*
|
44
35
|
* @param projectId - Project Id
|
45
36
|
* @param filePath - Path to asset file
|
46
37
|
*/
|
47
|
-
getAsset(projectId: string, filePath: string): Promise<
|
38
|
+
getAsset(projectId: string, filePath: string): Promise<Blob>;
|
48
39
|
/**
|
49
40
|
* List assets for a robot
|
50
41
|
*
|
@@ -91,8 +82,9 @@ export declare class AssetStorageService extends BaseServiceAbstract implements
|
|
91
82
|
* @param projectId
|
92
83
|
* @param callsign
|
93
84
|
* @param definition
|
85
|
+
* @param syncNow - Sync configured paths immediately
|
94
86
|
*/
|
95
|
-
setRobotSyncDefinitions(projectId: string, callsign: string, definition:
|
87
|
+
setRobotSyncDefinitions(projectId: string, callsign: string, definition: AssetSyncDefinitionsModel, syncNow?: boolean): Promise<AssetSyncDefinitionsModel>;
|
96
88
|
/**
|
97
89
|
* Get Robot Sync Definitions
|
98
90
|
* @param projectId
|
@@ -105,7 +97,7 @@ export declare class AssetStorageService extends BaseServiceAbstract implements
|
|
105
97
|
* @param profileId
|
106
98
|
* @param definition
|
107
99
|
*/
|
108
|
-
setProfileSyncDefinitions(projectId: string, profileId: string, definition:
|
100
|
+
setProfileSyncDefinitions(projectId: string, profileId: string, definition: AssetSyncDefinitionsModel): Promise<AssetSyncDefinitionsModel>;
|
109
101
|
/**
|
110
102
|
* Get Profile Sync Definitions
|
111
103
|
* @param projectId
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { API_PROJECT_ASSET_INTEGRATIONS_PATH_URL, API_PROJECT_ASSET_INTEGRATION_PATH_URL, API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL, API_PROJECT_ASSET_PATH_URL, API_PROJECT_ASSET_PROFILES_SYNC_DEFINITION_PATH_URL, API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL, API_PROJECT_ASSET_URL, API_PROJECT_FLOW_ASSET_PATH_URL, API_PROJECT_MAPPED_ASSETS_PATH_URL, API_PROJECT_MISSION_ASSETS_PATH_URL, API_PROJECT_MISSION_ASSET_PATH_URL, API_PROJECT_ROBOT_ASSET_PATH_URL, } from '../constants/api';
|
2
|
-
import { RocosError, errorCodes } from '../models
|
2
|
+
import { RocosError, errorCodes, } from '../models';
|
3
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
4
|
import { RocosLogger } from '../logger/RocosLogger';
|
5
5
|
import { formatServiceUrl } from '../helpers/formatServiceUrl';
|
@@ -21,7 +21,6 @@ export class AssetStorageService extends BaseServiceAbstract {
|
|
21
21
|
* @param filePath - Path to asset file
|
22
22
|
* @param file - File payload
|
23
23
|
*/
|
24
|
-
// TODO: map the response object
|
25
24
|
async create(projectId, filePath, file) {
|
26
25
|
const formData = new FormData();
|
27
26
|
formData.append('file', file);
|
@@ -34,7 +33,6 @@ export class AssetStorageService extends BaseServiceAbstract {
|
|
34
33
|
* @param filePath - Path to asset file
|
35
34
|
* @param file - File payload
|
36
35
|
*/
|
37
|
-
// TODO: map the response object
|
38
36
|
async update(projectId, filePath, file) {
|
39
37
|
const formData = new FormData();
|
40
38
|
formData.append('file', file);
|
@@ -56,7 +54,6 @@ export class AssetStorageService extends BaseServiceAbstract {
|
|
56
54
|
* @param projectId - Project Id
|
57
55
|
* @param filePath - Path to asset file
|
58
56
|
*/
|
59
|
-
// TODO: map the response object
|
60
57
|
async list(projectId, filePath) {
|
61
58
|
let url = '';
|
62
59
|
if (filePath) {
|
@@ -73,7 +70,6 @@ export class AssetStorageService extends BaseServiceAbstract {
|
|
73
70
|
* @param projectId - Project Id
|
74
71
|
* @param filePath - Path to asset file
|
75
72
|
*/
|
76
|
-
// TODO: map the response object
|
77
73
|
async getAsset(projectId, filePath) {
|
78
74
|
return this.callGet(formatServiceUrl(API_PROJECT_ASSET_PATH_URL, { url: this.config.url, projectId, filePath }, this.config.insecure), `Failed to get asset for ${projectId}, filePath ${filePath}.`, undefined, {
|
79
75
|
responseType: 'blob',
|
@@ -140,14 +136,18 @@ export class AssetStorageService extends BaseServiceAbstract {
|
|
140
136
|
* @param projectId
|
141
137
|
* @param callsign
|
142
138
|
* @param definition
|
139
|
+
* @param syncNow - Sync configured paths immediately
|
143
140
|
*/
|
144
|
-
setRobotSyncDefinitions(projectId, callsign, definition) {
|
141
|
+
setRobotSyncDefinitions(projectId, callsign, definition, syncNow = false) {
|
142
|
+
const url = formatServiceUrl(API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL, { url: this.config.url, projectId, callsign }, this.config.insecure);
|
145
143
|
const httpOptions = {
|
146
144
|
headers: {
|
147
145
|
'content-type': 'application/json',
|
148
146
|
},
|
149
147
|
};
|
150
|
-
return this.callPost(
|
148
|
+
return this.callPost(url, definition, `Failed to update asset for ${projectId}, callsign ${callsign}.`, httpOptions, {
|
149
|
+
syncNow,
|
150
|
+
});
|
151
151
|
}
|
152
152
|
/**
|
153
153
|
* Get Robot Sync Definitions
|
@@ -21,7 +21,7 @@ export declare abstract class BaseServiceAbstract {
|
|
21
21
|
protected logger: Logger;
|
22
22
|
protected constructor(config: IRocosSDKConfig);
|
23
23
|
protected abstract getError(e: Error): RocosError;
|
24
|
-
protected callPost<Response = unknown, Payload = unknown>(url: string, payload: Payload, errorMessage: string, config?: RequestConfig): Promise<Response>;
|
24
|
+
protected callPost<Response = unknown, Payload = unknown>(url: string, payload: Payload, errorMessage: string, config?: RequestConfig, params?: QueryParams): Promise<Response>;
|
25
25
|
protected callPut<Response = unknown, Payload = unknown>(url: string, payload: Payload, errorMessage: string, config?: RequestConfig): Promise<Response>;
|
26
26
|
protected callDelete<Response = unknown, Payload = unknown>(url: string, errorMessage: string, payload?: Payload): Promise<Response>;
|
27
27
|
protected callGet<Response = unknown>(url: string, errorMessage: string, params?: QueryParams, config?: RequestConfig): Promise<Response>;
|
@@ -1,19 +1,12 @@
|
|
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;
|
14
7
|
}
|
15
|
-
async callPost(url, payload, errorMessage, config) {
|
16
|
-
return this.call(url, 'POST', { errorMessage, payload, config });
|
8
|
+
async callPost(url, payload, errorMessage, config, params) {
|
9
|
+
return this.call(url, 'POST', { errorMessage, payload, config, params });
|
17
10
|
}
|
18
11
|
async callPut(url, payload, errorMessage, config) {
|
19
12
|
return this.call(url, 'PUT', { errorMessage, payload, 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
|
}
|