@dronedeploy/rocos-js-sdk 3.0.14 → 3.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/models/Dashboard.d.ts +6 -0
- package/cjs/models/Dashboard.js +2 -0
- package/cjs/models/EventDefinition.d.ts +52 -0
- package/cjs/models/EventDefinition.js +2 -0
- package/cjs/models/RobotProfile.d.ts +6 -0
- package/cjs/models/RobotProfile.js +2 -0
- package/cjs/services/EventService.d.ts +3 -2
- package/cjs/services/EventService.js +0 -4
- package/cjs/services/ProfileService.d.ts +5 -3
- package/cjs/services/ProfileService.js +1 -3
- package/cjs/services/TelemetryService.js +1 -1
- package/esm/models/Dashboard.d.ts +6 -0
- package/esm/models/Dashboard.js +1 -0
- package/esm/models/EventDefinition.d.ts +52 -0
- package/esm/models/EventDefinition.js +1 -0
- package/esm/models/RobotProfile.d.ts +6 -0
- package/esm/models/RobotProfile.js +1 -0
- package/esm/services/EventService.d.ts +3 -2
- package/esm/services/EventService.js +0 -4
- package/esm/services/ProfileService.d.ts +5 -3
- package/esm/services/ProfileService.js +1 -3
- package/esm/services/TelemetryService.js +1 -1
- package/package.json +1 -1
@@ -0,0 +1,52 @@
|
|
1
|
+
export interface EventDefinitionList {
|
2
|
+
type?: 'event-definitions';
|
3
|
+
items: EventDefinition[];
|
4
|
+
version?: string;
|
5
|
+
robotDefinitionId?: string;
|
6
|
+
username?: string;
|
7
|
+
createdAt?: string;
|
8
|
+
updatedAt?: string;
|
9
|
+
}
|
10
|
+
export interface EventDefinition {
|
11
|
+
id: string;
|
12
|
+
actions?: (EventNotificationAction | EventSendCommandAction | EventHttpAction)[];
|
13
|
+
description?: string;
|
14
|
+
enabled?: boolean;
|
15
|
+
minDispatchInterval?: string;
|
16
|
+
name?: string;
|
17
|
+
trigger?: EventTrigger;
|
18
|
+
}
|
19
|
+
export interface EventNotificationAction {
|
20
|
+
level: string;
|
21
|
+
target: {
|
22
|
+
sendInAppNotification: boolean;
|
23
|
+
};
|
24
|
+
title: string;
|
25
|
+
content?: string;
|
26
|
+
}
|
27
|
+
export interface EventSendCommandAction {
|
28
|
+
executeLocally?: boolean;
|
29
|
+
id: string;
|
30
|
+
timeoutMs: string;
|
31
|
+
}
|
32
|
+
export interface EventHttpAction {
|
33
|
+
address: string;
|
34
|
+
method: string;
|
35
|
+
body: string;
|
36
|
+
timeoutMs: string;
|
37
|
+
headers?: {
|
38
|
+
[key: string]: string;
|
39
|
+
};
|
40
|
+
}
|
41
|
+
export interface EventTrigger {
|
42
|
+
expressions?: {
|
43
|
+
operator: string;
|
44
|
+
threshold: number;
|
45
|
+
value: string;
|
46
|
+
}[];
|
47
|
+
mode?: string;
|
48
|
+
sampleInterval?: string;
|
49
|
+
source?: string;
|
50
|
+
useAdvance?: boolean;
|
51
|
+
advancedCondition?: string;
|
52
|
+
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { EventDefinition, EventDefinitionList } from '../models/EventDefinition';
|
1
2
|
import { RocosError } from '../models/RocosError';
|
2
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
4
|
import { IBaseService } from '../models/IBaseService';
|
@@ -40,7 +41,7 @@ export declare class EventService extends BaseServiceAbstract implements IBaseSe
|
|
40
41
|
* @param definitionId - Robot definition Id
|
41
42
|
* @description - Renamed from robotDefGetEventDefinitions
|
42
43
|
*/
|
43
|
-
getDefinitionsForRobotDef(projectId: string, definitionId: string): Promise<
|
44
|
+
getDefinitionsForRobotDef(projectId: string, definitionId: string): Promise<EventDefinitionList>;
|
44
45
|
/**
|
45
46
|
* Update events for a robot definition
|
46
47
|
*
|
@@ -49,5 +50,5 @@ export declare class EventService extends BaseServiceAbstract implements IBaseSe
|
|
49
50
|
* @param model - Payload
|
50
51
|
* @description - Renamed from robotDefAddEventDefinitions
|
51
52
|
*/
|
52
|
-
addDefinitionsForRobotDef(projectId: string, definitionId: string, model:
|
53
|
+
addDefinitionsForRobotDef(projectId: string, definitionId: string, model: EventDefinition[]): Promise<void>;
|
53
54
|
}
|
@@ -67,7 +67,6 @@ class EventService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
67
67
|
* @param definitionId - Robot definition Id
|
68
68
|
* @description - Renamed from robotDefGetEventDefinitions
|
69
69
|
*/
|
70
|
-
// TODO: map the response object
|
71
70
|
async getDefinitionsForRobotDef(projectId, definitionId) {
|
72
71
|
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_EVENT_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), `Failed to get event definitions list for ${projectId}, definitionId ${definitionId}.`);
|
73
72
|
}
|
@@ -79,9 +78,6 @@ class EventService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
79
78
|
* @param model - Payload
|
80
79
|
* @description - Renamed from robotDefAddEventDefinitions
|
81
80
|
*/
|
82
|
-
// TODO: map the request model
|
83
|
-
// TODO: map the response object
|
84
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
85
81
|
async addDefinitionsForRobotDef(projectId, definitionId, model) {
|
86
82
|
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_EVENT_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), model, `Failed to update event definitions for ${projectId}, definitionId ${definitionId}.`);
|
87
83
|
}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import { RocosError } from '../models/RocosError';
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
|
+
import { Dashboard } from '../models/Dashboard';
|
3
4
|
import { IBaseService } from '../models/IBaseService';
|
4
5
|
import { IRocosSDKConfig } from '../models/IRocosSDKConfig';
|
6
|
+
import { RobotProfile } from '../models/RobotProfile';
|
5
7
|
export declare class ProfileService extends BaseServiceAbstract implements IBaseService {
|
6
8
|
constructor(config: IRocosSDKConfig);
|
7
9
|
protected getError(e: Error): RocosError;
|
@@ -20,7 +22,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
20
22
|
* @param projectId - Project Id
|
21
23
|
* @description - Renamed from robotDefsList
|
22
24
|
*/
|
23
|
-
list(projectId: string): Promise<
|
25
|
+
list(projectId: string): Promise<RobotProfile[]>;
|
24
26
|
/**
|
25
27
|
* Delete robot definitions
|
26
28
|
*
|
@@ -95,7 +97,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
95
97
|
* @param profileId - Profile Id
|
96
98
|
* @description - Renamed from robotDefDashboards
|
97
99
|
*/
|
98
|
-
dashboards(projectId: string, profileId: string): Promise<
|
100
|
+
dashboards(projectId: string, profileId: string): Promise<Dashboard[]>;
|
99
101
|
/**
|
100
102
|
* Get Dashboard data which stored in Azure Blob.
|
101
103
|
*
|
@@ -241,7 +243,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
241
243
|
*
|
242
244
|
* @see import
|
243
245
|
*/
|
244
|
-
export(projectId: string, definitionId: string): Promise<
|
246
|
+
export(projectId: string, definitionId: string): Promise<Blob>;
|
245
247
|
/** Import robot definition from JSON format
|
246
248
|
*
|
247
249
|
* Accepts a previously exported robot definition
|
@@ -36,7 +36,6 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
36
36
|
* @param projectId - Project Id
|
37
37
|
* @description - Renamed from robotDefsList
|
38
38
|
*/
|
39
|
-
// TODO: map the response object
|
40
39
|
async list(projectId) {
|
41
40
|
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_URL, { url: this.config.url, projectId }, this.config.insecure), 'Failed to get robot definitions.');
|
42
41
|
}
|
@@ -146,7 +145,6 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
146
145
|
* @param profileId - Profile Id
|
147
146
|
* @description - Renamed from robotDefDashboards
|
148
147
|
*/
|
149
|
-
// TODO: map the response object
|
150
148
|
async dashboards(projectId, profileId) {
|
151
149
|
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_PROFILE_DASHBOARD_URL, { url: this.config.url, projectId, profileId }, this.config.insecure), 'Failed to get dashboards for a profile.');
|
152
150
|
}
|
@@ -358,7 +356,7 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
358
356
|
* @see import
|
359
357
|
*/
|
360
358
|
async export(projectId, definitionId) {
|
361
|
-
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_EXPORT, { url: this.config.url, projectId, definitionId }, this.config.insecure), undefined, `Failed to export robot definition for ${projectId}, definitionId ${definitionId}
|
359
|
+
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_EXPORT, { url: this.config.url, projectId, definitionId }, this.config.insecure), undefined, `Failed to export robot definition for ${projectId}, definitionId ${definitionId}.`, { responseType: 'blob' });
|
362
360
|
}
|
363
361
|
/** Import robot definition from JSON format
|
364
362
|
*
|
@@ -38,7 +38,7 @@ class TelemetryService extends BaseStreamService_1.BaseStreamService {
|
|
38
38
|
*/
|
39
39
|
subscribe(params) {
|
40
40
|
const sources = (0, arrayUnique_1.arrayUnique)(params.sources).map((item) => item.trim()) ?? [];
|
41
|
-
if (!params?.callsigns && params?.query) {
|
41
|
+
if (!params?.callsigns && !params?.query) {
|
42
42
|
this.logger.error('Error: params need to contain either callsigns or query', params);
|
43
43
|
throw new models_1.RocosError('Params need to contain either callsigns or query.', models_1.errorCodes.TELEMETRY_SERVICE_ERROR);
|
44
44
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,52 @@
|
|
1
|
+
export interface EventDefinitionList {
|
2
|
+
type?: 'event-definitions';
|
3
|
+
items: EventDefinition[];
|
4
|
+
version?: string;
|
5
|
+
robotDefinitionId?: string;
|
6
|
+
username?: string;
|
7
|
+
createdAt?: string;
|
8
|
+
updatedAt?: string;
|
9
|
+
}
|
10
|
+
export interface EventDefinition {
|
11
|
+
id: string;
|
12
|
+
actions?: (EventNotificationAction | EventSendCommandAction | EventHttpAction)[];
|
13
|
+
description?: string;
|
14
|
+
enabled?: boolean;
|
15
|
+
minDispatchInterval?: string;
|
16
|
+
name?: string;
|
17
|
+
trigger?: EventTrigger;
|
18
|
+
}
|
19
|
+
export interface EventNotificationAction {
|
20
|
+
level: string;
|
21
|
+
target: {
|
22
|
+
sendInAppNotification: boolean;
|
23
|
+
};
|
24
|
+
title: string;
|
25
|
+
content?: string;
|
26
|
+
}
|
27
|
+
export interface EventSendCommandAction {
|
28
|
+
executeLocally?: boolean;
|
29
|
+
id: string;
|
30
|
+
timeoutMs: string;
|
31
|
+
}
|
32
|
+
export interface EventHttpAction {
|
33
|
+
address: string;
|
34
|
+
method: string;
|
35
|
+
body: string;
|
36
|
+
timeoutMs: string;
|
37
|
+
headers?: {
|
38
|
+
[key: string]: string;
|
39
|
+
};
|
40
|
+
}
|
41
|
+
export interface EventTrigger {
|
42
|
+
expressions?: {
|
43
|
+
operator: string;
|
44
|
+
threshold: number;
|
45
|
+
value: string;
|
46
|
+
}[];
|
47
|
+
mode?: string;
|
48
|
+
sampleInterval?: string;
|
49
|
+
source?: string;
|
50
|
+
useAdvance?: boolean;
|
51
|
+
advancedCondition?: string;
|
52
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { EventDefinition, EventDefinitionList } from '../models/EventDefinition';
|
1
2
|
import { RocosError } from '../models/RocosError';
|
2
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
4
|
import { IBaseService } from '../models/IBaseService';
|
@@ -40,7 +41,7 @@ export declare class EventService extends BaseServiceAbstract implements IBaseSe
|
|
40
41
|
* @param definitionId - Robot definition Id
|
41
42
|
* @description - Renamed from robotDefGetEventDefinitions
|
42
43
|
*/
|
43
|
-
getDefinitionsForRobotDef(projectId: string, definitionId: string): Promise<
|
44
|
+
getDefinitionsForRobotDef(projectId: string, definitionId: string): Promise<EventDefinitionList>;
|
44
45
|
/**
|
45
46
|
* Update events for a robot definition
|
46
47
|
*
|
@@ -49,5 +50,5 @@ export declare class EventService extends BaseServiceAbstract implements IBaseSe
|
|
49
50
|
* @param model - Payload
|
50
51
|
* @description - Renamed from robotDefAddEventDefinitions
|
51
52
|
*/
|
52
|
-
addDefinitionsForRobotDef(projectId: string, definitionId: string, model:
|
53
|
+
addDefinitionsForRobotDef(projectId: string, definitionId: string, model: EventDefinition[]): Promise<void>;
|
53
54
|
}
|
@@ -64,7 +64,6 @@ export class EventService extends BaseServiceAbstract {
|
|
64
64
|
* @param definitionId - Robot definition Id
|
65
65
|
* @description - Renamed from robotDefGetEventDefinitions
|
66
66
|
*/
|
67
|
-
// TODO: map the response object
|
68
67
|
async getDefinitionsForRobotDef(projectId, definitionId) {
|
69
68
|
return this.callGet(formatServiceUrl(API_PROJECT_DEFINITION_EVENT_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), `Failed to get event definitions list for ${projectId}, definitionId ${definitionId}.`);
|
70
69
|
}
|
@@ -76,9 +75,6 @@ export class EventService extends BaseServiceAbstract {
|
|
76
75
|
* @param model - Payload
|
77
76
|
* @description - Renamed from robotDefAddEventDefinitions
|
78
77
|
*/
|
79
|
-
// TODO: map the request model
|
80
|
-
// TODO: map the response object
|
81
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
82
78
|
async addDefinitionsForRobotDef(projectId, definitionId, model) {
|
83
79
|
return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_EVENT_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), model, `Failed to update event definitions for ${projectId}, definitionId ${definitionId}.`);
|
84
80
|
}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import { RocosError } from '../models/RocosError';
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
|
+
import { Dashboard } from '../models/Dashboard';
|
3
4
|
import { IBaseService } from '../models/IBaseService';
|
4
5
|
import { IRocosSDKConfig } from '../models/IRocosSDKConfig';
|
6
|
+
import { RobotProfile } from '../models/RobotProfile';
|
5
7
|
export declare class ProfileService extends BaseServiceAbstract implements IBaseService {
|
6
8
|
constructor(config: IRocosSDKConfig);
|
7
9
|
protected getError(e: Error): RocosError;
|
@@ -20,7 +22,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
20
22
|
* @param projectId - Project Id
|
21
23
|
* @description - Renamed from robotDefsList
|
22
24
|
*/
|
23
|
-
list(projectId: string): Promise<
|
25
|
+
list(projectId: string): Promise<RobotProfile[]>;
|
24
26
|
/**
|
25
27
|
* Delete robot definitions
|
26
28
|
*
|
@@ -95,7 +97,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
95
97
|
* @param profileId - Profile Id
|
96
98
|
* @description - Renamed from robotDefDashboards
|
97
99
|
*/
|
98
|
-
dashboards(projectId: string, profileId: string): Promise<
|
100
|
+
dashboards(projectId: string, profileId: string): Promise<Dashboard[]>;
|
99
101
|
/**
|
100
102
|
* Get Dashboard data which stored in Azure Blob.
|
101
103
|
*
|
@@ -241,7 +243,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
241
243
|
*
|
242
244
|
* @see import
|
243
245
|
*/
|
244
|
-
export(projectId: string, definitionId: string): Promise<
|
246
|
+
export(projectId: string, definitionId: string): Promise<Blob>;
|
245
247
|
/** Import robot definition from JSON format
|
246
248
|
*
|
247
249
|
* Accepts a previously exported robot definition
|
@@ -33,7 +33,6 @@ export class ProfileService extends BaseServiceAbstract {
|
|
33
33
|
* @param projectId - Project Id
|
34
34
|
* @description - Renamed from robotDefsList
|
35
35
|
*/
|
36
|
-
// TODO: map the response object
|
37
36
|
async list(projectId) {
|
38
37
|
return this.callGet(formatServiceUrl(API_PROJECT_DEFINITION_URL, { url: this.config.url, projectId }, this.config.insecure), 'Failed to get robot definitions.');
|
39
38
|
}
|
@@ -143,7 +142,6 @@ export class ProfileService extends BaseServiceAbstract {
|
|
143
142
|
* @param profileId - Profile Id
|
144
143
|
* @description - Renamed from robotDefDashboards
|
145
144
|
*/
|
146
|
-
// TODO: map the response object
|
147
145
|
async dashboards(projectId, profileId) {
|
148
146
|
return this.callGet(formatServiceUrl(API_PROJECT_PROFILE_DASHBOARD_URL, { url: this.config.url, projectId, profileId }, this.config.insecure), 'Failed to get dashboards for a profile.');
|
149
147
|
}
|
@@ -355,7 +353,7 @@ export class ProfileService extends BaseServiceAbstract {
|
|
355
353
|
* @see import
|
356
354
|
*/
|
357
355
|
async export(projectId, definitionId) {
|
358
|
-
return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_EXPORT, { url: this.config.url, projectId, definitionId }, this.config.insecure), undefined, `Failed to export robot definition for ${projectId}, definitionId ${definitionId}
|
356
|
+
return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_EXPORT, { url: this.config.url, projectId, definitionId }, this.config.insecure), undefined, `Failed to export robot definition for ${projectId}, definitionId ${definitionId}.`, { responseType: 'blob' });
|
359
357
|
}
|
360
358
|
/** Import robot definition from JSON format
|
361
359
|
*
|
@@ -35,7 +35,7 @@ export class TelemetryService extends BaseStreamService {
|
|
35
35
|
*/
|
36
36
|
subscribe(params) {
|
37
37
|
const sources = arrayUnique(params.sources).map((item) => item.trim()) ?? [];
|
38
|
-
if (!params?.callsigns && params?.query) {
|
38
|
+
if (!params?.callsigns && !params?.query) {
|
39
39
|
this.logger.error('Error: params need to contain either callsigns or query', params);
|
40
40
|
throw new RocosError('Params need to contain either callsigns or query.', errorCodes.TELEMETRY_SERVICE_ERROR);
|
41
41
|
}
|