@dronedeploy/rocos-js-sdk 3.0.1-alpha.9 → 3.0.1
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 +28 -0
- package/cjs/services/EnvironmentService.js +48 -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 +16 -0
- package/cjs/services/TargetService.js +58 -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 +28 -0
- package/esm/services/EnvironmentService.js +44 -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 +16 -0
- package/esm/services/TargetService.js +54 -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,171 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* @jest-environment jsdom
|
4
|
-
*/
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const rxjs_1 = require("rxjs");
|
7
|
-
const RTPWebRTCService_1 = require("./RTPWebRTCService");
|
8
|
-
class WebRTCMockHelper {
|
9
|
-
constructor() {
|
10
|
-
this.dataChannel = {
|
11
|
-
label: 'submanager',
|
12
|
-
onopen: () => void 0,
|
13
|
-
onclose: () => void 0,
|
14
|
-
onmessage: (e) => void 0,
|
15
|
-
send: this.sendMessage.bind(this),
|
16
|
-
close: this.close.bind(this),
|
17
|
-
};
|
18
|
-
this.connection = {
|
19
|
-
ontrack: (event) => void 0,
|
20
|
-
oniceconnectionstatechange: () => void 0,
|
21
|
-
onicecandidate: async (event) => void 0,
|
22
|
-
setRemoteDescription: jest.fn(),
|
23
|
-
iceConnectionState: 'new',
|
24
|
-
localDescription: null,
|
25
|
-
createDataChannel: jest.fn().mockReturnValue(this.dataChannel),
|
26
|
-
addTransceiver: jest.fn(),
|
27
|
-
createOffer: this.createOffer.bind(this),
|
28
|
-
setLocalDescription: jest.fn(),
|
29
|
-
close: this.close.bind(this),
|
30
|
-
};
|
31
|
-
this.streams = [];
|
32
|
-
}
|
33
|
-
installMocks() {
|
34
|
-
;
|
35
|
-
global.RTCPeerConnection = jest.fn().mockReturnValue(this.connection);
|
36
|
-
global.RTCSessionDescription = jest.fn();
|
37
|
-
this.mockFetch();
|
38
|
-
}
|
39
|
-
async createOffer() {
|
40
|
-
await this.connection.onicecandidate({
|
41
|
-
candidate: null,
|
42
|
-
});
|
43
|
-
this.connection.iceConnectionState = 'checking';
|
44
|
-
this.connection.oniceconnectionstatechange();
|
45
|
-
this.addTrack('my-stream-1');
|
46
|
-
this.addTrack('my-stream-2');
|
47
|
-
this.connection.iceConnectionState = 'connected';
|
48
|
-
this.connection.oniceconnectionstatechange();
|
49
|
-
this.dataChannel.onopen();
|
50
|
-
return {
|
51
|
-
sdp: 'my-sdp',
|
52
|
-
type: 'offer',
|
53
|
-
};
|
54
|
-
}
|
55
|
-
addTrack(name) {
|
56
|
-
const stream = { name, active: true };
|
57
|
-
this.streams.push(stream);
|
58
|
-
this.connection.ontrack({
|
59
|
-
streams: [stream],
|
60
|
-
});
|
61
|
-
}
|
62
|
-
close() {
|
63
|
-
this.streams.forEach((stream) => {
|
64
|
-
stream.active = false;
|
65
|
-
});
|
66
|
-
this.dataChannel.onclose();
|
67
|
-
this.connection.iceConnectionState = 'closed';
|
68
|
-
this.connection.oniceconnectionstatechange();
|
69
|
-
}
|
70
|
-
sendMessage(message) {
|
71
|
-
const { logLevel } = JSON.parse(message);
|
72
|
-
if (logLevel === 'trace') {
|
73
|
-
this.dataChannel.onmessage({
|
74
|
-
data: message,
|
75
|
-
});
|
76
|
-
}
|
77
|
-
}
|
78
|
-
mockFetch() {
|
79
|
-
global.fetch = jest.fn().mockImplementation((url) => {
|
80
|
-
switch (url) {
|
81
|
-
case 'https://localhost:0/sdp/configs':
|
82
|
-
return Promise.resolve({
|
83
|
-
json: () => ({
|
84
|
-
iceServers: [
|
85
|
-
{
|
86
|
-
urls: ['stun:turn.localhost:443'],
|
87
|
-
},
|
88
|
-
],
|
89
|
-
}),
|
90
|
-
});
|
91
|
-
case 'https://localhost:0/sdp':
|
92
|
-
return Promise.resolve({
|
93
|
-
json: () => ({
|
94
|
-
answer: btoa('null'),
|
95
|
-
}),
|
96
|
-
});
|
97
|
-
default:
|
98
|
-
throw new Error(`Unexpected URL: ${url}`);
|
99
|
-
}
|
100
|
-
});
|
101
|
-
}
|
102
|
-
}
|
103
|
-
describe('RTPWebRTCService', () => {
|
104
|
-
let service;
|
105
|
-
beforeEach(() => {
|
106
|
-
service = new RTPWebRTCService_1.RTPWebRTCService({
|
107
|
-
url: 'localhost',
|
108
|
-
port: 0,
|
109
|
-
token: 'test',
|
110
|
-
});
|
111
|
-
});
|
112
|
-
describe('streams$', () => {
|
113
|
-
it('should emit a stream when a new stream is added', async () => {
|
114
|
-
// Arrange
|
115
|
-
new WebRTCMockHelper().installMocks();
|
116
|
-
const connection = service.createPeerConnection({
|
117
|
-
projectId: 'my-project',
|
118
|
-
callsign: 'my-callsign',
|
119
|
-
logLevel: 'trace',
|
120
|
-
});
|
121
|
-
// Act
|
122
|
-
const streams = await (0, rxjs_1.lastValueFrom)(connection.streams$.pipe((0, rxjs_1.takeUntil)(connection.connect()), (0, rxjs_1.toArray)()));
|
123
|
-
// Assert
|
124
|
-
expect(streams).toEqual([
|
125
|
-
[
|
126
|
-
{
|
127
|
-
name: 'my-stream-1',
|
128
|
-
active: true,
|
129
|
-
},
|
130
|
-
],
|
131
|
-
[
|
132
|
-
{
|
133
|
-
name: 'my-stream-1',
|
134
|
-
active: true,
|
135
|
-
},
|
136
|
-
{
|
137
|
-
name: 'my-stream-2',
|
138
|
-
active: true,
|
139
|
-
},
|
140
|
-
],
|
141
|
-
]);
|
142
|
-
});
|
143
|
-
it('should reset the streams when the connection is disconnected and the streams become inactive', async () => {
|
144
|
-
// Arrange
|
145
|
-
new WebRTCMockHelper().installMocks();
|
146
|
-
const connection = service.createPeerConnection({
|
147
|
-
projectId: 'my-project',
|
148
|
-
callsign: 'my-callsign',
|
149
|
-
logLevel: 'trace',
|
150
|
-
});
|
151
|
-
// Act
|
152
|
-
const streams = await (0, rxjs_1.lastValueFrom)(connection.streams$.pipe((0, rxjs_1.takeUntil)((async () => {
|
153
|
-
await connection.connect();
|
154
|
-
connection.disconnect();
|
155
|
-
await connection.connect();
|
156
|
-
})()), (0, rxjs_1.toArray)()));
|
157
|
-
expect(streams).toEqual([
|
158
|
-
[{ name: 'my-stream-1', active: false }],
|
159
|
-
[
|
160
|
-
{ name: 'my-stream-1', active: false },
|
161
|
-
{ name: 'my-stream-2', active: false },
|
162
|
-
],
|
163
|
-
[{ name: 'my-stream-1', active: true }],
|
164
|
-
[
|
165
|
-
{ name: 'my-stream-1', active: true },
|
166
|
-
{ name: 'my-stream-2', active: true },
|
167
|
-
],
|
168
|
-
]);
|
169
|
-
});
|
170
|
-
});
|
171
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const models_1 = require("../models");
|
4
|
-
const rxjs_1 = require("rxjs");
|
5
|
-
const TelemetryService_1 = require("./TelemetryService");
|
6
|
-
describe('TelemetryService', () => {
|
7
|
-
describe('getRobotStatusChanges', () => {
|
8
|
-
it('should emit unknown to begin with', async () => {
|
9
|
-
const service = new TelemetryService_1.TelemetryService({ url: '', token: '' });
|
10
|
-
// Mock 5 heartbeat messages
|
11
|
-
jest.spyOn(service, 'subscribe').mockReturnValue(rxjs_1.NEVER);
|
12
|
-
const lastValue = await (0, rxjs_1.lastValueFrom)(service.getRobotStatusChanges('project', 'callsign').pipe((0, rxjs_1.take)(1)));
|
13
|
-
expect(lastValue).toEqual(models_1.CallsignStatus.UNKNOWN);
|
14
|
-
});
|
15
|
-
it('should emit online if the robot emits a heartbeat', async () => {
|
16
|
-
const service = new TelemetryService_1.TelemetryService({ url: '', token: '' });
|
17
|
-
// Mock 5 heartbeat messages
|
18
|
-
jest
|
19
|
-
.spyOn(service, 'subscribe')
|
20
|
-
.mockReturnValue((0, rxjs_1.from)([0, 1, 2, 3, 4]).pipe((0, rxjs_1.delay)(100)));
|
21
|
-
const lastValue = await (0, rxjs_1.lastValueFrom)(service.getRobotStatusChanges('project', 'callsign', 1000, 10).pipe((0, rxjs_1.take)(2)));
|
22
|
-
expect(lastValue).toEqual(models_1.CallsignStatus.ONLINE);
|
23
|
-
}, 10000);
|
24
|
-
it('should emit offline if the robot never emits', async () => {
|
25
|
-
const service = new TelemetryService_1.TelemetryService({ url: '', token: '' });
|
26
|
-
// Mock 5 heartbeat messages
|
27
|
-
jest.spyOn(service, 'subscribe').mockReturnValue(rxjs_1.NEVER);
|
28
|
-
const lastValue = await (0, rxjs_1.lastValueFrom)(service.getRobotStatusChanges('project', 'callsign', 100, 10).pipe((0, rxjs_1.take)(2)));
|
29
|
-
expect(lastValue).toEqual(models_1.CallsignStatus.OFFLINE);
|
30
|
-
});
|
31
|
-
it('should emit an error if the telemetry errors', async () => {
|
32
|
-
const service = new TelemetryService_1.TelemetryService({ url: '', token: '' });
|
33
|
-
// Mock 5 heartbeat messages
|
34
|
-
jest.spyOn(service, 'subscribe').mockReturnValue((0, rxjs_1.throwError)(() => new Error('test')));
|
35
|
-
const lastValue = await (0, rxjs_1.lastValueFrom)(service.getRobotStatusChanges('project', 'callsign', 100, 10).pipe((0, rxjs_1.take)(2)));
|
36
|
-
expect(lastValue).toEqual(models_1.CallsignStatus.ERROR);
|
37
|
-
});
|
38
|
-
});
|
39
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import { cleanObject } from "./cleanObject";
|
2
|
-
describe('cleanObject', () => {
|
3
|
-
const testObject = {
|
4
|
-
test1: 'test1',
|
5
|
-
test2: 'test2',
|
6
|
-
test3: () => 'test3',
|
7
|
-
test4: {
|
8
|
-
test1: 'test1.1',
|
9
|
-
test5: 'test5',
|
10
|
-
test6: {
|
11
|
-
test7: 'test7',
|
12
|
-
test1: 'test1.2',
|
13
|
-
test2: 'test2.1',
|
14
|
-
test8: () => 'test8',
|
15
|
-
},
|
16
|
-
test8: () => 'test8',
|
17
|
-
},
|
18
|
-
test9: ['test9.1', 'test9.2', () => 'test8'],
|
19
|
-
test10: [
|
20
|
-
{
|
21
|
-
test7: 'test7',
|
22
|
-
test1: 'test1.2',
|
23
|
-
test2: 'test2.1',
|
24
|
-
test8: () => 'test8',
|
25
|
-
},
|
26
|
-
{
|
27
|
-
test8: () => 'test8',
|
28
|
-
},
|
29
|
-
],
|
30
|
-
};
|
31
|
-
it('should clean object to values only', () => {
|
32
|
-
const newObject = cleanObject(testObject);
|
33
|
-
expect(newObject?.test3).toBeUndefined();
|
34
|
-
expect(newObject?.test4?.test8).toBeUndefined();
|
35
|
-
expect(newObject?.test4?.test6?.test8).toBeUndefined();
|
36
|
-
expect(newObject?.test4?.test5).toEqual('test5');
|
37
|
-
expect(newObject?.test5).toBeUndefined();
|
38
|
-
expect(newObject?.test4?.test6?.test1).toEqual('test1.2');
|
39
|
-
expect(newObject?.test4?.test6?.test2).toEqual('test2.1');
|
40
|
-
expect(newObject?.test1).toEqual('test1');
|
41
|
-
expect(newObject?.test2).toEqual('test2');
|
42
|
-
expect(newObject?.test9).toEqual(expect.arrayContaining(['test9.1', 'test9.2']));
|
43
|
-
expect(newObject?.test9).toEqual(expect.not.arrayContaining([() => 'test8']));
|
44
|
-
expect(newObject?.test10).toEqual(expect.arrayContaining([
|
45
|
-
{
|
46
|
-
test7: 'test7',
|
47
|
-
test1: 'test1.2',
|
48
|
-
test2: 'test2.1',
|
49
|
-
},
|
50
|
-
{},
|
51
|
-
]));
|
52
|
-
});
|
53
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { flattenObject } from './flattenObject';
|
2
|
-
describe('flattenObject', () => {
|
3
|
-
const testObject = {
|
4
|
-
test1: 'test1',
|
5
|
-
test2: 'test2',
|
6
|
-
test3: () => 'test3',
|
7
|
-
test4: {
|
8
|
-
test1: 'test1.1',
|
9
|
-
test5: 'test5',
|
10
|
-
test6: {
|
11
|
-
test7: 'test7',
|
12
|
-
test1: 'test1.2',
|
13
|
-
test2: 'test2.1',
|
14
|
-
test8: () => 'test8',
|
15
|
-
},
|
16
|
-
test8: () => 'test8',
|
17
|
-
},
|
18
|
-
};
|
19
|
-
it('should flatten object to a single level', () => {
|
20
|
-
const newObject = flattenObject(testObject);
|
21
|
-
expect(newObject?.test3).toBeUndefined();
|
22
|
-
expect(newObject?.test4?.test8).toBeUndefined();
|
23
|
-
expect(newObject?.test4?.test6?.test8).toBeUndefined();
|
24
|
-
expect(newObject?.test4?.test5).toBeUndefined();
|
25
|
-
expect(newObject?.test5).toEqual('test5');
|
26
|
-
expect(newObject?.test1).toEqual('test1.2');
|
27
|
-
expect(newObject?.test2).toEqual('test2.1');
|
28
|
-
});
|
29
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,157 +0,0 @@
|
|
1
|
-
import { flattenOneOf, hasOneOfField } from './flattenOneOf';
|
2
|
-
describe('flattenOneOf', () => {
|
3
|
-
describe('hasOneOfField', () => {
|
4
|
-
it('should return false for non-object', () => {
|
5
|
-
expect(hasOneOfField(null)).toBe(false);
|
6
|
-
expect(hasOneOfField(undefined)).toBe(false);
|
7
|
-
expect(hasOneOfField(1)).toBe(false);
|
8
|
-
expect(hasOneOfField('')).toBe(false);
|
9
|
-
expect(hasOneOfField(true)).toBe(false);
|
10
|
-
});
|
11
|
-
it('should return false for null content', () => {
|
12
|
-
expect(hasOneOfField({ content: null })).toBe(false);
|
13
|
-
});
|
14
|
-
it('should return false for non-object content', () => {
|
15
|
-
expect(hasOneOfField({ content: 1 })).toBe(false);
|
16
|
-
expect(hasOneOfField({ content: '' })).toBe(false);
|
17
|
-
expect(hasOneOfField({ content: true })).toBe(false);
|
18
|
-
});
|
19
|
-
it('should return false for non-string oneofKind', () => {
|
20
|
-
expect(hasOneOfField({ content: { oneofKind: 1 } })).toBe(false);
|
21
|
-
expect(hasOneOfField({ content: { oneofKind: null } })).toBe(false);
|
22
|
-
expect(hasOneOfField({ content: { oneofKind: true } })).toBe(false);
|
23
|
-
expect(hasOneOfField({ content: { oneofKind: {} } })).toBe(false);
|
24
|
-
});
|
25
|
-
it('should return true for valid oneOfField', () => {
|
26
|
-
expect(hasOneOfField({ content: { oneofKind: 'test' } })).toBe(true);
|
27
|
-
});
|
28
|
-
});
|
29
|
-
describe('flattenOneOf', () => {
|
30
|
-
it('should flatten a simple oneof type', () => {
|
31
|
-
const a = {
|
32
|
-
a: 'a',
|
33
|
-
content: {
|
34
|
-
oneofKind: 'b',
|
35
|
-
b: true,
|
36
|
-
},
|
37
|
-
};
|
38
|
-
expect(flattenOneOf(a)).toEqual({
|
39
|
-
a: 'a',
|
40
|
-
b: true,
|
41
|
-
});
|
42
|
-
});
|
43
|
-
it('should flatten a nested oneof type, one level only', () => {
|
44
|
-
const a = {
|
45
|
-
b: {
|
46
|
-
content: {
|
47
|
-
oneofKind: 'c',
|
48
|
-
c: true,
|
49
|
-
},
|
50
|
-
},
|
51
|
-
content: {
|
52
|
-
oneofKind: 'd',
|
53
|
-
d: {
|
54
|
-
content: {
|
55
|
-
oneofKind: 'e',
|
56
|
-
e: 5,
|
57
|
-
},
|
58
|
-
},
|
59
|
-
},
|
60
|
-
};
|
61
|
-
expect(flattenOneOf(a)).toEqual({
|
62
|
-
b: {
|
63
|
-
content: {
|
64
|
-
oneofKind: 'c',
|
65
|
-
c: true,
|
66
|
-
},
|
67
|
-
},
|
68
|
-
d: {
|
69
|
-
content: {
|
70
|
-
oneofKind: 'e',
|
71
|
-
e: 5,
|
72
|
-
},
|
73
|
-
},
|
74
|
-
});
|
75
|
-
});
|
76
|
-
it('should flatten to undefined if the referenced property does not exist', () => {
|
77
|
-
const a = {
|
78
|
-
content: {
|
79
|
-
oneofKind: 'b',
|
80
|
-
c: true,
|
81
|
-
},
|
82
|
-
};
|
83
|
-
expect(flattenOneOf(a)).toEqual({
|
84
|
-
b: undefined,
|
85
|
-
});
|
86
|
-
});
|
87
|
-
it('should return the original object if it does not have a oneof field', () => {
|
88
|
-
const a = {
|
89
|
-
a: 'a',
|
90
|
-
b: 'b',
|
91
|
-
};
|
92
|
-
expect(flattenOneOf(a)).toEqual(a);
|
93
|
-
});
|
94
|
-
});
|
95
|
-
describe('flattenOneOf - deep', () => {
|
96
|
-
it('should flatten a simple oneof type', () => {
|
97
|
-
const a = {
|
98
|
-
a: 'a',
|
99
|
-
content: {
|
100
|
-
oneofKind: 'b',
|
101
|
-
b: {
|
102
|
-
d: 4,
|
103
|
-
},
|
104
|
-
},
|
105
|
-
};
|
106
|
-
expect(flattenOneOf(a, true)).toEqual({
|
107
|
-
a: 'a',
|
108
|
-
b: { d: 4 },
|
109
|
-
});
|
110
|
-
});
|
111
|
-
it('should flatten a nested oneof type, all levels', () => {
|
112
|
-
const a = {
|
113
|
-
b: {
|
114
|
-
content: {
|
115
|
-
oneofKind: 'c',
|
116
|
-
c: true,
|
117
|
-
},
|
118
|
-
},
|
119
|
-
content: {
|
120
|
-
oneofKind: 'd',
|
121
|
-
d: {
|
122
|
-
content: {
|
123
|
-
oneofKind: 'e',
|
124
|
-
e: 5,
|
125
|
-
},
|
126
|
-
},
|
127
|
-
},
|
128
|
-
};
|
129
|
-
expect(flattenOneOf(a, true)).toEqual({
|
130
|
-
b: {
|
131
|
-
c: true,
|
132
|
-
},
|
133
|
-
d: {
|
134
|
-
e: 5,
|
135
|
-
},
|
136
|
-
});
|
137
|
-
});
|
138
|
-
it('should flatten to undefined if the referenced property does not exist', () => {
|
139
|
-
const a = {
|
140
|
-
content: {
|
141
|
-
oneofKind: 'b',
|
142
|
-
c: true,
|
143
|
-
},
|
144
|
-
};
|
145
|
-
expect(flattenOneOf(a, true)).toEqual({
|
146
|
-
b: undefined,
|
147
|
-
});
|
148
|
-
});
|
149
|
-
it('should return the original object if it does not have a oneof field', () => {
|
150
|
-
const a = {
|
151
|
-
a: 'a',
|
152
|
-
b: 'b',
|
153
|
-
};
|
154
|
-
expect(flattenOneOf(a, true)).toEqual(a);
|
155
|
-
});
|
156
|
-
});
|
157
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { formatServiceUrl } from './formatServiceUrl';
|
2
|
-
describe('formatServiceUrl', () => {
|
3
|
-
const url = 'https://{url}/admin/users/{test}/invitations';
|
4
|
-
it('should format url', () => {
|
5
|
-
let newUrl = formatServiceUrl(url, { url: 'test.com', test: 'me' });
|
6
|
-
expect(newUrl).toEqual('https://test.com/admin/users/me/invitations');
|
7
|
-
newUrl = formatServiceUrl(url, { url: 'test2.com', test: 'me2' });
|
8
|
-
expect(newUrl).toEqual('https://test2.com/admin/users/me2/invitations');
|
9
|
-
});
|
10
|
-
it('should format insecure url', () => {
|
11
|
-
let newUrl = formatServiceUrl(url, { url: 'test.com', test: 'me' }, true);
|
12
|
-
expect(newUrl).toEqual('http://test.com/admin/users/me/invitations');
|
13
|
-
newUrl = formatServiceUrl(url, { url: 'test2.com', test: 'me2' }, true);
|
14
|
-
expect(newUrl).toEqual('http://test2.com/admin/users/me2/invitations');
|
15
|
-
});
|
16
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import crypto from 'crypto';
|
2
|
-
import { getSha256Hex } from './getSha256Hex';
|
3
|
-
Object.defineProperty(globalThis, 'crypto', {
|
4
|
-
value: {
|
5
|
-
subtle: crypto.webcrypto.subtle,
|
6
|
-
},
|
7
|
-
});
|
8
|
-
describe('getSha256Hex', () => {
|
9
|
-
it('should return the correct SHA-256 hash', async () => {
|
10
|
-
const buffer = new TextEncoder().encode('Hello, World!');
|
11
|
-
const hash = await getSha256Hex(buffer);
|
12
|
-
expect(hash).toBe('dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f');
|
13
|
-
});
|
14
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { getSha256HexNode } from './getSha256HexNode';
|
2
|
-
describe('getSha256HexNode', () => {
|
3
|
-
it('should return the correct SHA-256 hash', async () => {
|
4
|
-
const buffer = new TextEncoder().encode('Hello, World!');
|
5
|
-
const hash = await getSha256HexNode(buffer);
|
6
|
-
expect(hash).toBe('dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f');
|
7
|
-
});
|
8
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { getURLSearchParams } from './getURLSearchParams';
|
2
|
-
describe('getURLSearchParams', () => {
|
3
|
-
it('Should return the original param if URLSearchParams', () => {
|
4
|
-
const param = new URLSearchParams();
|
5
|
-
const searchParam = getURLSearchParams(param);
|
6
|
-
expect(searchParam).toBe(param);
|
7
|
-
});
|
8
|
-
it('Should a new URLSearchParams ', () => {
|
9
|
-
const param = {
|
10
|
-
foo: 'bar',
|
11
|
-
bar: true,
|
12
|
-
foobar: 123,
|
13
|
-
};
|
14
|
-
const searchParam = getURLSearchParams(param);
|
15
|
-
expect(searchParam.get('foo')).toBe('bar');
|
16
|
-
expect(searchParam.get('bar')).toBe('true');
|
17
|
-
expect(searchParam.get('foobar')).toBe('123');
|
18
|
-
});
|
19
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { nanosecondToMillisecond } from './nanosecondToMillisecond';
|
2
|
-
describe('nanosecondToMillisecond', () => {
|
3
|
-
it.each `
|
4
|
-
input | expected
|
5
|
-
${'0.0001'} | ${0.0000000001}
|
6
|
-
${'1'} | ${0.000001}
|
7
|
-
${'1000000'} | ${1}
|
8
|
-
${'10000000'} | ${10}
|
9
|
-
${'-100000006'} | ${-100.000006}
|
10
|
-
${'1000000000000000000'} | ${1000000000000}
|
11
|
-
${'1234567891011100001'} | ${1234567891011.100001}
|
12
|
-
${'1234567891011100000'} | ${1234567891011.1}
|
13
|
-
${0.0001} | ${0.0000000001}
|
14
|
-
${1} | ${0.000001}
|
15
|
-
${1000000} | ${1}
|
16
|
-
${1000000000000001} | ${1000000000.000001}
|
17
|
-
`('should convert $input to $expected', ({ input, expected }) => {
|
18
|
-
expect(nanosecondToMillisecond(input)).toBe(expected);
|
19
|
-
});
|
20
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,51 +0,0 @@
|
|
1
|
-
import { splitRobotTopic } from './splitRobotTopic';
|
2
|
-
describe('splitRobotTopic', () => {
|
3
|
-
it('should split a path with a single topic', () => {
|
4
|
-
expect(splitRobotTopic('/component/topic')).toEqual({
|
5
|
-
component: 'component',
|
6
|
-
topic: 'topic',
|
7
|
-
});
|
8
|
-
});
|
9
|
-
it('should split a path with multiple topics', () => {
|
10
|
-
expect(splitRobotTopic('/component/topic/with/multiple/topics')).toEqual({
|
11
|
-
component: 'component',
|
12
|
-
topic: 'topic/with/multiple/topics',
|
13
|
-
});
|
14
|
-
});
|
15
|
-
it('should split a path with no topics', () => {
|
16
|
-
expect(splitRobotTopic('/component')).toEqual({
|
17
|
-
component: 'component',
|
18
|
-
topic: '',
|
19
|
-
});
|
20
|
-
});
|
21
|
-
it('should split a path with no forward slash', () => {
|
22
|
-
expect(splitRobotTopic('component/topic')).toEqual({
|
23
|
-
component: 'component',
|
24
|
-
topic: 'topic',
|
25
|
-
});
|
26
|
-
});
|
27
|
-
it('should split a path with no forward slash and no topics', () => {
|
28
|
-
expect(splitRobotTopic('component')).toEqual({
|
29
|
-
component: 'component',
|
30
|
-
topic: '',
|
31
|
-
});
|
32
|
-
});
|
33
|
-
it('should split a path with no forward slash and multiple topics', () => {
|
34
|
-
expect(splitRobotTopic('component/topic/with/multiple/topics')).toEqual({
|
35
|
-
component: 'component',
|
36
|
-
topic: 'topic/with/multiple/topics',
|
37
|
-
});
|
38
|
-
});
|
39
|
-
it('should handle a path with multiple forward slashes', () => {
|
40
|
-
expect(splitRobotTopic('///component/topic/with/multiple/topics')).toEqual({
|
41
|
-
component: 'component',
|
42
|
-
topic: 'topic/with/multiple/topics',
|
43
|
-
});
|
44
|
-
});
|
45
|
-
it('should handle a path with multiple forward slashes and no topics', () => {
|
46
|
-
expect(splitRobotTopic('///component')).toEqual({
|
47
|
-
component: 'component',
|
48
|
-
topic: '',
|
49
|
-
});
|
50
|
-
});
|
51
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { standardDeviation } from './standardDeviation';
|
2
|
-
describe('standardDeviation', () => {
|
3
|
-
it('should calculate standard deviation correctly', () => {
|
4
|
-
let numbers = [10, 12, 23, 23, 16, 23, 21, 16];
|
5
|
-
let stdDev = standardDeviation(numbers);
|
6
|
-
expect(Math.abs(stdDev - 4.8989794855664)).toBeLessThan(0.000001);
|
7
|
-
numbers = [100, 12, 23, 23, 116, 23, 21, 162];
|
8
|
-
stdDev = standardDeviation(numbers);
|
9
|
-
expect(Math.abs(stdDev - 53.702886328394)).toBeLessThan(0.000001);
|
10
|
-
});
|
11
|
-
});
|