@dronedeploy/rocos-js-sdk 3.0.1-alpha.8 → 3.0.1-alpha.9
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/models/asset-storage/SyncIntegrations.d.ts +1 -1
- 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 +2 -2
- package/esm/models/asset-storage/SyncIntegrations.d.ts +1 -1
- 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 +2 -2
- package/package.json +1 -1
@@ -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>;
|
@@ -8,8 +8,8 @@ class BaseServiceAbstract {
|
|
8
8
|
constructor(config) {
|
9
9
|
this.config = config;
|
10
10
|
}
|
11
|
-
async callPost(url, payload, errorMessage, config) {
|
12
|
-
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 });
|
13
13
|
}
|
14
14
|
async callPut(url, payload, errorMessage, config) {
|
15
15
|
return this.call(url, 'PUT', { errorMessage, payload, config });
|
@@ -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>;
|
@@ -5,8 +5,8 @@ export class BaseServiceAbstract {
|
|
5
5
|
constructor(config) {
|
6
6
|
this.config = config;
|
7
7
|
}
|
8
|
-
async callPost(url, payload, errorMessage, config) {
|
9
|
-
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 });
|
10
10
|
}
|
11
11
|
async callPut(url, payload, errorMessage, config) {
|
12
12
|
return this.call(url, 'PUT', { errorMessage, payload, config });
|