@dronedeploy/rocos-js-sdk 3.0.1-alpha.14 → 3.0.1-alpha.15
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/IRocosSDK.d.ts +1 -2
- package/cjs/RocosSDK.d.ts +1 -5
- package/cjs/RocosSDK.js +0 -9
- package/cjs/constants/api.d.ts +0 -4
- package/cjs/constants/api.js +2 -6
- package/cjs/models/TelemetryStatus.d.ts +12 -0
- package/cjs/models/TelemetryStatus.js +17 -0
- package/cjs/models/Token.d.ts +2 -2
- package/cjs/models/Token.js +5 -5
- package/cjs/models/index.d.ts +1 -1
- package/cjs/models/index.js +1 -1
- package/cjs/node/RocosSDKNode.js +0 -3
- package/cjs/services/TelemetryService.d.ts +10 -1
- package/cjs/services/TelemetryService.js +27 -5
- package/cjs/services/index.d.ts +0 -1
- package/cjs/services/index.js +0 -1
- package/esm/IRocosSDK.d.ts +1 -2
- package/esm/RocosSDK.d.ts +1 -5
- package/esm/RocosSDK.js +1 -10
- package/esm/constants/api.d.ts +0 -4
- package/esm/constants/api.js +0 -4
- package/esm/models/TelemetryStatus.d.ts +12 -0
- package/esm/models/TelemetryStatus.js +14 -0
- package/esm/models/Token.d.ts +2 -2
- package/esm/models/Token.js +5 -5
- package/esm/models/index.d.ts +1 -1
- package/esm/models/index.js +1 -1
- package/esm/node/RocosSDKNode.js +1 -4
- package/esm/services/TelemetryService.d.ts +10 -1
- package/esm/services/TelemetryService.js +28 -6
- package/esm/services/index.d.ts +0 -1
- package/esm/services/index.js +0 -1
- package/package.json +1 -2
- package/cjs/models/CallsignStatus.d.ts +0 -6
- package/cjs/models/CallsignStatus.js +0 -10
- package/cjs/services/FunctionService.d.ts +0 -68
- package/cjs/services/FunctionService.js +0 -103
- package/esm/models/CallsignStatus.d.ts +0 -6
- package/esm/models/CallsignStatus.js +0 -7
- package/esm/services/FunctionService.d.ts +0 -68
- package/esm/services/FunctionService.js +0 -99
package/cjs/IRocosSDK.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService,
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
2
2
|
import { IBaseService, IDebugLevel, ServiceEnum } from './models';
|
3
3
|
import { RTPWebRTCService } from './services/RTPWebRTCService';
|
4
4
|
export declare abstract class IRocosSDK {
|
@@ -14,7 +14,6 @@ export declare abstract class IRocosSDK {
|
|
14
14
|
abstract getSearchService(): SearchService;
|
15
15
|
abstract getConfigGroupService(): ConfigGroupService;
|
16
16
|
abstract getDashboardService(): DashboardService;
|
17
|
-
abstract getFunctionService(): FunctionService;
|
18
17
|
abstract getStreamService(): StreamService;
|
19
18
|
abstract getUserService(): UserService;
|
20
19
|
abstract getMapService(): MapService;
|
package/cjs/RocosSDK.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService,
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
2
2
|
import { AuthorisedConfig, IBaseService, IDebugLevel, IRocosSDKConfig, ServiceEnum } from './models';
|
3
3
|
import { IRocosSDK } from './IRocosSDK';
|
4
4
|
import { Logger } from 'loglevel';
|
@@ -62,10 +62,6 @@ export declare class RocosSDK implements IRocosSDK {
|
|
62
62
|
* Gets the dashboard service
|
63
63
|
*/
|
64
64
|
getDashboardService(): DashboardService;
|
65
|
-
/**
|
66
|
-
* Gets the function service
|
67
|
-
*/
|
68
|
-
getFunctionService(): FunctionService;
|
69
65
|
/**
|
70
66
|
* Gets the stream service
|
71
67
|
*/
|
package/cjs/RocosSDK.js
CHANGED
@@ -62,9 +62,6 @@ class RocosSDK {
|
|
62
62
|
case models_1.ServiceEnum.DASHBOARD:
|
63
63
|
this.services[name] = new services_1.DashboardService(config);
|
64
64
|
break;
|
65
|
-
case models_1.ServiceEnum.FUNCTION:
|
66
|
-
this.services[name] = new services_1.FunctionService(config);
|
67
|
-
break;
|
68
65
|
case models_1.ServiceEnum.STREAM:
|
69
66
|
this.services[name] = new services_1.StreamService(config);
|
70
67
|
break;
|
@@ -178,12 +175,6 @@ class RocosSDK {
|
|
178
175
|
getDashboardService() {
|
179
176
|
return this.getService(models_1.ServiceEnum.DASHBOARD);
|
180
177
|
}
|
181
|
-
/**
|
182
|
-
* Gets the function service
|
183
|
-
*/
|
184
|
-
getFunctionService() {
|
185
|
-
return this.getService(models_1.ServiceEnum.FUNCTION);
|
186
|
-
}
|
187
178
|
/**
|
188
179
|
* Gets the stream service
|
189
180
|
*/
|
package/cjs/constants/api.d.ts
CHANGED
@@ -91,10 +91,6 @@ export declare const API_PROJECT_GROUP_TYPE_CONFIG_URL = "https://{url}/projects
|
|
91
91
|
export declare const API_PROJECT_GROUP_TYPE_VERSION_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{version}";
|
92
92
|
export declare const API_PROJECT_GROUP_TYPE_OWNER_ID_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/owner/{ownerId}";
|
93
93
|
export declare const API_PROJECT_GROUP_TYPE_OWNER_OVERRIDE_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{ownerId}/override";
|
94
|
-
export declare const API_PROJECT_FUNCTION_URL = "https://{url}/projects/{projectId}/functions";
|
95
|
-
export declare const API_PROJECT_FUNCTION_ID_URL = "https://{url}/projects/{projectId}/functions/{functionId}";
|
96
|
-
export declare const API_PROJECT_FUNCTION_RUN_URL = "https://{url}/projects/{projectId}/functions/{functionId}/run";
|
97
|
-
export declare const API_PROJECT_FUNCTION_POD_URL = "https://{url}/projects/{projectId}/functions/{functionId}/pods";
|
98
94
|
export declare const API_PROJECT_EXPORT_URL = "https://{url}/projects/{projectId}/export-jobs";
|
99
95
|
export declare const API_PROJECT_STREAM_URL = "https://{url}/projects/{projectId}/streams";
|
100
96
|
export declare const API_PROJECT_STREAM_ID_URL = "https://{url}/projects/{projectId}/streams/{streamId}";
|
package/cjs/constants/api.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
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
|
-
exports.
|
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 =
|
4
|
+
exports.API_PROJECT_ROBOT_DASHBOARD_ID_URL = exports.API_PROJECT_ROBOT_DASHBOARD_URL = 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_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_IMPORT = exports.API_PROJECT_DEFINITION_EXPORT = 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_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 = 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';
|
@@ -96,10 +96,6 @@ exports.API_PROJECT_GROUP_TYPE_CONFIG_URL = 'https://{url}/projects/{projectId}/
|
|
96
96
|
exports.API_PROJECT_GROUP_TYPE_VERSION_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{version}';
|
97
97
|
exports.API_PROJECT_GROUP_TYPE_OWNER_ID_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/owner/{ownerId}';
|
98
98
|
exports.API_PROJECT_GROUP_TYPE_OWNER_OVERRIDE_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{ownerId}/override';
|
99
|
-
exports.API_PROJECT_FUNCTION_URL = 'https://{url}/projects/{projectId}/functions';
|
100
|
-
exports.API_PROJECT_FUNCTION_ID_URL = 'https://{url}/projects/{projectId}/functions/{functionId}';
|
101
|
-
exports.API_PROJECT_FUNCTION_RUN_URL = 'https://{url}/projects/{projectId}/functions/{functionId}/run';
|
102
|
-
exports.API_PROJECT_FUNCTION_POD_URL = 'https://{url}/projects/{projectId}/functions/{functionId}/pods';
|
103
99
|
exports.API_PROJECT_EXPORT_URL = 'https://{url}/projects/{projectId}/export-jobs';
|
104
100
|
exports.API_PROJECT_STREAM_URL = 'https://{url}/projects/{projectId}/streams';
|
105
101
|
exports.API_PROJECT_STREAM_ID_URL = 'https://{url}/projects/{projectId}/streams/{streamId}';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export declare enum TelemetryMonitorStatus {
|
2
|
+
UNKNOWN = "unknown",
|
3
|
+
CONNECTED = "connected",
|
4
|
+
DISCONNECTED = "disconnected",
|
5
|
+
ERROR = "error"
|
6
|
+
}
|
7
|
+
export declare enum CallsignStatus {
|
8
|
+
UNKNOWN = "unknown",
|
9
|
+
ONLINE = "online",
|
10
|
+
OFFLINE = "offline",
|
11
|
+
ERROR = "error"
|
12
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.CallsignStatus = exports.TelemetryMonitorStatus = void 0;
|
4
|
+
var TelemetryMonitorStatus;
|
5
|
+
(function (TelemetryMonitorStatus) {
|
6
|
+
TelemetryMonitorStatus["UNKNOWN"] = "unknown";
|
7
|
+
TelemetryMonitorStatus["CONNECTED"] = "connected";
|
8
|
+
TelemetryMonitorStatus["DISCONNECTED"] = "disconnected";
|
9
|
+
TelemetryMonitorStatus["ERROR"] = "error";
|
10
|
+
})(TelemetryMonitorStatus || (exports.TelemetryMonitorStatus = TelemetryMonitorStatus = {}));
|
11
|
+
var CallsignStatus;
|
12
|
+
(function (CallsignStatus) {
|
13
|
+
CallsignStatus["UNKNOWN"] = "unknown";
|
14
|
+
CallsignStatus["ONLINE"] = "online";
|
15
|
+
CallsignStatus["OFFLINE"] = "offline";
|
16
|
+
CallsignStatus["ERROR"] = "error";
|
17
|
+
})(CallsignStatus || (exports.CallsignStatus = CallsignStatus = {}));
|
package/cjs/models/Token.d.ts
CHANGED
@@ -31,10 +31,10 @@ export declare class Token implements IToken {
|
|
31
31
|
isExpiredIn(threshold?: number, unit?: 'minutes' | 'seconds' | 'hours'): boolean;
|
32
32
|
isExpired(): boolean;
|
33
33
|
private getJWTPayload;
|
34
|
-
/** Decode a
|
34
|
+
/** Decode a base64url string.
|
35
35
|
*
|
36
36
|
* Supports both Node.js and browser environments.
|
37
37
|
* @private
|
38
38
|
*/
|
39
|
-
private
|
39
|
+
private decodeBase64URL;
|
40
40
|
}
|
package/cjs/models/Token.js
CHANGED
@@ -54,7 +54,7 @@ class Token {
|
|
54
54
|
throw new Error('Invalid token, too many parts');
|
55
55
|
}
|
56
56
|
const [header, payload] = parts.slice(0, 2).map((part) => {
|
57
|
-
return JSON.parse(this.
|
57
|
+
return JSON.parse(this.decodeBase64URL(part));
|
58
58
|
});
|
59
59
|
if (typeof payload !== 'object') {
|
60
60
|
throw new Error('Invalid token, payload must be an object');
|
@@ -67,16 +67,16 @@ class Token {
|
|
67
67
|
}
|
68
68
|
return payload;
|
69
69
|
}
|
70
|
-
/** Decode a
|
70
|
+
/** Decode a base64url string.
|
71
71
|
*
|
72
72
|
* Supports both Node.js and browser environments.
|
73
73
|
* @private
|
74
74
|
*/
|
75
|
-
|
75
|
+
decodeBase64URL(base64String) {
|
76
76
|
if (enviroment_1.isNode) {
|
77
|
-
return Buffer.from(base64String, '
|
77
|
+
return Buffer.from(base64String, 'base64url').toString('utf-8');
|
78
78
|
}
|
79
|
-
return atob(base64String);
|
79
|
+
return atob(base64String.replace(/-/g, '+').replace(/_/g, '/'));
|
80
80
|
}
|
81
81
|
}
|
82
82
|
exports.Token = Token;
|
package/cjs/models/index.d.ts
CHANGED
@@ -33,7 +33,6 @@ export * from './integrations/Plan';
|
|
33
33
|
export * from './maps/Map';
|
34
34
|
export * from './maps/Panorama';
|
35
35
|
export * from './projects/ProjectUser';
|
36
|
-
export * from './CallsignStatus';
|
37
36
|
export * from './ExportDataQuery';
|
38
37
|
export * from './HttpError';
|
39
38
|
export * from './IBaseService';
|
@@ -73,6 +72,7 @@ export * from './Stream';
|
|
73
72
|
export * from './StreamOptions';
|
74
73
|
export * from './StreamSource';
|
75
74
|
export * from './SubscriberStatusEnum';
|
75
|
+
export * from './TelemetryStatus';
|
76
76
|
export * from './Token';
|
77
77
|
export * from './types';
|
78
78
|
export * from './Widget';
|
package/cjs/models/index.js
CHANGED
@@ -49,7 +49,6 @@ __exportStar(require("./integrations/Plan"), exports);
|
|
49
49
|
__exportStar(require("./maps/Map"), exports);
|
50
50
|
__exportStar(require("./maps/Panorama"), exports);
|
51
51
|
__exportStar(require("./projects/ProjectUser"), exports);
|
52
|
-
__exportStar(require("./CallsignStatus"), exports);
|
53
52
|
__exportStar(require("./ExportDataQuery"), exports);
|
54
53
|
__exportStar(require("./HttpError"), exports);
|
55
54
|
__exportStar(require("./IBaseService"), exports);
|
@@ -89,6 +88,7 @@ __exportStar(require("./Stream"), exports);
|
|
89
88
|
__exportStar(require("./StreamOptions"), exports);
|
90
89
|
__exportStar(require("./StreamSource"), exports);
|
91
90
|
__exportStar(require("./SubscriberStatusEnum"), exports);
|
91
|
+
__exportStar(require("./TelemetryStatus"), exports);
|
92
92
|
__exportStar(require("./Token"), exports);
|
93
93
|
__exportStar(require("./types"), exports);
|
94
94
|
__exportStar(require("./Widget"), exports);
|
package/cjs/node/RocosSDKNode.js
CHANGED
@@ -51,9 +51,6 @@ class RocosSDKNode extends RocosSDK_1.RocosSDK {
|
|
51
51
|
case models_1.ServiceEnum.DASHBOARD:
|
52
52
|
this.services[name] = new services_1.DashboardService(config);
|
53
53
|
break;
|
54
|
-
case models_1.ServiceEnum.FUNCTION:
|
55
|
-
this.services[name] = new services_1.FunctionService(config);
|
56
|
-
break;
|
57
54
|
case models_1.ServiceEnum.STREAM:
|
58
55
|
this.services[name] = new services_1.StreamService(config);
|
59
56
|
break;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
import { CallsignStatus, IRocosSDKConfig, IRocosTelemetryMessage, IStreamStatusMessage, ITelemetryStream, ITelemetryStreamConfig, ITelemetrySubscriptionParams, ITelemetrySubscriptions } from '../models';
|
2
|
+
import { CallsignStatus, IRocosSDKConfig, IRocosTelemetryMessage, IStreamStatusMessage, ITelemetryStream, ITelemetryStreamConfig, ITelemetrySubscriptionParams, ITelemetrySubscriptions, TelemetryMonitorStatus } from '../models';
|
3
3
|
import { BaseStreamService } from './BaseStreamService';
|
4
4
|
export declare class TelemetryService extends BaseStreamService<ITelemetryStream, ITelemetryStreamConfig> {
|
5
5
|
private statusSubscription;
|
@@ -34,6 +34,15 @@ export declare class TelemetryService extends BaseStreamService<ITelemetryStream
|
|
34
34
|
* @param intervalMs optionally override the interval to check for heartbeats (in ms). Default 2000ms
|
35
35
|
*/
|
36
36
|
getRobotStatusChanges(projectId: string, callsign: string, heartbeatTimeoutMs?: number, intervalMs?: number): Observable<CallsignStatus>;
|
37
|
+
/**
|
38
|
+
* Subscribes to the given telemetry and checks we receive one at least emission every `heartbeatTimeoutMs` (default 5s)
|
39
|
+
* @param projectId
|
40
|
+
* @param callsign
|
41
|
+
* @param source the telemetry source to monitor
|
42
|
+
* @param heartbeatTimeoutMs optionally override the deadline for telemetry emissions (in ms). Default 5000ms
|
43
|
+
* @param intervalMs optionally override the interval to check for telemetry emissions (in ms). Default 2000ms
|
44
|
+
*/
|
45
|
+
monitorTelemetryWithTimeout(projectId: string, callsign: string, source: string, heartbeatTimeoutMs?: number, intervalMs?: number): Observable<TelemetryMonitorStatus>;
|
37
46
|
protected initStream(stream: ITelemetryStream): Promise<void>;
|
38
47
|
private buildScope;
|
39
48
|
private createStream;
|
@@ -98,23 +98,45 @@ class TelemetryService extends BaseStreamService_1.BaseStreamService {
|
|
98
98
|
* @param intervalMs optionally override the interval to check for heartbeats (in ms). Default 2000ms
|
99
99
|
*/
|
100
100
|
getRobotStatusChanges(projectId, callsign, heartbeatTimeoutMs = HEARTBEAT_TIMEOUT, intervalMs = 2000) {
|
101
|
+
return this.monitorTelemetryWithTimeout(projectId, callsign, HEARTBEAT_SOURCE, heartbeatTimeoutMs, intervalMs).pipe((0, rxjs_1.map)((status) => {
|
102
|
+
switch (status) {
|
103
|
+
case models_1.TelemetryMonitorStatus.CONNECTED:
|
104
|
+
return models_1.CallsignStatus.ONLINE;
|
105
|
+
case models_1.TelemetryMonitorStatus.DISCONNECTED:
|
106
|
+
return models_1.CallsignStatus.OFFLINE;
|
107
|
+
case models_1.TelemetryMonitorStatus.ERROR:
|
108
|
+
return models_1.CallsignStatus.ERROR;
|
109
|
+
default:
|
110
|
+
return models_1.CallsignStatus.UNKNOWN;
|
111
|
+
}
|
112
|
+
}));
|
113
|
+
}
|
114
|
+
/**
|
115
|
+
* Subscribes to the given telemetry and checks we receive one at least emission every `heartbeatTimeoutMs` (default 5s)
|
116
|
+
* @param projectId
|
117
|
+
* @param callsign
|
118
|
+
* @param source the telemetry source to monitor
|
119
|
+
* @param heartbeatTimeoutMs optionally override the deadline for telemetry emissions (in ms). Default 5000ms
|
120
|
+
* @param intervalMs optionally override the interval to check for telemetry emissions (in ms). Default 2000ms
|
121
|
+
*/
|
122
|
+
monitorTelemetryWithTimeout(projectId, callsign, source, heartbeatTimeoutMs = HEARTBEAT_TIMEOUT, intervalMs = 2000) {
|
101
123
|
const startedAt = Date.now();
|
102
124
|
const heartbeatTime$ = this.subscribe({
|
103
125
|
projectId,
|
104
|
-
sources: [
|
126
|
+
sources: [source],
|
105
127
|
callsigns: [callsign],
|
106
128
|
}).pipe((0, rxjs_1.map)(() => Date.now()));
|
107
129
|
return (0, rxjs_1.combineLatest)([heartbeatTime$.pipe((0, rxjs_1.startWith)(startedAt)), (0, rxjs_1.interval)(intervalMs)]).pipe((0, rxjs_1.map)(([lastHeartbeat, _]) => {
|
108
130
|
const now = Date.now();
|
109
131
|
// If we haven't received a heartbeat, but we've only just started
|
110
132
|
if (lastHeartbeat === startedAt && now - startedAt <= heartbeatTimeoutMs) {
|
111
|
-
return models_1.
|
133
|
+
return models_1.TelemetryMonitorStatus.UNKNOWN;
|
112
134
|
}
|
113
135
|
if (now - lastHeartbeat > heartbeatTimeoutMs) {
|
114
|
-
return models_1.
|
136
|
+
return models_1.TelemetryMonitorStatus.DISCONNECTED;
|
115
137
|
}
|
116
|
-
return models_1.
|
117
|
-
}), (0, rxjs_1.startWith)(models_1.
|
138
|
+
return models_1.TelemetryMonitorStatus.CONNECTED;
|
139
|
+
}), (0, rxjs_1.startWith)(models_1.TelemetryMonitorStatus.UNKNOWN), (0, rxjs_1.distinctUntilChanged)(), (0, rxjs_1.catchError)(() => (0, rxjs_1.of)(models_1.TelemetryMonitorStatus.ERROR)));
|
118
140
|
}
|
119
141
|
async initStream(stream) {
|
120
142
|
await super.initStream(stream);
|
package/cjs/services/index.d.ts
CHANGED
@@ -7,7 +7,6 @@ export * from './ControlService';
|
|
7
7
|
export * from './DashboardService';
|
8
8
|
export * from './EventService';
|
9
9
|
export * from './FileAccessorService';
|
10
|
-
export * from './FunctionService';
|
11
10
|
export * from './IntegrationService';
|
12
11
|
export * from './ProfileService';
|
13
12
|
export * from './ProjectService';
|
package/cjs/services/index.js
CHANGED
@@ -23,7 +23,6 @@ __exportStar(require("./ControlService"), exports);
|
|
23
23
|
__exportStar(require("./DashboardService"), exports);
|
24
24
|
__exportStar(require("./EventService"), exports);
|
25
25
|
__exportStar(require("./FileAccessorService"), exports);
|
26
|
-
__exportStar(require("./FunctionService"), exports);
|
27
26
|
__exportStar(require("./IntegrationService"), exports);
|
28
27
|
__exportStar(require("./ProfileService"), exports);
|
29
28
|
__exportStar(require("./ProjectService"), exports);
|
package/esm/IRocosSDK.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService,
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
2
2
|
import { IBaseService, IDebugLevel, ServiceEnum } from './models';
|
3
3
|
import { RTPWebRTCService } from './services/RTPWebRTCService';
|
4
4
|
export declare abstract class IRocosSDK {
|
@@ -14,7 +14,6 @@ export declare abstract class IRocosSDK {
|
|
14
14
|
abstract getSearchService(): SearchService;
|
15
15
|
abstract getConfigGroupService(): ConfigGroupService;
|
16
16
|
abstract getDashboardService(): DashboardService;
|
17
|
-
abstract getFunctionService(): FunctionService;
|
18
17
|
abstract getStreamService(): StreamService;
|
19
18
|
abstract getUserService(): UserService;
|
20
19
|
abstract getMapService(): MapService;
|
package/esm/RocosSDK.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService,
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
2
2
|
import { AuthorisedConfig, IBaseService, IDebugLevel, IRocosSDKConfig, ServiceEnum } from './models';
|
3
3
|
import { IRocosSDK } from './IRocosSDK';
|
4
4
|
import { Logger } from 'loglevel';
|
@@ -62,10 +62,6 @@ export declare class RocosSDK implements IRocosSDK {
|
|
62
62
|
* Gets the dashboard service
|
63
63
|
*/
|
64
64
|
getDashboardService(): DashboardService;
|
65
|
-
/**
|
66
|
-
* Gets the function service
|
67
|
-
*/
|
68
|
-
getFunctionService(): FunctionService;
|
69
65
|
/**
|
70
66
|
* Gets the stream service
|
71
67
|
*/
|
package/esm/RocosSDK.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService,
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, PlatFormTimeService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService, } from './services';
|
2
2
|
import { ServiceEnum } from './models';
|
3
3
|
import { RocosLogger } from './logger/RocosLogger';
|
4
4
|
import { RocosStore } from './store/RocosStore';
|
@@ -59,9 +59,6 @@ export class RocosSDK {
|
|
59
59
|
case ServiceEnum.DASHBOARD:
|
60
60
|
this.services[name] = new DashboardService(config);
|
61
61
|
break;
|
62
|
-
case ServiceEnum.FUNCTION:
|
63
|
-
this.services[name] = new FunctionService(config);
|
64
|
-
break;
|
65
62
|
case ServiceEnum.STREAM:
|
66
63
|
this.services[name] = new StreamService(config);
|
67
64
|
break;
|
@@ -175,12 +172,6 @@ export class RocosSDK {
|
|
175
172
|
getDashboardService() {
|
176
173
|
return this.getService(ServiceEnum.DASHBOARD);
|
177
174
|
}
|
178
|
-
/**
|
179
|
-
* Gets the function service
|
180
|
-
*/
|
181
|
-
getFunctionService() {
|
182
|
-
return this.getService(ServiceEnum.FUNCTION);
|
183
|
-
}
|
184
175
|
/**
|
185
176
|
* Gets the stream service
|
186
177
|
*/
|
package/esm/constants/api.d.ts
CHANGED
@@ -91,10 +91,6 @@ export declare const API_PROJECT_GROUP_TYPE_CONFIG_URL = "https://{url}/projects
|
|
91
91
|
export declare const API_PROJECT_GROUP_TYPE_VERSION_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{version}";
|
92
92
|
export declare const API_PROJECT_GROUP_TYPE_OWNER_ID_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/owner/{ownerId}";
|
93
93
|
export declare const API_PROJECT_GROUP_TYPE_OWNER_OVERRIDE_URL = "https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{ownerId}/override";
|
94
|
-
export declare const API_PROJECT_FUNCTION_URL = "https://{url}/projects/{projectId}/functions";
|
95
|
-
export declare const API_PROJECT_FUNCTION_ID_URL = "https://{url}/projects/{projectId}/functions/{functionId}";
|
96
|
-
export declare const API_PROJECT_FUNCTION_RUN_URL = "https://{url}/projects/{projectId}/functions/{functionId}/run";
|
97
|
-
export declare const API_PROJECT_FUNCTION_POD_URL = "https://{url}/projects/{projectId}/functions/{functionId}/pods";
|
98
94
|
export declare const API_PROJECT_EXPORT_URL = "https://{url}/projects/{projectId}/export-jobs";
|
99
95
|
export declare const API_PROJECT_STREAM_URL = "https://{url}/projects/{projectId}/streams";
|
100
96
|
export declare const API_PROJECT_STREAM_ID_URL = "https://{url}/projects/{projectId}/streams/{streamId}";
|
package/esm/constants/api.js
CHANGED
@@ -91,10 +91,6 @@ export const API_PROJECT_GROUP_TYPE_CONFIG_URL = 'https://{url}/projects/{projec
|
|
91
91
|
export const API_PROJECT_GROUP_TYPE_VERSION_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{version}';
|
92
92
|
export const API_PROJECT_GROUP_TYPE_OWNER_ID_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/owner/{ownerId}';
|
93
93
|
export const API_PROJECT_GROUP_TYPE_OWNER_OVERRIDE_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{ownerId}/override';
|
94
|
-
export const API_PROJECT_FUNCTION_URL = 'https://{url}/projects/{projectId}/functions';
|
95
|
-
export const API_PROJECT_FUNCTION_ID_URL = 'https://{url}/projects/{projectId}/functions/{functionId}';
|
96
|
-
export const API_PROJECT_FUNCTION_RUN_URL = 'https://{url}/projects/{projectId}/functions/{functionId}/run';
|
97
|
-
export const API_PROJECT_FUNCTION_POD_URL = 'https://{url}/projects/{projectId}/functions/{functionId}/pods';
|
98
94
|
export const API_PROJECT_EXPORT_URL = 'https://{url}/projects/{projectId}/export-jobs';
|
99
95
|
export const API_PROJECT_STREAM_URL = 'https://{url}/projects/{projectId}/streams';
|
100
96
|
export const API_PROJECT_STREAM_ID_URL = 'https://{url}/projects/{projectId}/streams/{streamId}';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export declare enum TelemetryMonitorStatus {
|
2
|
+
UNKNOWN = "unknown",
|
3
|
+
CONNECTED = "connected",
|
4
|
+
DISCONNECTED = "disconnected",
|
5
|
+
ERROR = "error"
|
6
|
+
}
|
7
|
+
export declare enum CallsignStatus {
|
8
|
+
UNKNOWN = "unknown",
|
9
|
+
ONLINE = "online",
|
10
|
+
OFFLINE = "offline",
|
11
|
+
ERROR = "error"
|
12
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export var TelemetryMonitorStatus;
|
2
|
+
(function (TelemetryMonitorStatus) {
|
3
|
+
TelemetryMonitorStatus["UNKNOWN"] = "unknown";
|
4
|
+
TelemetryMonitorStatus["CONNECTED"] = "connected";
|
5
|
+
TelemetryMonitorStatus["DISCONNECTED"] = "disconnected";
|
6
|
+
TelemetryMonitorStatus["ERROR"] = "error";
|
7
|
+
})(TelemetryMonitorStatus || (TelemetryMonitorStatus = {}));
|
8
|
+
export var CallsignStatus;
|
9
|
+
(function (CallsignStatus) {
|
10
|
+
CallsignStatus["UNKNOWN"] = "unknown";
|
11
|
+
CallsignStatus["ONLINE"] = "online";
|
12
|
+
CallsignStatus["OFFLINE"] = "offline";
|
13
|
+
CallsignStatus["ERROR"] = "error";
|
14
|
+
})(CallsignStatus || (CallsignStatus = {}));
|
package/esm/models/Token.d.ts
CHANGED
@@ -31,10 +31,10 @@ export declare class Token implements IToken {
|
|
31
31
|
isExpiredIn(threshold?: number, unit?: 'minutes' | 'seconds' | 'hours'): boolean;
|
32
32
|
isExpired(): boolean;
|
33
33
|
private getJWTPayload;
|
34
|
-
/** Decode a
|
34
|
+
/** Decode a base64url string.
|
35
35
|
*
|
36
36
|
* Supports both Node.js and browser environments.
|
37
37
|
* @private
|
38
38
|
*/
|
39
|
-
private
|
39
|
+
private decodeBase64URL;
|
40
40
|
}
|
package/esm/models/Token.js
CHANGED
@@ -51,7 +51,7 @@ export class Token {
|
|
51
51
|
throw new Error('Invalid token, too many parts');
|
52
52
|
}
|
53
53
|
const [header, payload] = parts.slice(0, 2).map((part) => {
|
54
|
-
return JSON.parse(this.
|
54
|
+
return JSON.parse(this.decodeBase64URL(part));
|
55
55
|
});
|
56
56
|
if (typeof payload !== 'object') {
|
57
57
|
throw new Error('Invalid token, payload must be an object');
|
@@ -64,15 +64,15 @@ export class Token {
|
|
64
64
|
}
|
65
65
|
return payload;
|
66
66
|
}
|
67
|
-
/** Decode a
|
67
|
+
/** Decode a base64url string.
|
68
68
|
*
|
69
69
|
* Supports both Node.js and browser environments.
|
70
70
|
* @private
|
71
71
|
*/
|
72
|
-
|
72
|
+
decodeBase64URL(base64String) {
|
73
73
|
if (isNode) {
|
74
|
-
return Buffer.from(base64String, '
|
74
|
+
return Buffer.from(base64String, 'base64url').toString('utf-8');
|
75
75
|
}
|
76
|
-
return atob(base64String);
|
76
|
+
return atob(base64String.replace(/-/g, '+').replace(/_/g, '/'));
|
77
77
|
}
|
78
78
|
}
|
package/esm/models/index.d.ts
CHANGED
@@ -33,7 +33,6 @@ export * from './integrations/Plan';
|
|
33
33
|
export * from './maps/Map';
|
34
34
|
export * from './maps/Panorama';
|
35
35
|
export * from './projects/ProjectUser';
|
36
|
-
export * from './CallsignStatus';
|
37
36
|
export * from './ExportDataQuery';
|
38
37
|
export * from './HttpError';
|
39
38
|
export * from './IBaseService';
|
@@ -73,6 +72,7 @@ export * from './Stream';
|
|
73
72
|
export * from './StreamOptions';
|
74
73
|
export * from './StreamSource';
|
75
74
|
export * from './SubscriberStatusEnum';
|
75
|
+
export * from './TelemetryStatus';
|
76
76
|
export * from './Token';
|
77
77
|
export * from './types';
|
78
78
|
export * from './Widget';
|
package/esm/models/index.js
CHANGED
@@ -33,7 +33,6 @@ export * from './integrations/Plan';
|
|
33
33
|
export * from './maps/Map';
|
34
34
|
export * from './maps/Panorama';
|
35
35
|
export * from './projects/ProjectUser';
|
36
|
-
export * from './CallsignStatus';
|
37
36
|
export * from './ExportDataQuery';
|
38
37
|
export * from './HttpError';
|
39
38
|
export * from './IBaseService';
|
@@ -73,6 +72,7 @@ export * from './Stream';
|
|
73
72
|
export * from './StreamOptions';
|
74
73
|
export * from './StreamSource';
|
75
74
|
export * from './SubscriberStatusEnum';
|
75
|
+
export * from './TelemetryStatus';
|
76
76
|
export * from './Token';
|
77
77
|
export * from './types';
|
78
78
|
export * from './Widget';
|
package/esm/node/RocosSDKNode.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, ConfigGroupService, DashboardService, EventService,
|
1
|
+
import { AssetStorageService, AuthService, ConfigGroupService, DashboardService, EventService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, ScheduleService, SpotProvisioningServiceNode, StreamService, UserService, } from '../services';
|
2
2
|
import { ServiceEnum } from '../models';
|
3
3
|
import { CallerServiceNode } from '../services/CallerServiceNode';
|
4
4
|
import { CommandServiceNode } from '../services/CommandServiceNode';
|
@@ -48,9 +48,6 @@ export class RocosSDKNode extends RocosSDK {
|
|
48
48
|
case ServiceEnum.DASHBOARD:
|
49
49
|
this.services[name] = new DashboardService(config);
|
50
50
|
break;
|
51
|
-
case ServiceEnum.FUNCTION:
|
52
|
-
this.services[name] = new FunctionService(config);
|
53
|
-
break;
|
54
51
|
case ServiceEnum.STREAM:
|
55
52
|
this.services[name] = new StreamService(config);
|
56
53
|
break;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
import { CallsignStatus, IRocosSDKConfig, IRocosTelemetryMessage, IStreamStatusMessage, ITelemetryStream, ITelemetryStreamConfig, ITelemetrySubscriptionParams, ITelemetrySubscriptions } from '../models';
|
2
|
+
import { CallsignStatus, IRocosSDKConfig, IRocosTelemetryMessage, IStreamStatusMessage, ITelemetryStream, ITelemetryStreamConfig, ITelemetrySubscriptionParams, ITelemetrySubscriptions, TelemetryMonitorStatus } from '../models';
|
3
3
|
import { BaseStreamService } from './BaseStreamService';
|
4
4
|
export declare class TelemetryService extends BaseStreamService<ITelemetryStream, ITelemetryStreamConfig> {
|
5
5
|
private statusSubscription;
|
@@ -34,6 +34,15 @@ export declare class TelemetryService extends BaseStreamService<ITelemetryStream
|
|
34
34
|
* @param intervalMs optionally override the interval to check for heartbeats (in ms). Default 2000ms
|
35
35
|
*/
|
36
36
|
getRobotStatusChanges(projectId: string, callsign: string, heartbeatTimeoutMs?: number, intervalMs?: number): Observable<CallsignStatus>;
|
37
|
+
/**
|
38
|
+
* Subscribes to the given telemetry and checks we receive one at least emission every `heartbeatTimeoutMs` (default 5s)
|
39
|
+
* @param projectId
|
40
|
+
* @param callsign
|
41
|
+
* @param source the telemetry source to monitor
|
42
|
+
* @param heartbeatTimeoutMs optionally override the deadline for telemetry emissions (in ms). Default 5000ms
|
43
|
+
* @param intervalMs optionally override the interval to check for telemetry emissions (in ms). Default 2000ms
|
44
|
+
*/
|
45
|
+
monitorTelemetryWithTimeout(projectId: string, callsign: string, source: string, heartbeatTimeoutMs?: number, intervalMs?: number): Observable<TelemetryMonitorStatus>;
|
37
46
|
protected initStream(stream: ITelemetryStream): Promise<void>;
|
38
47
|
private buildScope;
|
39
48
|
private createStream;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { BehaviorSubject, catchError, combineLatest, distinctUntilChanged, from, interval, map, mergeAll, of, startWith, } from 'rxjs';
|
2
|
-
import { CallsignStatus, CallsignsLookup, CallsignsLookupType, RocosError, SubscriberStatusEnum, errorCodes, } from '../models';
|
2
|
+
import { CallsignStatus, CallsignsLookup, CallsignsLookupType, RocosError, TelemetryMonitorStatus, SubscriberStatusEnum, errorCodes, } from '../models';
|
3
3
|
import { filter, finalize } from 'rxjs/operators';
|
4
4
|
import { BaseStreamService } from './BaseStreamService';
|
5
5
|
import { IDENTIFIER_NAME_TELEMETRY } from '../constants/identifier';
|
@@ -95,23 +95,45 @@ export class TelemetryService extends BaseStreamService {
|
|
95
95
|
* @param intervalMs optionally override the interval to check for heartbeats (in ms). Default 2000ms
|
96
96
|
*/
|
97
97
|
getRobotStatusChanges(projectId, callsign, heartbeatTimeoutMs = HEARTBEAT_TIMEOUT, intervalMs = 2000) {
|
98
|
+
return this.monitorTelemetryWithTimeout(projectId, callsign, HEARTBEAT_SOURCE, heartbeatTimeoutMs, intervalMs).pipe(map((status) => {
|
99
|
+
switch (status) {
|
100
|
+
case TelemetryMonitorStatus.CONNECTED:
|
101
|
+
return CallsignStatus.ONLINE;
|
102
|
+
case TelemetryMonitorStatus.DISCONNECTED:
|
103
|
+
return CallsignStatus.OFFLINE;
|
104
|
+
case TelemetryMonitorStatus.ERROR:
|
105
|
+
return CallsignStatus.ERROR;
|
106
|
+
default:
|
107
|
+
return CallsignStatus.UNKNOWN;
|
108
|
+
}
|
109
|
+
}));
|
110
|
+
}
|
111
|
+
/**
|
112
|
+
* Subscribes to the given telemetry and checks we receive one at least emission every `heartbeatTimeoutMs` (default 5s)
|
113
|
+
* @param projectId
|
114
|
+
* @param callsign
|
115
|
+
* @param source the telemetry source to monitor
|
116
|
+
* @param heartbeatTimeoutMs optionally override the deadline for telemetry emissions (in ms). Default 5000ms
|
117
|
+
* @param intervalMs optionally override the interval to check for telemetry emissions (in ms). Default 2000ms
|
118
|
+
*/
|
119
|
+
monitorTelemetryWithTimeout(projectId, callsign, source, heartbeatTimeoutMs = HEARTBEAT_TIMEOUT, intervalMs = 2000) {
|
98
120
|
const startedAt = Date.now();
|
99
121
|
const heartbeatTime$ = this.subscribe({
|
100
122
|
projectId,
|
101
|
-
sources: [
|
123
|
+
sources: [source],
|
102
124
|
callsigns: [callsign],
|
103
125
|
}).pipe(map(() => Date.now()));
|
104
126
|
return combineLatest([heartbeatTime$.pipe(startWith(startedAt)), interval(intervalMs)]).pipe(map(([lastHeartbeat, _]) => {
|
105
127
|
const now = Date.now();
|
106
128
|
// If we haven't received a heartbeat, but we've only just started
|
107
129
|
if (lastHeartbeat === startedAt && now - startedAt <= heartbeatTimeoutMs) {
|
108
|
-
return
|
130
|
+
return TelemetryMonitorStatus.UNKNOWN;
|
109
131
|
}
|
110
132
|
if (now - lastHeartbeat > heartbeatTimeoutMs) {
|
111
|
-
return
|
133
|
+
return TelemetryMonitorStatus.DISCONNECTED;
|
112
134
|
}
|
113
|
-
return
|
114
|
-
}), startWith(
|
135
|
+
return TelemetryMonitorStatus.CONNECTED;
|
136
|
+
}), startWith(TelemetryMonitorStatus.UNKNOWN), distinctUntilChanged(), catchError(() => of(TelemetryMonitorStatus.ERROR)));
|
115
137
|
}
|
116
138
|
async initStream(stream) {
|
117
139
|
await super.initStream(stream);
|
package/esm/services/index.d.ts
CHANGED
@@ -7,7 +7,6 @@ export * from './ControlService';
|
|
7
7
|
export * from './DashboardService';
|
8
8
|
export * from './EventService';
|
9
9
|
export * from './FileAccessorService';
|
10
|
-
export * from './FunctionService';
|
11
10
|
export * from './IntegrationService';
|
12
11
|
export * from './ProfileService';
|
13
12
|
export * from './ProjectService';
|
package/esm/services/index.js
CHANGED
@@ -7,7 +7,6 @@ export * from './ControlService';
|
|
7
7
|
export * from './DashboardService';
|
8
8
|
export * from './EventService';
|
9
9
|
export * from './FileAccessorService';
|
10
|
-
export * from './FunctionService';
|
11
10
|
export * from './IntegrationService';
|
12
11
|
export * from './ProfileService';
|
13
12
|
export * from './ProjectService';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dronedeploy/rocos-js-sdk",
|
3
|
-
"version": "3.0.1-alpha.
|
3
|
+
"version": "3.0.1-alpha.15",
|
4
4
|
"description": "Javascript SDK for rocos",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "esm/index.js",
|
@@ -23,7 +23,6 @@
|
|
23
23
|
"devDependencies": {},
|
24
24
|
"dependencies": {
|
25
25
|
"@grpc/grpc-js": "^1.7.1",
|
26
|
-
"@improbable-eng/grpc-web": "^0.14.0",
|
27
26
|
"@protobuf-ts/grpcweb-transport": "^2.9.1",
|
28
27
|
"@protobuf-ts/plugin": "^2.9.1",
|
29
28
|
"@protobuf-ts/runtime": "^2.9.1",
|
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.CallsignStatus = void 0;
|
4
|
-
var CallsignStatus;
|
5
|
-
(function (CallsignStatus) {
|
6
|
-
CallsignStatus["UNKNOWN"] = "unknown";
|
7
|
-
CallsignStatus["ONLINE"] = "online";
|
8
|
-
CallsignStatus["OFFLINE"] = "offline";
|
9
|
-
CallsignStatus["ERROR"] = "error";
|
10
|
-
})(CallsignStatus || (exports.CallsignStatus = CallsignStatus = {}));
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import { RocosError } from '../models/RocosError';
|
2
|
-
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
|
-
import { IBaseService } from '../models/IBaseService';
|
4
|
-
import { IExportDataQuery } from '../models/IExportDataQuery';
|
5
|
-
import { IFunctionConfig } from '../models/IFunctionConfig';
|
6
|
-
import { IRocosSDKConfig } from '../models/IRocosSDKConfig';
|
7
|
-
export declare class FunctionService extends BaseServiceAbstract implements IBaseService {
|
8
|
-
constructor(config: IRocosSDKConfig);
|
9
|
-
protected getError(e: Error): RocosError;
|
10
|
-
getStatus(): boolean;
|
11
|
-
/**
|
12
|
-
* Export data
|
13
|
-
*
|
14
|
-
* @param projectId - Project Id
|
15
|
-
* @param query - Payload {@link IExportDataQuery}
|
16
|
-
*/
|
17
|
-
exportJobs(projectId: string, query: IExportDataQuery): Promise<any>;
|
18
|
-
/**
|
19
|
-
* Create a function
|
20
|
-
*
|
21
|
-
* @param projectId - Project Id
|
22
|
-
* @param model - Payload {@link IFunctionConfig}
|
23
|
-
*/
|
24
|
-
create(projectId: string, model: IFunctionConfig): Promise<any>;
|
25
|
-
/**
|
26
|
-
* Get a functions
|
27
|
-
*
|
28
|
-
* @param projectId - Project Id
|
29
|
-
*/
|
30
|
-
list(projectId: string): Promise<any>;
|
31
|
-
/**
|
32
|
-
* Update a function
|
33
|
-
*
|
34
|
-
* @param projectId - Project Id
|
35
|
-
* @param functionId - Function Id
|
36
|
-
* @param model - Payload {@link IFunctionConfig}
|
37
|
-
*/
|
38
|
-
update(projectId: string, functionId: string, model: IFunctionConfig): Promise<any>;
|
39
|
-
/**
|
40
|
-
* Get function
|
41
|
-
*
|
42
|
-
* @param projectId - Project Id
|
43
|
-
* @param functionId - Function Id
|
44
|
-
*/
|
45
|
-
info(projectId: string, functionId: string): Promise<any>;
|
46
|
-
/**
|
47
|
-
* Delete function
|
48
|
-
*
|
49
|
-
* @param projectId - Project Id
|
50
|
-
* @param functionId - Function Id
|
51
|
-
*/
|
52
|
-
delete(projectId: string, functionId: string): Promise<any>;
|
53
|
-
/**
|
54
|
-
* Run a function
|
55
|
-
*
|
56
|
-
* @param projectId - Project Id
|
57
|
-
* @param functionId - Function Id
|
58
|
-
* @param body - Payload
|
59
|
-
*/
|
60
|
-
run(projectId: string, functionId: string, body?: any): Promise<any>;
|
61
|
-
/**
|
62
|
-
* Get function pods
|
63
|
-
*
|
64
|
-
* @param projectId - Project Id
|
65
|
-
* @param functionId - Function Id
|
66
|
-
*/
|
67
|
-
pods(projectId: string, functionId: string): Promise<any>;
|
68
|
-
}
|
@@ -1,103 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.FunctionService = void 0;
|
4
|
-
const api_1 = require("../constants/api");
|
5
|
-
const RocosError_1 = require("../models/RocosError");
|
6
|
-
const BaseServiceAbstract_1 = require("./BaseServiceAbstract");
|
7
|
-
const ExportDataQuery_1 = require("../models/ExportDataQuery");
|
8
|
-
const RocosLogger_1 = require("../logger/RocosLogger");
|
9
|
-
const formatServiceUrl_1 = require("../helpers/formatServiceUrl");
|
10
|
-
class FunctionService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
11
|
-
constructor(config) {
|
12
|
-
super(config);
|
13
|
-
this.logger = RocosLogger_1.RocosLogger.getInstance(`FunctionService(${this.config.url})`);
|
14
|
-
}
|
15
|
-
getError(e) {
|
16
|
-
return new RocosError_1.RocosError(e, RocosError_1.errorCodes.FUNCTION_SERVICE_ERROR);
|
17
|
-
}
|
18
|
-
getStatus() {
|
19
|
-
return true;
|
20
|
-
}
|
21
|
-
/**
|
22
|
-
* Export data
|
23
|
-
*
|
24
|
-
* @param projectId - Project Id
|
25
|
-
* @param query - Payload {@link IExportDataQuery}
|
26
|
-
*/
|
27
|
-
// TODO: map the response object
|
28
|
-
async exportJobs(projectId, query) {
|
29
|
-
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_EXPORT_URL, { url: this.config.url, projectId }, this.config.insecure), new ExportDataQuery_1.ExportDataQuery(query).toJSON(), `Failed to export data for ${projectId}.`);
|
30
|
-
}
|
31
|
-
/**
|
32
|
-
* Create a function
|
33
|
-
*
|
34
|
-
* @param projectId - Project Id
|
35
|
-
* @param model - Payload {@link IFunctionConfig}
|
36
|
-
*/
|
37
|
-
// TODO: map the response object
|
38
|
-
async create(projectId, model) {
|
39
|
-
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_FUNCTION_URL, { url: this.config.url, projectId }, this.config.insecure), model, `Failed to create function for ${projectId}.`);
|
40
|
-
}
|
41
|
-
/**
|
42
|
-
* Get a functions
|
43
|
-
*
|
44
|
-
* @param projectId - Project Id
|
45
|
-
*/
|
46
|
-
// TODO: map the response object
|
47
|
-
async list(projectId) {
|
48
|
-
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_FUNCTION_URL, { url: this.config.url, projectId }, this.config.insecure), `Failed to get functions for ${projectId}.`);
|
49
|
-
}
|
50
|
-
/**
|
51
|
-
* Update a function
|
52
|
-
*
|
53
|
-
* @param projectId - Project Id
|
54
|
-
* @param functionId - Function Id
|
55
|
-
* @param model - Payload {@link IFunctionConfig}
|
56
|
-
*/
|
57
|
-
// TODO: map the response object
|
58
|
-
async update(projectId, functionId, model) {
|
59
|
-
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_FUNCTION_ID_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), model, `Failed to update function for ${projectId}, functionId ${functionId}.`);
|
60
|
-
}
|
61
|
-
/**
|
62
|
-
* Get function
|
63
|
-
*
|
64
|
-
* @param projectId - Project Id
|
65
|
-
* @param functionId - Function Id
|
66
|
-
*/
|
67
|
-
// TODO: map the response object
|
68
|
-
async info(projectId, functionId) {
|
69
|
-
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_FUNCTION_ID_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), `Failed to get function for ${projectId}, functionId ${functionId}.`);
|
70
|
-
}
|
71
|
-
/**
|
72
|
-
* Delete function
|
73
|
-
*
|
74
|
-
* @param projectId - Project Id
|
75
|
-
* @param functionId - Function Id
|
76
|
-
*/
|
77
|
-
// TODO: map the response object
|
78
|
-
async delete(projectId, functionId) {
|
79
|
-
return this.callDelete((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_FUNCTION_ID_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), `Failed to delete function for ${projectId}, functionId ${functionId}.`);
|
80
|
-
}
|
81
|
-
/**
|
82
|
-
* Run a function
|
83
|
-
*
|
84
|
-
* @param projectId - Project Id
|
85
|
-
* @param functionId - Function Id
|
86
|
-
* @param body - Payload
|
87
|
-
*/
|
88
|
-
// TODO: map the response object
|
89
|
-
async run(projectId, functionId, body = null) {
|
90
|
-
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_FUNCTION_RUN_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), body, `Failed to run function for ${projectId}, functionId ${functionId}.`);
|
91
|
-
}
|
92
|
-
/**
|
93
|
-
* Get function pods
|
94
|
-
*
|
95
|
-
* @param projectId - Project Id
|
96
|
-
* @param functionId - Function Id
|
97
|
-
*/
|
98
|
-
// TODO: map the response object
|
99
|
-
async pods(projectId, functionId) {
|
100
|
-
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_FUNCTION_POD_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), `Failed to ged function pods for ${projectId}, functionId ${functionId}.`);
|
101
|
-
}
|
102
|
-
}
|
103
|
-
exports.FunctionService = FunctionService;
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import { RocosError } from '../models/RocosError';
|
2
|
-
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
3
|
-
import { IBaseService } from '../models/IBaseService';
|
4
|
-
import { IExportDataQuery } from '../models/IExportDataQuery';
|
5
|
-
import { IFunctionConfig } from '../models/IFunctionConfig';
|
6
|
-
import { IRocosSDKConfig } from '../models/IRocosSDKConfig';
|
7
|
-
export declare class FunctionService extends BaseServiceAbstract implements IBaseService {
|
8
|
-
constructor(config: IRocosSDKConfig);
|
9
|
-
protected getError(e: Error): RocosError;
|
10
|
-
getStatus(): boolean;
|
11
|
-
/**
|
12
|
-
* Export data
|
13
|
-
*
|
14
|
-
* @param projectId - Project Id
|
15
|
-
* @param query - Payload {@link IExportDataQuery}
|
16
|
-
*/
|
17
|
-
exportJobs(projectId: string, query: IExportDataQuery): Promise<any>;
|
18
|
-
/**
|
19
|
-
* Create a function
|
20
|
-
*
|
21
|
-
* @param projectId - Project Id
|
22
|
-
* @param model - Payload {@link IFunctionConfig}
|
23
|
-
*/
|
24
|
-
create(projectId: string, model: IFunctionConfig): Promise<any>;
|
25
|
-
/**
|
26
|
-
* Get a functions
|
27
|
-
*
|
28
|
-
* @param projectId - Project Id
|
29
|
-
*/
|
30
|
-
list(projectId: string): Promise<any>;
|
31
|
-
/**
|
32
|
-
* Update a function
|
33
|
-
*
|
34
|
-
* @param projectId - Project Id
|
35
|
-
* @param functionId - Function Id
|
36
|
-
* @param model - Payload {@link IFunctionConfig}
|
37
|
-
*/
|
38
|
-
update(projectId: string, functionId: string, model: IFunctionConfig): Promise<any>;
|
39
|
-
/**
|
40
|
-
* Get function
|
41
|
-
*
|
42
|
-
* @param projectId - Project Id
|
43
|
-
* @param functionId - Function Id
|
44
|
-
*/
|
45
|
-
info(projectId: string, functionId: string): Promise<any>;
|
46
|
-
/**
|
47
|
-
* Delete function
|
48
|
-
*
|
49
|
-
* @param projectId - Project Id
|
50
|
-
* @param functionId - Function Id
|
51
|
-
*/
|
52
|
-
delete(projectId: string, functionId: string): Promise<any>;
|
53
|
-
/**
|
54
|
-
* Run a function
|
55
|
-
*
|
56
|
-
* @param projectId - Project Id
|
57
|
-
* @param functionId - Function Id
|
58
|
-
* @param body - Payload
|
59
|
-
*/
|
60
|
-
run(projectId: string, functionId: string, body?: any): Promise<any>;
|
61
|
-
/**
|
62
|
-
* Get function pods
|
63
|
-
*
|
64
|
-
* @param projectId - Project Id
|
65
|
-
* @param functionId - Function Id
|
66
|
-
*/
|
67
|
-
pods(projectId: string, functionId: string): Promise<any>;
|
68
|
-
}
|
@@ -1,99 +0,0 @@
|
|
1
|
-
import { API_PROJECT_EXPORT_URL, API_PROJECT_FUNCTION_ID_URL, API_PROJECT_FUNCTION_POD_URL, API_PROJECT_FUNCTION_RUN_URL, API_PROJECT_FUNCTION_URL, } from '../constants/api';
|
2
|
-
import { RocosError, errorCodes } from '../models/RocosError';
|
3
|
-
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
|
-
import { ExportDataQuery } from '../models/ExportDataQuery';
|
5
|
-
import { RocosLogger } from '../logger/RocosLogger';
|
6
|
-
import { formatServiceUrl } from '../helpers/formatServiceUrl';
|
7
|
-
export class FunctionService extends BaseServiceAbstract {
|
8
|
-
constructor(config) {
|
9
|
-
super(config);
|
10
|
-
this.logger = RocosLogger.getInstance(`FunctionService(${this.config.url})`);
|
11
|
-
}
|
12
|
-
getError(e) {
|
13
|
-
return new RocosError(e, errorCodes.FUNCTION_SERVICE_ERROR);
|
14
|
-
}
|
15
|
-
getStatus() {
|
16
|
-
return true;
|
17
|
-
}
|
18
|
-
/**
|
19
|
-
* Export data
|
20
|
-
*
|
21
|
-
* @param projectId - Project Id
|
22
|
-
* @param query - Payload {@link IExportDataQuery}
|
23
|
-
*/
|
24
|
-
// TODO: map the response object
|
25
|
-
async exportJobs(projectId, query) {
|
26
|
-
return this.callPost(formatServiceUrl(API_PROJECT_EXPORT_URL, { url: this.config.url, projectId }, this.config.insecure), new ExportDataQuery(query).toJSON(), `Failed to export data for ${projectId}.`);
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* Create a function
|
30
|
-
*
|
31
|
-
* @param projectId - Project Id
|
32
|
-
* @param model - Payload {@link IFunctionConfig}
|
33
|
-
*/
|
34
|
-
// TODO: map the response object
|
35
|
-
async create(projectId, model) {
|
36
|
-
return this.callPost(formatServiceUrl(API_PROJECT_FUNCTION_URL, { url: this.config.url, projectId }, this.config.insecure), model, `Failed to create function for ${projectId}.`);
|
37
|
-
}
|
38
|
-
/**
|
39
|
-
* Get a functions
|
40
|
-
*
|
41
|
-
* @param projectId - Project Id
|
42
|
-
*/
|
43
|
-
// TODO: map the response object
|
44
|
-
async list(projectId) {
|
45
|
-
return this.callGet(formatServiceUrl(API_PROJECT_FUNCTION_URL, { url: this.config.url, projectId }, this.config.insecure), `Failed to get functions for ${projectId}.`);
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Update a function
|
49
|
-
*
|
50
|
-
* @param projectId - Project Id
|
51
|
-
* @param functionId - Function Id
|
52
|
-
* @param model - Payload {@link IFunctionConfig}
|
53
|
-
*/
|
54
|
-
// TODO: map the response object
|
55
|
-
async update(projectId, functionId, model) {
|
56
|
-
return this.callPut(formatServiceUrl(API_PROJECT_FUNCTION_ID_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), model, `Failed to update function for ${projectId}, functionId ${functionId}.`);
|
57
|
-
}
|
58
|
-
/**
|
59
|
-
* Get function
|
60
|
-
*
|
61
|
-
* @param projectId - Project Id
|
62
|
-
* @param functionId - Function Id
|
63
|
-
*/
|
64
|
-
// TODO: map the response object
|
65
|
-
async info(projectId, functionId) {
|
66
|
-
return this.callGet(formatServiceUrl(API_PROJECT_FUNCTION_ID_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), `Failed to get function for ${projectId}, functionId ${functionId}.`);
|
67
|
-
}
|
68
|
-
/**
|
69
|
-
* Delete function
|
70
|
-
*
|
71
|
-
* @param projectId - Project Id
|
72
|
-
* @param functionId - Function Id
|
73
|
-
*/
|
74
|
-
// TODO: map the response object
|
75
|
-
async delete(projectId, functionId) {
|
76
|
-
return this.callDelete(formatServiceUrl(API_PROJECT_FUNCTION_ID_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), `Failed to delete function for ${projectId}, functionId ${functionId}.`);
|
77
|
-
}
|
78
|
-
/**
|
79
|
-
* Run a function
|
80
|
-
*
|
81
|
-
* @param projectId - Project Id
|
82
|
-
* @param functionId - Function Id
|
83
|
-
* @param body - Payload
|
84
|
-
*/
|
85
|
-
// TODO: map the response object
|
86
|
-
async run(projectId, functionId, body = null) {
|
87
|
-
return this.callPost(formatServiceUrl(API_PROJECT_FUNCTION_RUN_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), body, `Failed to run function for ${projectId}, functionId ${functionId}.`);
|
88
|
-
}
|
89
|
-
/**
|
90
|
-
* Get function pods
|
91
|
-
*
|
92
|
-
* @param projectId - Project Id
|
93
|
-
* @param functionId - Function Id
|
94
|
-
*/
|
95
|
-
// TODO: map the response object
|
96
|
-
async pods(projectId, functionId) {
|
97
|
-
return this.callGet(formatServiceUrl(API_PROJECT_FUNCTION_POD_URL, { url: this.config.url, projectId, functionId }, this.config.insecure), `Failed to ged function pods for ${projectId}, functionId ${functionId}.`);
|
98
|
-
}
|
99
|
-
}
|