@dronedeploy/rocos-js-sdk 3.0.1-alpha.9 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +59 -29
- package/cjs/IRocosSDK.d.ts +4 -3
- package/cjs/RocosSDK.d.ts +19 -7
- package/cjs/RocosSDK.js +31 -10
- package/cjs/api/streams/caller/CallerStream.js +5 -2
- package/cjs/api/streams/caller/CallerStreamNode.js +2 -1
- package/cjs/api/streams/command/CommandStream.js +5 -2
- package/cjs/api/streams/command/CommandStreamNode.js +2 -1
- package/cjs/api/streams/control/ControlStream.js +5 -2
- package/cjs/api/streams/control/ControlStreamAbstract.d.ts +1 -1
- package/cjs/api/streams/control/ControlStreamNode.js +2 -1
- package/cjs/api/streams/fileAccessor/FileAccessorStream.js +4 -1
- package/cjs/api/streams/fileAccessor/FileAccessorStreamNode.js +3 -1
- package/cjs/api/streams/search/SearchStream.js +5 -2
- package/cjs/api/streams/search/SearchStreamNode.js +2 -1
- package/cjs/api/streams/telemetry/TelemetryStream.js +4 -1
- package/cjs/api/streams/telemetry/TelemetryStreamAbstract.d.ts +1 -1
- package/cjs/api/streams/telemetry/TelemetryStreamNode.js +2 -1
- package/cjs/api/streams/webRTCSignalling/WebRTCSignallingStream.js +5 -2
- package/cjs/constants/api.d.ts +31 -15
- package/cjs/constants/api.js +35 -18
- package/cjs/helpers/cleanObject.js +4 -1
- package/cjs/helpers/getUniqueConfigKey.d.ts +6 -2
- package/cjs/helpers/getUniqueConfigKey.js +7 -2
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +1 -0
- package/cjs/helpers/kscript/Context.d.ts +34 -0
- package/cjs/helpers/kscript/Context.js +52 -0
- package/cjs/helpers/kscript/index.d.ts +1 -0
- package/cjs/helpers/kscript/index.js +27 -0
- package/cjs/helpers/kscript/kscript.d.ts +6 -0
- package/cjs/helpers/kscript/kscript.js +115 -0
- package/cjs/helpers/kscript/nodes/Identifier.d.ts +12 -0
- package/cjs/helpers/kscript/nodes/Identifier.js +20 -0
- package/cjs/helpers/kscript/nodes/Literal.d.ts +11 -0
- package/cjs/helpers/kscript/nodes/Literal.js +22 -0
- package/cjs/helpers/kscript/nodes/Node.d.ts +9 -0
- package/cjs/helpers/kscript/nodes/Node.js +15 -0
- package/cjs/helpers/kscript/nodes/Program.d.ts +11 -0
- package/cjs/helpers/kscript/nodes/Program.js +24 -0
- package/cjs/helpers/kscript/nodes/TemplateLiteral.d.ts +23 -0
- package/cjs/helpers/kscript/nodes/TemplateLiteral.js +35 -0
- package/cjs/helpers/kscript/nodes/expressions/ArrayExpression.d.ts +7 -0
- package/cjs/helpers/kscript/nodes/expressions/ArrayExpression.js +31 -0
- package/cjs/helpers/kscript/nodes/expressions/ArrowFunctionExpression.d.ts +14 -0
- package/cjs/helpers/kscript/nodes/expressions/ArrowFunctionExpression.js +40 -0
- package/cjs/helpers/kscript/nodes/expressions/BinaryExpression.d.ts +16 -0
- package/cjs/helpers/kscript/nodes/expressions/BinaryExpression.js +104 -0
- package/cjs/helpers/kscript/nodes/expressions/CallExpression.d.ts +8 -0
- package/cjs/helpers/kscript/nodes/expressions/CallExpression.js +38 -0
- package/cjs/helpers/kscript/nodes/expressions/ChainExpression.d.ts +16 -0
- package/cjs/helpers/kscript/nodes/expressions/ChainExpression.js +25 -0
- package/cjs/helpers/kscript/nodes/expressions/ConditionalExpression.d.ts +14 -0
- package/cjs/helpers/kscript/nodes/expressions/ConditionalExpression.js +30 -0
- package/cjs/helpers/kscript/nodes/expressions/ExpressionStatement.d.ts +7 -0
- package/cjs/helpers/kscript/nodes/expressions/ExpressionStatement.js +18 -0
- package/cjs/helpers/kscript/nodes/expressions/LogicalExpression.d.ts +10 -0
- package/cjs/helpers/kscript/nodes/expressions/LogicalExpression.js +47 -0
- package/cjs/helpers/kscript/nodes/expressions/MemberExpression.d.ts +44 -0
- package/cjs/helpers/kscript/nodes/expressions/MemberExpression.js +98 -0
- package/cjs/helpers/kscript/nodes/expressions/ObjectExpression.d.ts +11 -0
- package/cjs/helpers/kscript/nodes/expressions/ObjectExpression.js +59 -0
- package/cjs/helpers/kscript/nodes/expressions/UnaryExpression.d.ts +12 -0
- package/cjs/helpers/kscript/nodes/expressions/UnaryExpression.js +44 -0
- package/cjs/helpers/kscript/nodes/expressions/index.d.ts +11 -0
- package/cjs/helpers/kscript/nodes/expressions/index.js +28 -0
- package/cjs/helpers/kscript/nodes/index.d.ts +4 -0
- package/cjs/helpers/kscript/nodes/index.js +10 -0
- package/cjs/helpers/kscript/nodes/nodeTypes.d.ts +33 -0
- package/cjs/helpers/kscript/nodes/nodeTypes.js +29 -0
- package/cjs/helpers/kscript/utils.d.ts +4 -0
- package/cjs/helpers/kscript/utils.js +15 -0
- 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/IConnectedCallsign.d.ts +10 -0
- package/cjs/models/IConnectedCallsign.js +8 -0
- package/cjs/models/RocosError.d.ts +3 -0
- package/cjs/models/RocosError.js +3 -0
- package/cjs/models/ServiceEnum.d.ts +20 -17
- package/cjs/models/ServiceEnum.js +20 -17
- 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/asset-storage/{AssetModelItem.d.ts → AssetItem.d.ts} +2 -0
- package/cjs/models/device-credentials/DeviceCredentials.d.ts +61 -0
- package/cjs/models/device-credentials/DeviceCredentials.js +2 -0
- 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 +9 -2
- package/cjs/models/index.js +9 -2
- package/cjs/models/integrations/Location.d.ts +24 -0
- package/cjs/models/integrations/Location.js +2 -0
- package/cjs/models/integrations/PaginatedResults.d.ts +4 -0
- package/cjs/models/integrations/PaginatedResults.js +2 -0
- package/cjs/models/maps/Panorama.d.ts +12 -21
- package/cjs/models/projects/ExternalProject.d.ts +10 -0
- package/cjs/models/projects/ExternalProject.js +2 -0
- package/cjs/models/projects/NewProjectRequest.d.ts +8 -0
- package/cjs/models/projects/NewProjectRequest.js +2 -0
- package/cjs/models/target/Target.d.ts +30 -0
- package/cjs/models/target/Target.js +15 -0
- package/cjs/node/RocosSDKNode.d.ts +1 -5
- package/cjs/node/RocosSDKNode.js +9 -9
- package/cjs/services/AssetStorageService.d.ts +9 -1
- package/cjs/services/AssetStorageService.js +12 -1
- package/cjs/services/AuthService.d.ts +12 -1
- package/cjs/services/AuthService.js +25 -1
- package/cjs/services/DeviceCredentialsService.d.ts +15 -0
- package/cjs/services/DeviceCredentialsService.js +56 -0
- package/cjs/services/EnvironmentService.d.ts +34 -0
- package/cjs/services/EnvironmentService.js +56 -0
- package/cjs/services/EvaluatorService.js +1 -1
- package/cjs/services/IntegrationService.d.ts +7 -1
- package/cjs/services/IntegrationService.js +8 -0
- package/cjs/services/MapService.d.ts +18 -8
- package/cjs/services/MapService.js +37 -19
- package/cjs/services/ProfileService.d.ts +24 -0
- package/cjs/services/ProfileService.js +34 -0
- package/cjs/services/ProjectService.d.ts +7 -2
- package/cjs/services/ProjectService.js +7 -3
- package/cjs/services/RTPWebRTCService.d.ts +6 -1
- package/cjs/services/RTPWebRTCService.js +10 -2
- package/cjs/services/RobotService.d.ts +3 -1
- package/cjs/services/RobotService.js +6 -0
- package/cjs/services/SpotProvisioningService.d.ts +1 -1
- package/cjs/services/SpotProvisioningServiceNode.d.ts +1 -1
- package/cjs/services/TargetService.d.ts +17 -0
- package/cjs/services/TargetService.js +66 -0
- package/cjs/services/TelemetryService.d.ts +10 -1
- package/cjs/services/TelemetryService.js +27 -5
- package/cjs/services/WorkflowService.d.ts +18 -8
- package/cjs/services/WorkflowService.js +37 -11
- package/cjs/services/index.d.ts +11 -9
- package/cjs/services/index.js +11 -9
- package/cjs/store/RocosStore.d.ts +1 -2
- package/esm/IRocosSDK.d.ts +4 -3
- package/esm/RocosSDK.d.ts +19 -7
- package/esm/RocosSDK.js +32 -11
- package/esm/api/streams/caller/CallerStream.js +5 -2
- package/esm/api/streams/caller/CallerStreamNode.js +2 -1
- package/esm/api/streams/command/CommandStream.js +5 -2
- package/esm/api/streams/command/CommandStreamNode.js +2 -1
- package/esm/api/streams/control/ControlStream.js +5 -2
- package/esm/api/streams/control/ControlStreamAbstract.d.ts +1 -1
- package/esm/api/streams/control/ControlStreamNode.js +2 -1
- package/esm/api/streams/fileAccessor/FileAccessorStream.js +4 -1
- package/esm/api/streams/fileAccessor/FileAccessorStreamNode.js +3 -1
- package/esm/api/streams/search/SearchStream.js +5 -2
- package/esm/api/streams/search/SearchStreamNode.js +2 -1
- package/esm/api/streams/telemetry/TelemetryStream.js +4 -1
- package/esm/api/streams/telemetry/TelemetryStreamAbstract.d.ts +1 -1
- package/esm/api/streams/telemetry/TelemetryStreamNode.js +2 -1
- package/esm/api/streams/webRTCSignalling/WebRTCSignallingStream.js +5 -2
- package/esm/constants/api.d.ts +31 -15
- package/esm/constants/api.js +31 -15
- package/esm/helpers/cleanObject.js +4 -1
- package/esm/helpers/getUniqueConfigKey.d.ts +6 -2
- package/esm/helpers/getUniqueConfigKey.js +7 -2
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/kscript/Context.d.ts +34 -0
- package/esm/helpers/kscript/Context.js +49 -0
- package/esm/helpers/kscript/index.d.ts +1 -0
- package/esm/helpers/kscript/index.js +1 -0
- package/esm/helpers/kscript/kscript.d.ts +6 -0
- package/esm/helpers/kscript/kscript.js +107 -0
- package/esm/helpers/kscript/nodes/Identifier.d.ts +12 -0
- package/esm/helpers/kscript/nodes/Identifier.js +14 -0
- package/esm/helpers/kscript/nodes/Literal.d.ts +11 -0
- package/esm/helpers/kscript/nodes/Literal.js +16 -0
- package/esm/helpers/kscript/nodes/Node.d.ts +9 -0
- package/esm/helpers/kscript/nodes/Node.js +12 -0
- package/esm/helpers/kscript/nodes/Program.d.ts +11 -0
- package/esm/helpers/kscript/nodes/Program.js +18 -0
- package/esm/helpers/kscript/nodes/TemplateLiteral.d.ts +23 -0
- package/esm/helpers/kscript/nodes/TemplateLiteral.js +29 -0
- package/esm/helpers/kscript/nodes/expressions/ArrayExpression.d.ts +7 -0
- package/esm/helpers/kscript/nodes/expressions/ArrayExpression.js +25 -0
- package/esm/helpers/kscript/nodes/expressions/ArrowFunctionExpression.d.ts +14 -0
- package/esm/helpers/kscript/nodes/expressions/ArrowFunctionExpression.js +34 -0
- package/esm/helpers/kscript/nodes/expressions/BinaryExpression.d.ts +16 -0
- package/esm/helpers/kscript/nodes/expressions/BinaryExpression.js +98 -0
- package/esm/helpers/kscript/nodes/expressions/CallExpression.d.ts +8 -0
- package/esm/helpers/kscript/nodes/expressions/CallExpression.js +32 -0
- package/esm/helpers/kscript/nodes/expressions/ChainExpression.d.ts +16 -0
- package/esm/helpers/kscript/nodes/expressions/ChainExpression.js +19 -0
- package/esm/helpers/kscript/nodes/expressions/ConditionalExpression.d.ts +14 -0
- package/esm/helpers/kscript/nodes/expressions/ConditionalExpression.js +24 -0
- package/esm/helpers/kscript/nodes/expressions/ExpressionStatement.d.ts +7 -0
- package/esm/helpers/kscript/nodes/expressions/ExpressionStatement.js +12 -0
- package/esm/helpers/kscript/nodes/expressions/LogicalExpression.d.ts +10 -0
- package/esm/helpers/kscript/nodes/expressions/LogicalExpression.js +41 -0
- package/esm/helpers/kscript/nodes/expressions/MemberExpression.d.ts +44 -0
- package/esm/helpers/kscript/nodes/expressions/MemberExpression.js +92 -0
- package/esm/helpers/kscript/nodes/expressions/ObjectExpression.d.ts +11 -0
- package/esm/helpers/kscript/nodes/expressions/ObjectExpression.js +53 -0
- package/esm/helpers/kscript/nodes/expressions/UnaryExpression.d.ts +12 -0
- package/esm/helpers/kscript/nodes/expressions/UnaryExpression.js +38 -0
- package/esm/helpers/kscript/nodes/expressions/index.d.ts +11 -0
- package/esm/helpers/kscript/nodes/expressions/index.js +11 -0
- package/esm/helpers/kscript/nodes/index.d.ts +4 -0
- package/esm/helpers/kscript/nodes/index.js +3 -0
- package/esm/helpers/kscript/nodes/nodeTypes.d.ts +33 -0
- package/esm/helpers/kscript/nodes/nodeTypes.js +24 -0
- package/esm/helpers/kscript/utils.d.ts +4 -0
- package/esm/helpers/kscript/utils.js +11 -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/IConnectedCallsign.d.ts +10 -0
- package/esm/models/IConnectedCallsign.js +5 -0
- package/esm/models/RocosError.d.ts +3 -0
- package/esm/models/RocosError.js +3 -0
- package/esm/models/ServiceEnum.d.ts +20 -17
- package/esm/models/ServiceEnum.js +20 -17
- 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/asset-storage/{AssetModelItem.d.ts → AssetItem.d.ts} +2 -0
- package/esm/models/device-credentials/DeviceCredentials.d.ts +61 -0
- package/esm/models/graph/Position.d.ts +6 -0
- package/esm/models/graph/Quaternion.d.ts +6 -0
- package/esm/models/graph/Vector3.d.ts +5 -0
- package/esm/models/graph/index.d.ts +3 -0
- package/esm/models/graph/index.js +3 -0
- package/esm/models/index.d.ts +9 -2
- package/esm/models/index.js +9 -2
- package/esm/models/integrations/Location.d.ts +24 -0
- package/esm/models/integrations/PaginatedResults.d.ts +4 -0
- package/esm/models/maps/Panorama.d.ts +12 -21
- package/esm/models/projects/ExternalProject.d.ts +10 -0
- package/esm/models/projects/NewProjectRequest.d.ts +8 -0
- package/esm/models/target/Target.d.ts +30 -0
- package/esm/models/target/Target.js +9 -0
- package/esm/node/RocosSDKNode.d.ts +1 -5
- package/esm/node/RocosSDKNode.js +10 -10
- package/esm/services/AssetStorageService.d.ts +9 -1
- package/esm/services/AssetStorageService.js +13 -2
- package/esm/services/AuthService.d.ts +12 -1
- package/esm/services/AuthService.js +25 -1
- package/esm/services/BaseServiceAbstract.js +1 -1
- package/esm/services/DeviceCredentialsService.d.ts +15 -0
- package/esm/services/DeviceCredentialsService.js +52 -0
- package/esm/services/EnvironmentService.d.ts +34 -0
- package/esm/services/EnvironmentService.js +52 -0
- package/esm/services/EvaluatorService.js +1 -1
- package/esm/services/IntegrationService.d.ts +7 -1
- package/esm/services/IntegrationService.js +10 -2
- package/esm/services/MapService.d.ts +18 -8
- package/esm/services/MapService.js +38 -20
- package/esm/services/ProfileService.d.ts +24 -0
- package/esm/services/ProfileService.js +35 -1
- package/esm/services/ProjectService.d.ts +7 -2
- package/esm/services/ProjectService.js +9 -5
- package/esm/services/RTPWebRTCService.d.ts +6 -1
- package/esm/services/RTPWebRTCService.js +10 -2
- package/esm/services/RobotService.d.ts +3 -1
- package/esm/services/RobotService.js +8 -2
- package/esm/services/SpotProvisioningService.d.ts +1 -1
- package/esm/services/SpotProvisioningServiceNode.d.ts +1 -1
- package/esm/services/TargetService.d.ts +17 -0
- package/esm/services/TargetService.js +62 -0
- package/esm/services/TelemetryService.d.ts +10 -1
- package/esm/services/TelemetryService.js +28 -6
- package/esm/services/WorkflowService.d.ts +18 -8
- package/esm/services/WorkflowService.js +38 -12
- package/esm/services/index.d.ts +11 -9
- package/esm/services/index.js +11 -9
- package/esm/store/RocosStore.d.ts +1 -2
- package/package.json +2 -2
- package/cjs/helpers/cleanObject.spec.js +0 -55
- package/cjs/helpers/flattenObject.spec.js +0 -31
- package/cjs/helpers/flattenOneOf.spec.js +0 -159
- package/cjs/helpers/formatServiceUrl.spec.js +0 -18
- package/cjs/helpers/getSha256Hex.spec.js +0 -19
- package/cjs/helpers/getSha256HexNode.spec.js +0 -10
- package/cjs/helpers/getURLSearchParams.spec.js +0 -21
- package/cjs/helpers/nanosecondToMillisecond.spec.js +0 -22
- package/cjs/helpers/splitRobotTopic.spec.js +0 -53
- package/cjs/helpers/standardDeviation.spec.d.ts +0 -1
- package/cjs/helpers/standardDeviation.spec.js +0 -13
- package/cjs/helpers/websandbox/frame/worker/manager.spec.d.ts +0 -4
- package/cjs/helpers/websandbox/frame/worker/manager.spec.js +0 -132
- package/cjs/models/CallsignStatus.d.ts +0 -6
- package/cjs/models/CallsignStatus.js +0 -10
- package/cjs/models/ExternalProject.d.ts +0 -6
- package/cjs/models/ExternalProject.js +0 -6
- package/cjs/models/Token.spec.d.ts +0 -1
- package/cjs/models/Token.spec.js +0 -110
- package/cjs/services/AuthService.spec.d.ts +0 -1
- package/cjs/services/AuthService.spec.js +0 -165
- package/cjs/services/CallerService.spec.d.ts +0 -1
- package/cjs/services/CallerService.spec.js +0 -229
- package/cjs/services/FunctionService.d.ts +0 -68
- package/cjs/services/FunctionService.js +0 -103
- package/cjs/services/PlatformTimeService.spec.d.ts +0 -1
- package/cjs/services/PlatformTimeService.spec.js +0 -182
- package/cjs/services/RTPWebRTCService.spec.d.ts +0 -4
- package/cjs/services/RTPWebRTCService.spec.js +0 -171
- package/cjs/services/TelemetryService.spec.d.ts +0 -1
- package/cjs/services/TelemetryService.spec.js +0 -39
- package/esm/helpers/cleanObject.spec.d.ts +0 -1
- package/esm/helpers/cleanObject.spec.js +0 -53
- package/esm/helpers/flattenObject.spec.d.ts +0 -1
- package/esm/helpers/flattenObject.spec.js +0 -29
- package/esm/helpers/flattenOneOf.spec.d.ts +0 -1
- package/esm/helpers/flattenOneOf.spec.js +0 -157
- package/esm/helpers/formatServiceUrl.spec.d.ts +0 -1
- package/esm/helpers/formatServiceUrl.spec.js +0 -16
- package/esm/helpers/getSha256Hex.spec.d.ts +0 -1
- package/esm/helpers/getSha256Hex.spec.js +0 -14
- package/esm/helpers/getSha256HexNode.spec.d.ts +0 -1
- package/esm/helpers/getSha256HexNode.spec.js +0 -8
- package/esm/helpers/getURLSearchParams.spec.d.ts +0 -1
- package/esm/helpers/getURLSearchParams.spec.js +0 -19
- package/esm/helpers/nanosecondToMillisecond.spec.d.ts +0 -1
- package/esm/helpers/nanosecondToMillisecond.spec.js +0 -20
- package/esm/helpers/splitRobotTopic.spec.d.ts +0 -1
- package/esm/helpers/splitRobotTopic.spec.js +0 -51
- package/esm/helpers/standardDeviation.spec.d.ts +0 -1
- package/esm/helpers/standardDeviation.spec.js +0 -11
- package/esm/helpers/websandbox/frame/worker/manager.spec.d.ts +0 -4
- package/esm/helpers/websandbox/frame/worker/manager.spec.js +0 -127
- package/esm/models/CallsignStatus.d.ts +0 -6
- package/esm/models/CallsignStatus.js +0 -7
- package/esm/models/ExternalProject.d.ts +0 -6
- package/esm/models/ExternalProject.js +0 -2
- package/esm/models/Token.spec.d.ts +0 -1
- package/esm/models/Token.spec.js +0 -108
- package/esm/models/asset-storage/AssetModelItem.js +0 -1
- package/esm/services/AuthService.spec.d.ts +0 -1
- package/esm/services/AuthService.spec.js +0 -163
- package/esm/services/CallerService.spec.d.ts +0 -1
- package/esm/services/CallerService.spec.js +0 -227
- package/esm/services/FunctionService.d.ts +0 -68
- package/esm/services/FunctionService.js +0 -99
- package/esm/services/PlatformTimeService.spec.d.ts +0 -1
- package/esm/services/PlatformTimeService.spec.js +0 -180
- package/esm/services/RTPWebRTCService.spec.d.ts +0 -4
- package/esm/services/RTPWebRTCService.spec.js +0 -169
- package/esm/services/TelemetryService.spec.d.ts +0 -1
- package/esm/services/TelemetryService.spec.js +0 -37
- /package/cjs/models/asset-storage/{AssetModelItem.js → AssetItem.js} +0 -0
- /package/{cjs/helpers/cleanObject.spec.d.ts → esm/models/asset-storage/AssetItem.js} +0 -0
- /package/{cjs/helpers/flattenObject.spec.d.ts → esm/models/device-credentials/DeviceCredentials.js} +0 -0
- /package/{cjs/helpers/flattenOneOf.spec.d.ts → esm/models/graph/Position.js} +0 -0
- /package/{cjs/helpers/formatServiceUrl.spec.d.ts → esm/models/graph/Quaternion.js} +0 -0
- /package/{cjs/helpers/getSha256Hex.spec.d.ts → esm/models/graph/Vector3.js} +0 -0
- /package/{cjs/helpers/getSha256HexNode.spec.d.ts → esm/models/integrations/Location.js} +0 -0
- /package/{cjs/helpers/getURLSearchParams.spec.d.ts → esm/models/integrations/PaginatedResults.js} +0 -0
- /package/{cjs/helpers/nanosecondToMillisecond.spec.d.ts → esm/models/projects/ExternalProject.js} +0 -0
- /package/{cjs/helpers/splitRobotTopic.spec.d.ts → esm/models/projects/NewProjectRequest.js} +0 -0
@@ -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
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,180 +0,0 @@
|
|
1
|
-
import { PlatFormTimeService } from "./PlatformTimeService";
|
2
|
-
import { TimeSyncerService } from "./TimeSyncerService";
|
3
|
-
import { standardDeviation } from "../helpers";
|
4
|
-
// Subclass PlatformTimeService so that we can test the protected methods
|
5
|
-
class PlatformtimeServicePublic extends PlatFormTimeService {
|
6
|
-
constructor(timeSyncerService) {
|
7
|
-
super(timeSyncerService);
|
8
|
-
}
|
9
|
-
isReliableServerTime(platformTimeMeasurement) {
|
10
|
-
return super.isReliableServerTime(platformTimeMeasurement);
|
11
|
-
}
|
12
|
-
calculateOffset(platformTimeMeasurement) {
|
13
|
-
return super.calculateOffset(platformTimeMeasurement);
|
14
|
-
}
|
15
|
-
removeLongestAndShortest(platformTimeMeasurement) {
|
16
|
-
return super.removeLongestAndShortest(platformTimeMeasurement);
|
17
|
-
}
|
18
|
-
static getInstance(timeSyncerService) {
|
19
|
-
const instance = super.getInstance(timeSyncerService);
|
20
|
-
return instance;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
describe('platformTimeService', () => {
|
24
|
-
it('should calculate standard deviation correctly', () => {
|
25
|
-
let numbers = [10, 12, 23, 23, 16, 23, 21, 16];
|
26
|
-
let stdDev = standardDeviation(numbers);
|
27
|
-
expect(Math.abs(stdDev - 4.8989794855664)).toBeLessThan(0.000001);
|
28
|
-
numbers = [100, 12, 23, 23, 116, 23, 21, 162];
|
29
|
-
stdDev = standardDeviation(numbers);
|
30
|
-
expect(Math.abs(stdDev - 53.702886328394)).toBeLessThan(0.000001);
|
31
|
-
});
|
32
|
-
it('should be able to tell reliable server time response', () => {
|
33
|
-
jest.useFakeTimers();
|
34
|
-
const p = PlatformtimeServicePublic.getInstance(new TimeSyncerService({}));
|
35
|
-
const mock = {
|
36
|
-
clientTimeStampEnd: 100,
|
37
|
-
clientTimeStampStart: 20,
|
38
|
-
serverTime: {
|
39
|
-
now: 0,
|
40
|
-
duration: 0,
|
41
|
-
},
|
42
|
-
};
|
43
|
-
const mocks = [];
|
44
|
-
mocks.push(mock);
|
45
|
-
let isReliableServerTime = p.isReliableServerTime(mocks);
|
46
|
-
expect(isReliableServerTime).toBeTruthy();
|
47
|
-
for (let i = 0; i < 4; i++) {
|
48
|
-
mocks.push({ ...mock });
|
49
|
-
isReliableServerTime = p.isReliableServerTime(mocks);
|
50
|
-
expect(isReliableServerTime).toBeTruthy();
|
51
|
-
}
|
52
|
-
});
|
53
|
-
it('should be able to tell unreliable server time response', () => {
|
54
|
-
jest.useFakeTimers();
|
55
|
-
const p = PlatformtimeServicePublic.getInstance(new TimeSyncerService({}));
|
56
|
-
const mock = {
|
57
|
-
clientTimeStampEnd: 100,
|
58
|
-
clientTimeStampStart: 0,
|
59
|
-
serverTime: {
|
60
|
-
now: 0,
|
61
|
-
duration: 0,
|
62
|
-
},
|
63
|
-
};
|
64
|
-
const mocks = [];
|
65
|
-
let isReliableServerTime = false;
|
66
|
-
for (let i = 0; i < 5; i++) {
|
67
|
-
const mockClone = { ...mock };
|
68
|
-
mockClone.clientTimeStampEnd += i * 60;
|
69
|
-
mocks.push(mockClone);
|
70
|
-
}
|
71
|
-
isReliableServerTime = p.isReliableServerTime(mocks);
|
72
|
-
expect(isReliableServerTime).toBeTruthy();
|
73
|
-
for (let i = 0; i < 5; i++) {
|
74
|
-
const mockClone = { ...mock };
|
75
|
-
mockClone.clientTimeStampEnd += i * 70;
|
76
|
-
mocks.push(mockClone);
|
77
|
-
}
|
78
|
-
isReliableServerTime = p.isReliableServerTime(mocks);
|
79
|
-
expect(isReliableServerTime).toBeTruthy();
|
80
|
-
for (let i = 0; i < 5; i++) {
|
81
|
-
const mockClone = { ...mock };
|
82
|
-
mockClone.clientTimeStampEnd += i * 80;
|
83
|
-
mocks.push(mockClone);
|
84
|
-
}
|
85
|
-
isReliableServerTime = p.isReliableServerTime(mocks);
|
86
|
-
// std dev = 113.13708498985
|
87
|
-
expect(isReliableServerTime).toBeFalsy();
|
88
|
-
for (let i = 0; i < 5; i++) {
|
89
|
-
const mockClone = { ...mock };
|
90
|
-
mockClone.clientTimeStampEnd += i * 100;
|
91
|
-
mocks.push(mockClone);
|
92
|
-
}
|
93
|
-
isReliableServerTime = p.isReliableServerTime(mocks);
|
94
|
-
expect(isReliableServerTime).toBeFalsy();
|
95
|
-
});
|
96
|
-
it('should be able to remove shortest and longest correctly', () => {
|
97
|
-
jest.useFakeTimers();
|
98
|
-
const p = PlatformtimeServicePublic.getInstance(new TimeSyncerService({}));
|
99
|
-
const mock = {
|
100
|
-
clientTimeStampEnd: 100,
|
101
|
-
clientTimeStampStart: 0,
|
102
|
-
serverTime: {
|
103
|
-
now: 0,
|
104
|
-
duration: 0,
|
105
|
-
},
|
106
|
-
};
|
107
|
-
const mocks = [];
|
108
|
-
let mockClone = { ...mock };
|
109
|
-
mockClone.clientTimeStampEnd = 100;
|
110
|
-
mocks.push(mockClone);
|
111
|
-
mockClone = { ...mock };
|
112
|
-
mockClone.clientTimeStampEnd = 200;
|
113
|
-
mocks.push(mockClone);
|
114
|
-
mockClone = { ...mock };
|
115
|
-
mockClone.clientTimeStampEnd = 500;
|
116
|
-
mocks.push(mockClone);
|
117
|
-
mockClone = { ...mock };
|
118
|
-
mockClone.clientTimeStampEnd = 400;
|
119
|
-
mocks.push(mockClone);
|
120
|
-
mockClone = { ...mock };
|
121
|
-
mockClone.clientTimeStampEnd = 300;
|
122
|
-
mocks.push(mockClone);
|
123
|
-
const platformTimeMeasurement = p.removeLongestAndShortest(mocks);
|
124
|
-
platformTimeMeasurement.forEach((p) => {
|
125
|
-
expect(p.clientTimeStampEnd).not.toEqual(100);
|
126
|
-
expect(p.clientTimeStampEnd).not.toEqual(500);
|
127
|
-
});
|
128
|
-
});
|
129
|
-
it('should be able to calculate the offset correctly', () => {
|
130
|
-
jest.useFakeTimers();
|
131
|
-
const p = PlatformtimeServicePublic.getInstance(new TimeSyncerService({}));
|
132
|
-
const mock = {
|
133
|
-
clientTimeStampEnd: 100,
|
134
|
-
clientTimeStampStart: 0,
|
135
|
-
serverTime: {
|
136
|
-
now: 0,
|
137
|
-
duration: 0,
|
138
|
-
},
|
139
|
-
};
|
140
|
-
const mocks = [];
|
141
|
-
let mockClone = { ...mock };
|
142
|
-
mockClone.clientTimeStampEnd = 200;
|
143
|
-
mocks.push(mockClone);
|
144
|
-
mockClone = { ...mock };
|
145
|
-
mockClone.clientTimeStampEnd = 500;
|
146
|
-
mocks.push(mockClone);
|
147
|
-
mockClone = { ...mock };
|
148
|
-
mockClone.clientTimeStampEnd = 400;
|
149
|
-
mocks.push(mockClone);
|
150
|
-
const offset = p.calculateOffset(mocks);
|
151
|
-
// (200-(200)/2 + 500 - (500)/2 + 400 - (400)/2)/3 = 183.333333333, round to 183
|
152
|
-
expect(offset).toEqual(183);
|
153
|
-
});
|
154
|
-
it('should be able to filter where service time is not provided', () => {
|
155
|
-
jest.useFakeTimers();
|
156
|
-
const p = PlatformtimeServicePublic.getInstance(new TimeSyncerService({}));
|
157
|
-
const mock = {
|
158
|
-
clientTimeStampEnd: 100,
|
159
|
-
clientTimeStampStart: 0,
|
160
|
-
serverTime: {
|
161
|
-
now: 0,
|
162
|
-
duration: 0,
|
163
|
-
},
|
164
|
-
};
|
165
|
-
const mocks = [];
|
166
|
-
let mockClone = { ...mock };
|
167
|
-
mockClone.clientTimeStampEnd = 200;
|
168
|
-
mockClone.serverTime = undefined;
|
169
|
-
mocks.push(mockClone);
|
170
|
-
mockClone = { ...mock };
|
171
|
-
mockClone.clientTimeStampEnd = 500;
|
172
|
-
mocks.push(mockClone);
|
173
|
-
mockClone = { ...mock };
|
174
|
-
mockClone.clientTimeStampEnd = 400;
|
175
|
-
mocks.push(mockClone);
|
176
|
-
const offset = p.calculateOffset(mocks);
|
177
|
-
// (500 - (500)/2 + 400 - (400)/2)/2 = 225
|
178
|
-
expect(offset).toEqual(225);
|
179
|
-
});
|
180
|
-
});
|
@@ -1,169 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @jest-environment jsdom
|
3
|
-
*/
|
4
|
-
import { lastValueFrom, takeUntil, toArray } from 'rxjs';
|
5
|
-
import { RTPWebRTCService } from './RTPWebRTCService';
|
6
|
-
class WebRTCMockHelper {
|
7
|
-
constructor() {
|
8
|
-
this.dataChannel = {
|
9
|
-
label: 'submanager',
|
10
|
-
onopen: () => void 0,
|
11
|
-
onclose: () => void 0,
|
12
|
-
onmessage: (e) => void 0,
|
13
|
-
send: this.sendMessage.bind(this),
|
14
|
-
close: this.close.bind(this),
|
15
|
-
};
|
16
|
-
this.connection = {
|
17
|
-
ontrack: (event) => void 0,
|
18
|
-
oniceconnectionstatechange: () => void 0,
|
19
|
-
onicecandidate: async (event) => void 0,
|
20
|
-
setRemoteDescription: jest.fn(),
|
21
|
-
iceConnectionState: 'new',
|
22
|
-
localDescription: null,
|
23
|
-
createDataChannel: jest.fn().mockReturnValue(this.dataChannel),
|
24
|
-
addTransceiver: jest.fn(),
|
25
|
-
createOffer: this.createOffer.bind(this),
|
26
|
-
setLocalDescription: jest.fn(),
|
27
|
-
close: this.close.bind(this),
|
28
|
-
};
|
29
|
-
this.streams = [];
|
30
|
-
}
|
31
|
-
installMocks() {
|
32
|
-
;
|
33
|
-
global.RTCPeerConnection = jest.fn().mockReturnValue(this.connection);
|
34
|
-
global.RTCSessionDescription = jest.fn();
|
35
|
-
this.mockFetch();
|
36
|
-
}
|
37
|
-
async createOffer() {
|
38
|
-
await this.connection.onicecandidate({
|
39
|
-
candidate: null,
|
40
|
-
});
|
41
|
-
this.connection.iceConnectionState = 'checking';
|
42
|
-
this.connection.oniceconnectionstatechange();
|
43
|
-
this.addTrack('my-stream-1');
|
44
|
-
this.addTrack('my-stream-2');
|
45
|
-
this.connection.iceConnectionState = 'connected';
|
46
|
-
this.connection.oniceconnectionstatechange();
|
47
|
-
this.dataChannel.onopen();
|
48
|
-
return {
|
49
|
-
sdp: 'my-sdp',
|
50
|
-
type: 'offer',
|
51
|
-
};
|
52
|
-
}
|
53
|
-
addTrack(name) {
|
54
|
-
const stream = { name, active: true };
|
55
|
-
this.streams.push(stream);
|
56
|
-
this.connection.ontrack({
|
57
|
-
streams: [stream],
|
58
|
-
});
|
59
|
-
}
|
60
|
-
close() {
|
61
|
-
this.streams.forEach((stream) => {
|
62
|
-
stream.active = false;
|
63
|
-
});
|
64
|
-
this.dataChannel.onclose();
|
65
|
-
this.connection.iceConnectionState = 'closed';
|
66
|
-
this.connection.oniceconnectionstatechange();
|
67
|
-
}
|
68
|
-
sendMessage(message) {
|
69
|
-
const { logLevel } = JSON.parse(message);
|
70
|
-
if (logLevel === 'trace') {
|
71
|
-
this.dataChannel.onmessage({
|
72
|
-
data: message,
|
73
|
-
});
|
74
|
-
}
|
75
|
-
}
|
76
|
-
mockFetch() {
|
77
|
-
global.fetch = jest.fn().mockImplementation((url) => {
|
78
|
-
switch (url) {
|
79
|
-
case 'https://localhost:0/sdp/configs':
|
80
|
-
return Promise.resolve({
|
81
|
-
json: () => ({
|
82
|
-
iceServers: [
|
83
|
-
{
|
84
|
-
urls: ['stun:turn.localhost:443'],
|
85
|
-
},
|
86
|
-
],
|
87
|
-
}),
|
88
|
-
});
|
89
|
-
case 'https://localhost:0/sdp':
|
90
|
-
return Promise.resolve({
|
91
|
-
json: () => ({
|
92
|
-
answer: btoa('null'),
|
93
|
-
}),
|
94
|
-
});
|
95
|
-
default:
|
96
|
-
throw new Error(`Unexpected URL: ${url}`);
|
97
|
-
}
|
98
|
-
});
|
99
|
-
}
|
100
|
-
}
|
101
|
-
describe('RTPWebRTCService', () => {
|
102
|
-
let service;
|
103
|
-
beforeEach(() => {
|
104
|
-
service = new RTPWebRTCService({
|
105
|
-
url: 'localhost',
|
106
|
-
port: 0,
|
107
|
-
token: 'test',
|
108
|
-
});
|
109
|
-
});
|
110
|
-
describe('streams$', () => {
|
111
|
-
it('should emit a stream when a new stream is added', async () => {
|
112
|
-
// Arrange
|
113
|
-
new WebRTCMockHelper().installMocks();
|
114
|
-
const connection = service.createPeerConnection({
|
115
|
-
projectId: 'my-project',
|
116
|
-
callsign: 'my-callsign',
|
117
|
-
logLevel: 'trace',
|
118
|
-
});
|
119
|
-
// Act
|
120
|
-
const streams = await lastValueFrom(connection.streams$.pipe(takeUntil(connection.connect()), toArray()));
|
121
|
-
// Assert
|
122
|
-
expect(streams).toEqual([
|
123
|
-
[
|
124
|
-
{
|
125
|
-
name: 'my-stream-1',
|
126
|
-
active: true,
|
127
|
-
},
|
128
|
-
],
|
129
|
-
[
|
130
|
-
{
|
131
|
-
name: 'my-stream-1',
|
132
|
-
active: true,
|
133
|
-
},
|
134
|
-
{
|
135
|
-
name: 'my-stream-2',
|
136
|
-
active: true,
|
137
|
-
},
|
138
|
-
],
|
139
|
-
]);
|
140
|
-
});
|
141
|
-
it('should reset the streams when the connection is disconnected and the streams become inactive', async () => {
|
142
|
-
// Arrange
|
143
|
-
new WebRTCMockHelper().installMocks();
|
144
|
-
const connection = service.createPeerConnection({
|
145
|
-
projectId: 'my-project',
|
146
|
-
callsign: 'my-callsign',
|
147
|
-
logLevel: 'trace',
|
148
|
-
});
|
149
|
-
// Act
|
150
|
-
const streams = await lastValueFrom(connection.streams$.pipe(takeUntil((async () => {
|
151
|
-
await connection.connect();
|
152
|
-
connection.disconnect();
|
153
|
-
await connection.connect();
|
154
|
-
})()), toArray()));
|
155
|
-
expect(streams).toEqual([
|
156
|
-
[{ name: 'my-stream-1', active: false }],
|
157
|
-
[
|
158
|
-
{ name: 'my-stream-1', active: false },
|
159
|
-
{ name: 'my-stream-2', active: false },
|
160
|
-
],
|
161
|
-
[{ name: 'my-stream-1', active: true }],
|
162
|
-
[
|
163
|
-
{ name: 'my-stream-1', active: true },
|
164
|
-
{ name: 'my-stream-2', active: true },
|
165
|
-
],
|
166
|
-
]);
|
167
|
-
});
|
168
|
-
});
|
169
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { CallsignStatus } from '../models';
|
2
|
-
import { NEVER, delay, from, lastValueFrom, take, throwError } from 'rxjs';
|
3
|
-
import { TelemetryService } from './TelemetryService';
|
4
|
-
describe('TelemetryService', () => {
|
5
|
-
describe('getRobotStatusChanges', () => {
|
6
|
-
it('should emit unknown to begin with', async () => {
|
7
|
-
const service = new TelemetryService({ url: '', token: '' });
|
8
|
-
// Mock 5 heartbeat messages
|
9
|
-
jest.spyOn(service, 'subscribe').mockReturnValue(NEVER);
|
10
|
-
const lastValue = await lastValueFrom(service.getRobotStatusChanges('project', 'callsign').pipe(take(1)));
|
11
|
-
expect(lastValue).toEqual(CallsignStatus.UNKNOWN);
|
12
|
-
});
|
13
|
-
it('should emit online if the robot emits a heartbeat', async () => {
|
14
|
-
const service = new TelemetryService({ url: '', token: '' });
|
15
|
-
// Mock 5 heartbeat messages
|
16
|
-
jest
|
17
|
-
.spyOn(service, 'subscribe')
|
18
|
-
.mockReturnValue(from([0, 1, 2, 3, 4]).pipe(delay(100)));
|
19
|
-
const lastValue = await lastValueFrom(service.getRobotStatusChanges('project', 'callsign', 1000, 10).pipe(take(2)));
|
20
|
-
expect(lastValue).toEqual(CallsignStatus.ONLINE);
|
21
|
-
}, 10000);
|
22
|
-
it('should emit offline if the robot never emits', async () => {
|
23
|
-
const service = new TelemetryService({ url: '', token: '' });
|
24
|
-
// Mock 5 heartbeat messages
|
25
|
-
jest.spyOn(service, 'subscribe').mockReturnValue(NEVER);
|
26
|
-
const lastValue = await lastValueFrom(service.getRobotStatusChanges('project', 'callsign', 100, 10).pipe(take(2)));
|
27
|
-
expect(lastValue).toEqual(CallsignStatus.OFFLINE);
|
28
|
-
});
|
29
|
-
it('should emit an error if the telemetry errors', async () => {
|
30
|
-
const service = new TelemetryService({ url: '', token: '' });
|
31
|
-
// Mock 5 heartbeat messages
|
32
|
-
jest.spyOn(service, 'subscribe').mockReturnValue(throwError(() => new Error('test')));
|
33
|
-
const lastValue = await lastValueFrom(service.getRobotStatusChanges('project', 'callsign', 100, 10).pipe(take(2)));
|
34
|
-
expect(lastValue).toEqual(CallsignStatus.ERROR);
|
35
|
-
});
|
36
|
-
});
|
37
|
-
});
|
File without changes
|
File without changes
|
/package/{cjs/helpers/flattenObject.spec.d.ts → esm/models/device-credentials/DeviceCredentials.js}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/{cjs/helpers/getURLSearchParams.spec.d.ts → esm/models/integrations/PaginatedResults.js}
RENAMED
File without changes
|
/package/{cjs/helpers/nanosecondToMillisecond.spec.d.ts → esm/models/projects/ExternalProject.js}
RENAMED
File without changes
|
File without changes
|