@dronedeploy/rocos-js-sdk 3.0.1-alpha.19 → 3.0.1-alpha.20
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/IRocosSDK.d.ts +2 -2
- package/cjs/RocosSDK.d.ts +6 -1
- package/cjs/RocosSDK.js +10 -0
- package/cjs/constants/api.d.ts +1 -0
- package/cjs/constants/api.js +2 -1
- package/cjs/helpers/websandbox/connection.d.ts +2 -1
- package/cjs/helpers/websandbox/connection.js +6 -5
- package/cjs/helpers/websandbox/frame/frame.js +4 -1
- package/cjs/helpers/websandbox/frame/frame.source.js +1 -1
- package/cjs/helpers/websandbox/frame/worker/manager.d.ts +8 -4
- package/cjs/helpers/websandbox/frame/worker/manager.js +32 -14
- package/cjs/helpers/websandbox/frame/worker/worker.source.js +1 -1
- package/cjs/helpers/websandbox/sandbox.d.ts +1 -1
- package/cjs/helpers/websandbox/sandbox.js +7 -7
- package/cjs/models/RocosError.d.ts +1 -0
- package/cjs/models/RocosError.js +1 -0
- package/cjs/models/ServiceEnum.d.ts +19 -18
- package/cjs/models/ServiceEnum.js +19 -18
- package/cjs/models/graph/Position.d.ts +6 -0
- package/cjs/models/graph/Position.js +2 -0
- package/cjs/models/graph/Quaternion.d.ts +6 -0
- package/cjs/models/graph/Quaternion.js +2 -0
- package/cjs/models/graph/Vector3.d.ts +5 -0
- package/cjs/models/graph/Vector3.js +2 -0
- package/cjs/models/graph/index.d.ts +3 -0
- package/cjs/models/graph/index.js +19 -0
- package/cjs/models/index.d.ts +1 -0
- package/cjs/models/index.js +1 -0
- package/cjs/models/maps/Panorama.d.ts +1 -17
- package/cjs/models/target/Target.d.ts +27 -0
- package/cjs/models/target/Target.js +2 -0
- package/cjs/node/RocosSDKNode.d.ts +1 -6
- package/cjs/node/RocosSDKNode.js +3 -9
- package/cjs/services/EvaluatorService.js +1 -1
- package/cjs/services/TargetService.d.ts +11 -0
- package/cjs/services/TargetService.js +31 -0
- package/cjs/services/index.d.ts +9 -8
- package/cjs/services/index.js +9 -8
- package/esm/IRocosSDK.d.ts +2 -2
- package/esm/RocosSDK.d.ts +6 -1
- package/esm/RocosSDK.js +11 -1
- package/esm/constants/api.d.ts +1 -0
- package/esm/constants/api.js +1 -0
- package/esm/helpers/websandbox/connection.d.ts +2 -1
- package/esm/helpers/websandbox/connection.js +6 -5
- package/esm/helpers/websandbox/frame/frame.js +4 -1
- package/esm/helpers/websandbox/frame/frame.source.js +1 -1
- package/esm/helpers/websandbox/frame/worker/manager.d.ts +8 -4
- package/esm/helpers/websandbox/frame/worker/manager.js +32 -14
- package/esm/helpers/websandbox/frame/worker/worker.source.js +1 -1
- package/esm/helpers/websandbox/sandbox.d.ts +1 -1
- package/esm/helpers/websandbox/sandbox.js +7 -7
- package/esm/models/RocosError.d.ts +1 -0
- package/esm/models/RocosError.js +1 -0
- package/esm/models/ServiceEnum.d.ts +19 -18
- package/esm/models/ServiceEnum.js +19 -18
- package/esm/models/graph/Position.d.ts +6 -0
- package/esm/models/graph/Position.js +1 -0
- package/esm/models/graph/Quaternion.d.ts +6 -0
- package/esm/models/graph/Quaternion.js +1 -0
- package/esm/models/graph/Vector3.d.ts +5 -0
- package/esm/models/graph/Vector3.js +1 -0
- package/esm/models/graph/index.d.ts +3 -0
- package/esm/models/graph/index.js +3 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/maps/Panorama.d.ts +1 -17
- package/esm/models/target/Target.d.ts +27 -0
- package/esm/models/target/Target.js +1 -0
- package/esm/node/RocosSDKNode.d.ts +1 -6
- package/esm/node/RocosSDKNode.js +4 -10
- package/esm/services/BaseServiceAbstract.js +1 -1
- package/esm/services/EvaluatorService.js +1 -1
- package/esm/services/TargetService.d.ts +11 -0
- package/esm/services/TargetService.js +27 -0
- package/esm/services/index.d.ts +9 -8
- package/esm/services/index.js +9 -8
- package/package.json +1 -1
package/cjs/IRocosSDK.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, SearchService, SpotProvisioningService, SpotProvisioningServiceNode, StreamService, TargetService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
2
2
|
import { IBaseService, IDebugLevel, ServiceEnum } from './models';
|
3
|
-
import { RTPWebRTCService } from './services/RTPWebRTCService';
|
4
3
|
export declare abstract class IRocosSDK {
|
5
4
|
abstract getService<T extends IBaseService>(name: ServiceEnum): T;
|
6
5
|
abstract getAuthService(): AuthService;
|
@@ -28,6 +27,7 @@ export declare abstract class IRocosSDK {
|
|
28
27
|
abstract getIntegrationService(): IntegrationService;
|
29
28
|
abstract getEvaluatorService(): EvaluatorService;
|
30
29
|
abstract getDeviceCredentialsService(): DeviceCredentialsService;
|
30
|
+
abstract getTargetService(): TargetService;
|
31
31
|
abstract cleanup(): Promise<boolean>;
|
32
32
|
abstract enableDebugMode(on: boolean): void;
|
33
33
|
abstract setDebugLevel(level: IDebugLevel): void;
|
package/cjs/RocosSDK.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TelemetryService, TimeSyncerService, UserService, WebRTCSignallingService, WorkflowService } from './services';
|
1
|
+
import { AssetStorageService, AuthService, CallerService, CommandService, ConfigGroupService, ControlService, DashboardService, DeviceCredentialsService, EvaluatorService, EventService, FileAccessorService, IntegrationService, MapService, ProfileService, ProjectService, RTPWebRTCService, RobotService, ScheduleService, SearchService, SpotProvisioningService, StreamService, TargetService, 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';
|
@@ -131,6 +131,11 @@ export declare class RocosSDK implements IRocosSDK {
|
|
131
131
|
* @returns DeviceCredentialsService
|
132
132
|
*/
|
133
133
|
getDeviceCredentialsService(): DeviceCredentialsService;
|
134
|
+
/**
|
135
|
+
* Gets the asset service.
|
136
|
+
* @returns AssetService
|
137
|
+
*/
|
138
|
+
getTargetService(): TargetService;
|
134
139
|
get platformTimeOffset(): number;
|
135
140
|
get platformTime(): number;
|
136
141
|
/**
|
package/cjs/RocosSDK.js
CHANGED
@@ -107,6 +107,9 @@ class RocosSDK {
|
|
107
107
|
case models_1.ServiceEnum.DEVICE_CREDENTIALS:
|
108
108
|
this.services[name] = new services_1.DeviceCredentialsService(config);
|
109
109
|
break;
|
110
|
+
case models_1.ServiceEnum.TARGET:
|
111
|
+
this.services[name] = new services_1.TargetService(config);
|
112
|
+
break;
|
110
113
|
}
|
111
114
|
}
|
112
115
|
this.logger.debug(`Found service ${name}.`);
|
@@ -277,6 +280,13 @@ class RocosSDK {
|
|
277
280
|
getDeviceCredentialsService() {
|
278
281
|
return this.getService(models_1.ServiceEnum.DEVICE_CREDENTIALS);
|
279
282
|
}
|
283
|
+
/**
|
284
|
+
* Gets the asset service.
|
285
|
+
* @returns AssetService
|
286
|
+
*/
|
287
|
+
getTargetService() {
|
288
|
+
return this.getService(models_1.ServiceEnum.TARGET);
|
289
|
+
}
|
280
290
|
get platformTimeOffset() {
|
281
291
|
return services_1.PlatFormTimeService.getInstance(this.getTimeSyncerService())?.platformTimeOffset;
|
282
292
|
}
|
package/cjs/constants/api.d.ts
CHANGED
@@ -133,3 +133,4 @@ export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects
|
|
133
133
|
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
134
134
|
export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
|
135
135
|
export declare const API_DEVICE_CREDENTIALS_AUTH_URL = "https://{url}/device-credentials/auth";
|
136
|
+
export declare const API_TARGETS_URL = "https://{url}/projects/{projectId}/targets";
|
package/cjs/constants/api.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.API_PROJECT_ROBOT_REGISTER_URL = exports.API_PROJECT_ROBOT_DEFINITION_URL = exports.API_PROJECT_ROBOT_ATTRIBUTES_URL = exports.API_PROJECT_ROBOT_ID_URL = exports.API_PROJECT_ROBOT_URL = exports.API_PROJECT_MAPPED_ASSETS_PATH_URL = exports.API_PROJECT_MISSION_ASSET_PATH_URL = exports.API_PROJECT_MISSION_ASSETS_PATH_URL = exports.API_PROJECT_FLOW_ASSET_PATH_URL = exports.API_PROJECT_ROBOT_ASSET_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATION_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATIONS_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL = exports.API_PROJECT_ASSET_PROFILES_SYNC_DEFINITION_PATH_URL = exports.API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL = exports.API_PROJECT_ASSET_PATH_URL = exports.API_PROJECT_ASSET_URL = exports.API_PROJECT_USERS_URL = exports.API_PROJECT_ID_URL = exports.API_PROJECT_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_ID_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_URL = exports.API_ACCOUNT_PROJECT_USER_ID_URL = exports.API_ACCOUNT_PROJECT_USER_URL = exports.API_ACCOUNT_PROJECT_ID_URL = exports.API_ACCOUNT_PROJECT_URL = exports.API_SERVER_TIME_URL = exports.API_ACCOUNT_INTEGRATION_TYPE_URL = exports.API_ACCOUNT_INTEGRATION_URL = exports.API_ACCOUNT_SETTINGS_URL = exports.API_AUTH_USER_ACCOUNT_USER_ID_URL = exports.API_AUTH_USER_ACCOUNT_USER_URL = exports.API_ACCOUNT_ACTIVATE_URL = exports.API_ACCOUNT_ID_URL = exports.API_ACCOUNT_URL = exports.API_USER_PAT_TOKEN_URL = exports.API_USER_PAT_URL = exports.API_USER_VERIFY_EMAIL_URL = exports.API_USER_INVITATION_CHECK_URL = exports.API_USER_INVITATION_ACCEPT_URL = exports.API_USER_INVITATION_URL = exports.API_USER_PASSWORD_FORGOT_URL = exports.API_USER_PASSWORD_RESET_URL = exports.API_OTP_AUTH_URL = exports.API_OTP_URL = exports.API_USER_TOKEN_URL = exports.API_USER_AUTH_URL = exports.API_USER_URL = exports.API_ADMIN_USER_INVITATION_URL = exports.API_APPLICATION_AUTH_URL = void 0;
|
4
4
|
exports.API_PROJECT_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_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = 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;
|
5
|
+
exports.API_TARGETS_URL = exports.API_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = 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';
|
@@ -138,3 +138,4 @@ exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/
|
|
138
138
|
exports.API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
139
139
|
exports.API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
|
140
140
|
exports.API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
|
141
|
+
exports.API_TARGETS_URL = 'https://{url}/projects/{projectId}/targets';
|
@@ -39,6 +39,8 @@ export default class Connection<Local extends APIDeclaration<Local>, Remote exte
|
|
39
39
|
* @param args - arguments to pass to remote method
|
40
40
|
*/
|
41
41
|
callRemoteMethod<Method extends keyof Remote>(name: Method, ...args: Parameters<Remote[Method]>): Promise<ReturnType<Remote[Method]>>;
|
42
|
+
/** Log a message if debug mode is enabled */
|
43
|
+
log(...args: unknown[]): void;
|
42
44
|
private onMessageListener;
|
43
45
|
private callLocalMethod;
|
44
46
|
/** Respond to remote call
|
@@ -62,6 +64,5 @@ export default class Connection<Local extends APIDeclaration<Local>, Remote exte
|
|
62
64
|
*/
|
63
65
|
private popCallback;
|
64
66
|
private postMessage;
|
65
|
-
private log;
|
66
67
|
}
|
67
68
|
export {};
|
@@ -45,6 +45,12 @@ class Connection {
|
|
45
45
|
});
|
46
46
|
});
|
47
47
|
}
|
48
|
+
/** Log a message if debug mode is enabled */
|
49
|
+
log(...args) {
|
50
|
+
if (this.options.debugMode) {
|
51
|
+
console.debug(`[${this.name}]`, ...args);
|
52
|
+
}
|
53
|
+
}
|
48
54
|
onMessageListener(e) {
|
49
55
|
this.log('Received message', e);
|
50
56
|
const { data } = e;
|
@@ -127,10 +133,5 @@ class Connection {
|
|
127
133
|
this.log('sending message', { data, targetOrigin });
|
128
134
|
this.postMessageInternal(data, targetOrigin);
|
129
135
|
}
|
130
|
-
log(...args) {
|
131
|
-
if (this.options.debugMode) {
|
132
|
-
console.debug(`[${this.name}]`, ...args);
|
133
|
-
}
|
134
|
-
}
|
135
136
|
}
|
136
137
|
exports.default = Connection;
|
@@ -17,7 +17,10 @@ class Frame {
|
|
17
17
|
debugMode: isDebugMode,
|
18
18
|
});
|
19
19
|
void this.connection.callRemoteMethod('iframeInitialised');
|
20
|
-
|
20
|
+
// use roughly half the number of logical cores available clamped between 1 and 6
|
21
|
+
const workers = Math.min(Math.max(Math.ceil(navigator.hardwareConcurrency / 2), 1), 6);
|
22
|
+
this.connection.log(`Creating ${workers} workers`);
|
23
|
+
this.workerManager = new worker_1.default(workers);
|
21
24
|
}
|
22
25
|
async runCode(task) {
|
23
26
|
return this.workerManager.execute(task);
|
@@ -6,5 +6,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
6
|
};
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
8
8
|
const worker_source_1 = __importDefault(require("./worker/worker.source"));
|
9
|
-
const source = `(()=>{"use strict";var e
|
9
|
+
const source = `(()=>{"use strict";var e;!function(e){e.RESPONSE="response",e.MESSAGE="message"}(e||(e={}));const s={allowedSenderOrigin:void 0,debugMode:!1};class t{constructor(e,t,r,n,o={}){this.callbacks=new Map,this.serviceMethods=new Map,this.name=e,this.options={...s,...o},this.log("Created connection w/ allowedOrigin:",this.options.allowedSenderOrigin),this.serviceMethods=new Map(Object.entries(r));const[i]=crypto.getRandomValues(new Uint32Array(1));this.incrementalID=i,this.postMessageInternal=t,n((e=>this.onMessageListener(e)))}callRemoteMethod(s,...t){return this.log("Calling Remote Method",{name:s,args:t}),new Promise(((r,n)=>{const o=this.registerCallback(r,n);this.postMessage({callId:o,type:e.MESSAGE,methodName:s,arguments:t})}))}log(...e){this.options.debugMode&&console.debug(\`[\${this.name}]\`,...e)}onMessageListener(s){this.log("Received message",s);const{data:t}=s,{allowedSenderOrigin:r}=this.options;switch(r&&s.origin!==r&&console.warn(\`Received message from invalid origin: \${s.origin}\`),t.type){case e.RESPONSE:return void this.popCallback(t.callId,t.success,t.result);case e.MESSAGE:this.callLocalMethod(t.methodName,t.arguments).then((e=>this.responseOtherSide(t.callId,e))).catch((e=>this.responseOtherSide(t.callId,e,!1)))}}async callLocalMethod(e,s){this.log("calling local method",e,s);const t=this.serviceMethods.get(e);if(!t)throw new Error(\`service method \${e} not found\`);return t(...s)}responseOtherSide(s,t,r=!0){this.log("responding to remote call",{id:s,result:t,success:r});const n=t=>{this.postMessage({callId:s,type:e.RESPONSE,success:r,result:t})};try{n(t)}catch(e){e instanceof DOMException&&n(JSON.parse(JSON.stringify(t)))}}registerCallback(e,s){const t=(++this.incrementalID).toString();return this.log("registering callback for id",t),this.callbacks.set(t,{success:e,failure:s}),t}popCallback(e,s,t){this.log("calling callback for id",e,{success:s,result:t});const r=this.callbacks.get(e);s?r?.success(t):r?.failure(t),this.callbacks.delete(e)}postMessage(e,s="*"){this.log("sending message",{data:e,targetOrigin:s}),this.postMessageInternal(e,s)}}new class{constructor(){const e=!!window?.debugMode;this.connection=new t("FRAME",window.parent.postMessage.bind(window.parent),{startTask:this.runCode.bind(this)},(e=>{window.addEventListener("message",e)}),{debugMode:e}),this.connection.callRemoteMethod("iframeInitialised");const s=Math.max(Math.ceil(navigator.hardwareConcurrency/2),1);this.connection.log(\`Creating \${s} workers\`),this.workerManager=new class{constructor(e=1){this.messageListeners=new Map,this.requestedWorkers=e,this.workers=Array.from({length:e},(()=>this.createWorker())),this.nextWorkerGenerator=this.nextWorker()}async execute(e){const s=this.nextWorkerGenerator.next().value,t={...e,contextVariable:e.contextVariable??"ctx"},r=this.runTask(s,t),n=new Promise(((s,t)=>{const r=AbortSignal.timeout(e.timeout);r.addEventListener("abort",(()=>{t(r.reason)}))}));return Promise.race([r,n]).catch((e=>{if("TimeoutError"===e.name)throw this.terminate(s),new DOMException("soft timeout reached","TimeoutError");throw e})).finally((()=>{this.removeMessageListener(e.id)}))}terminate(e){for(const s of this.messageListeners.values())e.removeEventListener("message",s);e.terminate(),this.rebuildWorkers()}runTask(e,s){return new Promise(((t,r)=>{const n=e=>{const{data:n}=e;n.id===s.id&&(n.success?t(n.result):r(n.result))};this.messageListeners.set(s.id,n),e.addEventListener("message",n),e.postMessage(s)}))}createWorker(){const e=URL.createObjectURL(new Blob(["${worker_source_1.default.replace(/(['`"$])/g, '\\$1')}"],{type:"application/javascript"}));return new Worker(e)}rebuildWorkers(){const e=this.requestedWorkers-this.workers.length;if(e<0)throw new Error("Cannot have less than 0 workers");if(e<=0)return;const s=Array.from({length:e},(()=>this.createWorker()));this.workers.push(...s)}*nextWorker(){let e=0;for(;;)e=(e+1)%this.workers.length,yield this.workers[e]}removeMessageListener(e){const s=this.messageListeners.get(e);s&&(this.workers.forEach((e=>e.removeEventListener("message",s))),this.messageListeners.delete(e))}}(s)}async runCode(e){return this.workerManager.execute(e)}}})();`;
|
10
10
|
exports.default = source;
|
@@ -1,11 +1,15 @@
|
|
1
1
|
import { Task } from '../../types';
|
2
2
|
export default class Manager {
|
3
|
-
private
|
4
|
-
private
|
5
|
-
|
3
|
+
private readonly requestedWorkers;
|
4
|
+
private readonly workers;
|
5
|
+
private nextWorkerIndex;
|
6
|
+
private readonly messageListeners;
|
7
|
+
constructor(workers?: number);
|
6
8
|
execute(task: Task): Promise<unknown>;
|
7
|
-
terminate
|
9
|
+
private terminate;
|
8
10
|
private runTask;
|
9
11
|
private createWorker;
|
12
|
+
private rebuildWorkers;
|
13
|
+
private getWorker;
|
10
14
|
private removeMessageListener;
|
11
15
|
}
|
@@ -3,16 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// this token (__WORKER_SOURCE__) is replaced by webpack with the source of the worker
|
4
4
|
const WORKER_SOURCE = '__WORKER_SOURCE__';
|
5
5
|
class Manager {
|
6
|
-
constructor() {
|
6
|
+
constructor(workers = 1) {
|
7
|
+
this.nextWorkerIndex = 0;
|
7
8
|
this.messageListeners = new Map();
|
8
|
-
this.
|
9
|
+
this.requestedWorkers = workers;
|
10
|
+
this.workers = Array.from({ length: workers }, () => this.createWorker());
|
9
11
|
}
|
10
12
|
async execute(task) {
|
13
|
+
const worker = this.getWorker();
|
11
14
|
const workerTask = {
|
12
15
|
...task,
|
13
16
|
contextVariable: task.contextVariable ?? 'ctx',
|
14
17
|
};
|
15
|
-
const result = this.runTask(workerTask);
|
18
|
+
const result = this.runTask(worker, workerTask);
|
16
19
|
const timeout = new Promise((_, reject) => {
|
17
20
|
const signal = AbortSignal.timeout(task.timeout);
|
18
21
|
signal.addEventListener('abort', () => {
|
@@ -22,7 +25,8 @@ class Manager {
|
|
22
25
|
return Promise.race([result, timeout])
|
23
26
|
.catch((e) => {
|
24
27
|
if (e.name === 'TimeoutError') {
|
25
|
-
this.terminate();
|
28
|
+
this.terminate(worker);
|
29
|
+
throw new DOMException('soft timeout reached', 'TimeoutError');
|
26
30
|
}
|
27
31
|
throw e;
|
28
32
|
})
|
@@ -30,14 +34,14 @@ class Manager {
|
|
30
34
|
this.removeMessageListener(task.id);
|
31
35
|
});
|
32
36
|
}
|
33
|
-
terminate() {
|
37
|
+
terminate(worker) {
|
34
38
|
for (const listener of this.messageListeners.values()) {
|
35
|
-
|
39
|
+
worker.removeEventListener('message', listener);
|
36
40
|
}
|
37
|
-
|
38
|
-
this.
|
41
|
+
worker.terminate();
|
42
|
+
this.rebuildWorkers();
|
39
43
|
}
|
40
|
-
runTask(task) {
|
44
|
+
runTask(worker, task) {
|
41
45
|
return new Promise((resolve, reject) => {
|
42
46
|
const listener = (event) => {
|
43
47
|
const { data } = event;
|
@@ -51,20 +55,34 @@ class Manager {
|
|
51
55
|
}
|
52
56
|
};
|
53
57
|
this.messageListeners.set(task.id, listener);
|
54
|
-
|
55
|
-
|
58
|
+
worker.addEventListener('message', listener);
|
59
|
+
worker.postMessage(task);
|
56
60
|
});
|
57
61
|
}
|
58
62
|
createWorker() {
|
59
63
|
const blob = URL.createObjectURL(new Blob([WORKER_SOURCE], { type: 'application/javascript' }));
|
60
64
|
return new Worker(blob);
|
61
65
|
}
|
66
|
+
rebuildWorkers() {
|
67
|
+
const needed = this.requestedWorkers - this.workers.length;
|
68
|
+
if (needed < 0)
|
69
|
+
throw new Error('Cannot have less than 0 workers');
|
70
|
+
if (needed <= 0)
|
71
|
+
return;
|
72
|
+
const newWorkers = Array.from({ length: needed }, () => this.createWorker());
|
73
|
+
this.workers.push(...newWorkers);
|
74
|
+
}
|
75
|
+
getWorker() {
|
76
|
+
const worker = this.workers[this.nextWorkerIndex];
|
77
|
+
this.nextWorkerIndex = (this.nextWorkerIndex + 1) % this.workers.length;
|
78
|
+
return worker;
|
79
|
+
}
|
62
80
|
removeMessageListener(id) {
|
63
81
|
const listener = this.messageListeners.get(id);
|
64
|
-
if (!listener)
|
82
|
+
if (!listener)
|
65
83
|
return;
|
66
|
-
|
67
|
-
this.
|
84
|
+
this.workers.forEach((worker) => worker.removeEventListener('message', listener));
|
85
|
+
this.messageListeners.delete(id);
|
68
86
|
}
|
69
87
|
}
|
70
88
|
exports.default = Manager;
|
@@ -2,5 +2,5 @@
|
|
2
2
|
// Auto-generated file
|
3
3
|
/* eslint-disable */
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
-
const source = `(()=>{"use strict";
|
5
|
+
const source = `(()=>{"use strict";const e=["TEMPORARY","PERSISTENT","console","self","onmessage","postMessage","global","allowed","Array","Boolean","Date","Function","Number","Object","RegExp","String","Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","isFinite","isNaN","parseFloat","parseInt","Infinity","JSON","Math","NaN","undefined"];[...Object.getOwnPropertyNames(self),...Object.getOwnPropertyNames(self.__proto__)].forEach((r=>{e.includes(r)||Object.defineProperty(self,r,{get:()=>{throw new Error(\`Security Exception: cannot access \${r}\`)},set:()=>{throw new Error(\`Security Exception: cannot set \${r}\`)},configurable:!1})})),onmessage=e=>{let r,t=!0;try{r=Function(e.data.contextVariable,\`"use strict";return (\${e.data.code});\`)(e.data.context)}catch(e){r=e,t=!1}const o={id:e.data.id,result:r,success:t};postMessage(o)}})();`;
|
6
6
|
exports.default = source;
|
@@ -44,7 +44,7 @@ export default class WebSandbox {
|
|
44
44
|
*
|
45
45
|
* This will remove the iframe from the DOM and remove the message listener.
|
46
46
|
*/
|
47
|
-
destroy(): void;
|
47
|
+
destroy(reason?: unknown): void;
|
48
48
|
private initialise;
|
49
49
|
private validateOptions;
|
50
50
|
private destroyAndRebuild;
|
@@ -35,8 +35,8 @@ class WebSandbox {
|
|
35
35
|
this.initialised = this.initialise();
|
36
36
|
this.frameAbortController = new AbortController();
|
37
37
|
if (options.abortSignal) {
|
38
|
-
this.promisifyAbortSignal(options.abortSignal).catch(() => {
|
39
|
-
void this.destroyAndRebuild(this.frame.id);
|
38
|
+
this.promisifyAbortSignal(options.abortSignal).catch((reason) => {
|
39
|
+
void this.destroyAndRebuild(this.frame.id, reason);
|
40
40
|
});
|
41
41
|
}
|
42
42
|
}
|
@@ -51,8 +51,8 @@ class WebSandbox {
|
|
51
51
|
*
|
52
52
|
* This will remove the iframe from the DOM and remove the message listener.
|
53
53
|
*/
|
54
|
-
destroy() {
|
55
|
-
this.frameAbortController.abort();
|
54
|
+
destroy(reason) {
|
55
|
+
this.frameAbortController.abort(reason);
|
56
56
|
this.frame.remove();
|
57
57
|
this.removeMessageListener();
|
58
58
|
}
|
@@ -85,11 +85,11 @@ class WebSandbox {
|
|
85
85
|
throw new Error('maximum timeout must be less than or equal to 5000ms');
|
86
86
|
}
|
87
87
|
}
|
88
|
-
async destroyAndRebuild(frameId) {
|
88
|
+
async destroyAndRebuild(frameId, reason) {
|
89
89
|
if (this.frame.id !== frameId) {
|
90
90
|
return;
|
91
91
|
}
|
92
|
-
this.destroy();
|
92
|
+
this.destroy(reason);
|
93
93
|
this.frame = this.createFrame();
|
94
94
|
this.frameAbortController = new AbortController();
|
95
95
|
await this.initialise();
|
@@ -123,7 +123,7 @@ class WebSandbox {
|
|
123
123
|
const signals = [task, timeout, frameAbortedSignal, userAbortedSignal].filter((i) => i !== null);
|
124
124
|
return Promise.race(signals).catch(async (e) => {
|
125
125
|
if (e.name === 'TimeoutError') {
|
126
|
-
await this.destroyAndRebuild(frameId);
|
126
|
+
await this.destroyAndRebuild(frameId, 'task timed out');
|
127
127
|
}
|
128
128
|
throw e;
|
129
129
|
});
|
package/cjs/models/RocosError.js
CHANGED
@@ -28,6 +28,7 @@ exports.errorCodes = {
|
|
28
28
|
EVALUATOR_SERVICE_ERROR: 'EVALUATOR_SERVICE_ERROR',
|
29
29
|
WEBRTC_SERVICE_ERROR: 'WEBRTC_SERVICE_ERROR',
|
30
30
|
DEVICE_CREDENTIALS_SERVICE_ERROR: 'DEVICE_CREDENTIALS_SERVICE_ERROR',
|
31
|
+
TARGET_SERVICE_ERROR: 'TARGET_SERVICE_ERROR',
|
31
32
|
};
|
32
33
|
class RocosError extends Error {
|
33
34
|
constructor(err, code, statusCode) {
|
@@ -1,29 +1,30 @@
|
|
1
1
|
export declare enum ServiceEnum {
|
2
|
+
ASSET_STORAGE = "asset_storage",
|
2
3
|
AUTH = "auth",
|
3
|
-
TELEMETRY = "telemetry",
|
4
|
-
ROBOT = "robot",
|
5
|
-
EVENT = "event",
|
6
|
-
PROJECT = "project",
|
7
4
|
CALLER = "caller",
|
8
5
|
COMMAND = "command",
|
9
|
-
CONTROL = "control",
|
10
|
-
SEARCH = "search",
|
11
6
|
CONFIG_GROUP = "config_group",
|
7
|
+
CONTROL = "control",
|
12
8
|
DASHBOARD = "dashboard",
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
TIME_SYNCER = "time_syncer",
|
17
|
-
WORKFLOW = "workflow",
|
18
|
-
ASSET_STORAGE = "asset_storage",
|
19
|
-
PROFILE = "profile",
|
20
|
-
WEBRTC_SIGNALLING = "webrtc_signalling",
|
9
|
+
DEVICE_CREDENTIALS = "device_credentials",
|
10
|
+
EVENT = "event",
|
11
|
+
EVALUATOR = "evaluator",
|
21
12
|
FILE_ACCESSOR = "file_accessor",
|
22
|
-
|
23
|
-
SPOT_PROVISIONER = "spot_provisioner",
|
13
|
+
FUNCTION = "function",
|
24
14
|
INTEGRATION = "integration",
|
25
15
|
MAP = "map",
|
26
|
-
|
16
|
+
PROJECT = "project",
|
17
|
+
PROFILE = "profile",
|
18
|
+
ROBOT = "robot",
|
27
19
|
RTP_WEBRTC = "rtp_webrtc",
|
28
|
-
|
20
|
+
SCHEDULE = "schedule",
|
21
|
+
SEARCH = "search",
|
22
|
+
SPOT_PROVISIONER = "spot_provisioner",
|
23
|
+
STREAM = "stream",
|
24
|
+
TARGET = "target",
|
25
|
+
TELEMETRY = "telemetry",
|
26
|
+
TIME_SYNCER = "time_syncer",
|
27
|
+
USER = "user",
|
28
|
+
WEBRTC_SIGNALLING = "webrtc_signalling",
|
29
|
+
WORKFLOW = "workflow"
|
29
30
|
}
|
@@ -3,31 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ServiceEnum = void 0;
|
4
4
|
var ServiceEnum;
|
5
5
|
(function (ServiceEnum) {
|
6
|
+
ServiceEnum["ASSET_STORAGE"] = "asset_storage";
|
6
7
|
ServiceEnum["AUTH"] = "auth";
|
7
|
-
ServiceEnum["TELEMETRY"] = "telemetry";
|
8
|
-
ServiceEnum["ROBOT"] = "robot";
|
9
|
-
ServiceEnum["EVENT"] = "event";
|
10
|
-
ServiceEnum["PROJECT"] = "project";
|
11
8
|
ServiceEnum["CALLER"] = "caller";
|
12
9
|
ServiceEnum["COMMAND"] = "command";
|
13
|
-
ServiceEnum["CONTROL"] = "control";
|
14
|
-
ServiceEnum["SEARCH"] = "search";
|
15
10
|
ServiceEnum["CONFIG_GROUP"] = "config_group";
|
11
|
+
ServiceEnum["CONTROL"] = "control";
|
16
12
|
ServiceEnum["DASHBOARD"] = "dashboard";
|
17
|
-
ServiceEnum["
|
18
|
-
ServiceEnum["
|
19
|
-
ServiceEnum["
|
20
|
-
ServiceEnum["TIME_SYNCER"] = "time_syncer";
|
21
|
-
ServiceEnum["WORKFLOW"] = "workflow";
|
22
|
-
ServiceEnum["ASSET_STORAGE"] = "asset_storage";
|
23
|
-
ServiceEnum["PROFILE"] = "profile";
|
24
|
-
ServiceEnum["WEBRTC_SIGNALLING"] = "webrtc_signalling";
|
13
|
+
ServiceEnum["DEVICE_CREDENTIALS"] = "device_credentials";
|
14
|
+
ServiceEnum["EVENT"] = "event";
|
15
|
+
ServiceEnum["EVALUATOR"] = "evaluator";
|
25
16
|
ServiceEnum["FILE_ACCESSOR"] = "file_accessor";
|
26
|
-
ServiceEnum["
|
27
|
-
ServiceEnum["SPOT_PROVISIONER"] = "spot_provisioner";
|
17
|
+
ServiceEnum["FUNCTION"] = "function";
|
28
18
|
ServiceEnum["INTEGRATION"] = "integration";
|
29
19
|
ServiceEnum["MAP"] = "map";
|
30
|
-
ServiceEnum["
|
20
|
+
ServiceEnum["PROJECT"] = "project";
|
21
|
+
ServiceEnum["PROFILE"] = "profile";
|
22
|
+
ServiceEnum["ROBOT"] = "robot";
|
31
23
|
ServiceEnum["RTP_WEBRTC"] = "rtp_webrtc";
|
32
|
-
ServiceEnum["
|
24
|
+
ServiceEnum["SCHEDULE"] = "schedule";
|
25
|
+
ServiceEnum["SEARCH"] = "search";
|
26
|
+
ServiceEnum["SPOT_PROVISIONER"] = "spot_provisioner";
|
27
|
+
ServiceEnum["STREAM"] = "stream";
|
28
|
+
ServiceEnum["TARGET"] = "target";
|
29
|
+
ServiceEnum["TELEMETRY"] = "telemetry";
|
30
|
+
ServiceEnum["TIME_SYNCER"] = "time_syncer";
|
31
|
+
ServiceEnum["USER"] = "user";
|
32
|
+
ServiceEnum["WEBRTC_SIGNALLING"] = "webrtc_signalling";
|
33
|
+
ServiceEnum["WORKFLOW"] = "workflow";
|
33
34
|
})(ServiceEnum || (exports.ServiceEnum = ServiceEnum = {}));
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./Position"), exports);
|
18
|
+
__exportStar(require("./Quaternion"), exports);
|
19
|
+
__exportStar(require("./Vector3"), exports);
|
package/cjs/models/index.d.ts
CHANGED
@@ -33,6 +33,7 @@ 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 './target/Target';
|
36
37
|
export * from './ExportDataQuery';
|
37
38
|
export * from './HttpError';
|
38
39
|
export * from './IBaseService';
|
package/cjs/models/index.js
CHANGED
@@ -49,6 +49,7 @@ __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("./target/Target"), exports);
|
52
53
|
__exportStar(require("./ExportDataQuery"), exports);
|
53
54
|
__exportStar(require("./HttpError"), exports);
|
54
55
|
__exportStar(require("./IBaseService"), exports);
|
@@ -1,20 +1,4 @@
|
|
1
|
-
|
2
|
-
pitch: number;
|
3
|
-
yaw: number;
|
4
|
-
x?: number;
|
5
|
-
y?: number;
|
6
|
-
}
|
7
|
-
export interface Quaternion {
|
8
|
-
x: number;
|
9
|
-
y: number;
|
10
|
-
z: number;
|
11
|
-
w: number;
|
12
|
-
}
|
13
|
-
export interface Vector3 {
|
14
|
-
x: number;
|
15
|
-
y: number;
|
16
|
-
z: number;
|
17
|
-
}
|
1
|
+
import { Position, Quaternion, Vector3 } from '../graph';
|
18
2
|
export interface Observation {
|
19
3
|
panoramaID: string;
|
20
4
|
id?: string;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { Quaternion } from '../graph/Quaternion';
|
2
|
+
import { Vector3 } from '../graph/Vector3';
|
3
|
+
/**
|
4
|
+
* Observation target model (such as an asset, a point of interest, a puddle, etc.)
|
5
|
+
*/
|
6
|
+
export interface Target {
|
7
|
+
/**
|
8
|
+
* Unique identifier of the target
|
9
|
+
*/
|
10
|
+
id: string;
|
11
|
+
/**
|
12
|
+
* Name of the target
|
13
|
+
*/
|
14
|
+
name: string;
|
15
|
+
/**
|
16
|
+
* Metadata associated with the target (key-value pairs) such as name, type, asset-id, etc.
|
17
|
+
*/
|
18
|
+
data: Record<string, string>;
|
19
|
+
/**
|
20
|
+
* Position of the target in the 3D space
|
21
|
+
*/
|
22
|
+
translation: Vector3;
|
23
|
+
/**
|
24
|
+
* Rotation of the target in the 3D space
|
25
|
+
*/
|
26
|
+
rotation: Quaternion;
|
27
|
+
}
|