@dronedeploy/rocos-js-sdk 3.0.1-alpha.9 → 3.0.2
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/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
package/cjs/constants/api.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.API_LINKED_PROJECT_URL = exports.
|
|
3
|
+
exports.API_PROJECT_ROBOT_ATTRIBUTES_URL = exports.API_PROJECT_ROBOT_ID_URL = exports.API_PROJECT_ROBOT_URL = exports.API_PROJECT_MAPPED_ASSET_PATH_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_EXTERNAL_PROJECTS_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_ID_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_URL = exports.API_ACCOUNT_PROJECT_USER_ID_URL = exports.API_ACCOUNT_PROJECT_USER_URL = exports.API_ACCOUNT_PROJECT_ID_URL = exports.API_ACCOUNT_PROJECT_URL = exports.API_SERVER_TIME_URL = exports.API_ACCOUNT_INTEGRATION_TYPE_URL = exports.API_ACCOUNT_INTEGRATION_URL = exports.API_ACCOUNT_SETTINGS_URL = exports.API_AUTH_USER_ACCOUNT_USER_ID_URL = exports.API_AUTH_USER_ACCOUNT_USER_URL = exports.API_ACCOUNT_ACTIVATE_URL = exports.API_ACCOUNT_ID_URL = exports.API_ACCOUNT_URL = exports.API_USER_PAT_TOKEN_URL = exports.API_USER_PAT_URL = exports.API_USER_VERIFY_EMAIL_URL = exports.API_USER_INVITATION_CHECK_URL = exports.API_USER_INVITATION_ACCEPT_URL = exports.API_USER_INVITATION_URL = exports.API_USER_PASSWORD_FORGOT_URL = exports.API_USER_PASSWORD_RESET_URL = exports.API_OTP_AUTH_URL = exports.API_OTP_URL = exports.API_USER_TOKEN_URL = exports.API_USER_AUTH_URL = exports.API_USER_URL = exports.API_ADMIN_USER_INVITATION_URL = exports.API_APPLICATION_AUTH_URL = void 0;
|
|
4
|
+
exports.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_ENVIRONMENT_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_CONFIGS_CONNECTION_URL = exports.API_PROJECT_ROBOT_CONFIGS_CONNECTIONS_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 = exports.API_PROJECT_ROBOT_REGISTER_URL = exports.API_PROJECT_ROBOT_DEFINITION_URL = void 0;
|
|
5
|
+
exports.API_DEVICE_CREDENTIALS_URL = exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_WORKFLOW_AFFECTED_URL = exports.API_PROJECT_ROBOT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_PROFILE_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_ROBOT_NO_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_ROBOT_DEPLOYMENTS_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_GRAPHS_ASSETS_URL = exports.API_GRAPHS_ASSETS_UPLOAD_URL = exports.API_GRAPHS_TARGETS_URL = exports.API_GRAPHS_TARGET_UPLOAD_URL = exports.API_GRAPHS_OBSERVATION_KEYS_URL = exports.API_GRAPHS_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA = exports.API_GRAPHS_MAPS_GEOJSON_URL = exports.API_GRAPHS_MAPS_DEPLOY_URL = exports.API_GRAPHS_MAPS_COPY_URL = exports.API_GRAPHS_MAP_ID_URL = exports.API_GRAPHS_MAPS_MERGE_URL = exports.API_GRAPHS_MAPS_DEPLOYED_URL = exports.API_GRAPHS_MAPS_URL = exports.API_DD_INTEGRATION_LOCATIONS_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 = 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 = void 0;
|
|
6
|
+
exports.API_DEVICE_CREDENTIALS_AUTH_URL = void 0;
|
|
6
7
|
exports.API_APPLICATION_AUTH_URL = 'https://{url}/applications/auth';
|
|
7
8
|
exports.API_ADMIN_USER_INVITATION_URL = 'https://{url}/admin/users/invitations';
|
|
8
9
|
exports.API_USER_URL = 'https://{url}/users';
|
|
@@ -33,6 +34,7 @@ exports.API_ACCOUNT_PROJECT_USER_URL = 'https://{url}/accounts/{accountId}/proje
|
|
|
33
34
|
exports.API_ACCOUNT_PROJECT_USER_ID_URL = 'https://{url}/accounts/{accountId}/projects/{projectId}/users/{userId}';
|
|
34
35
|
exports.API_ACCOUNT_PROJECT_APPLICATION_URL = 'https://{url}/accounts/{accountId}/projects/{projectId}/applications';
|
|
35
36
|
exports.API_ACCOUNT_PROJECT_APPLICATION_ID_URL = 'https://{url}/accounts/{accountId}/projects/{projectId}/applications/{applicationId}';
|
|
37
|
+
exports.API_ACCOUNT_EXTERNAL_PROJECTS_URL = 'https://{url}/accounts/{accountId}/external-projects';
|
|
36
38
|
exports.API_PROJECT_URL = 'https://{url}/projects';
|
|
37
39
|
exports.API_PROJECT_ID_URL = 'https://{url}/projects/{projectId}';
|
|
38
40
|
exports.API_PROJECT_USERS_URL = 'https://{url}/projects/{projectId}/users';
|
|
@@ -48,6 +50,7 @@ exports.API_PROJECT_FLOW_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/fl
|
|
|
48
50
|
exports.API_PROJECT_MISSION_ASSETS_PATH_URL = 'https://{url}/projects/{projectId}/missionassets';
|
|
49
51
|
exports.API_PROJECT_MISSION_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/missionassets/{assetId}';
|
|
50
52
|
exports.API_PROJECT_MAPPED_ASSETS_PATH_URL = 'https://{url}/projects/{projectId}/mappedassets';
|
|
53
|
+
exports.API_PROJECT_MAPPED_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/mappedassets/{assetId}';
|
|
51
54
|
exports.API_PROJECT_ROBOT_URL = 'https://{url}/projects/{projectId}/robots';
|
|
52
55
|
exports.API_PROJECT_ROBOT_ID_URL = 'https://{url}/projects/{projectId}/robots/{callsign}';
|
|
53
56
|
exports.API_PROJECT_ROBOT_ATTRIBUTES_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/attributes';
|
|
@@ -62,6 +65,8 @@ exports.API_PROJECT_ROBOT_COMMAND2_URL = 'https://{url}/projects/{projectId}/rob
|
|
|
62
65
|
exports.API_PROJECT_ROBOT_BUTTON_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/buttons';
|
|
63
66
|
exports.API_PROJECT_ROBOT_TRIGGER_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/triggers';
|
|
64
67
|
exports.API_PROJECT_ROBOT_GAMEPAD_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/gamepads';
|
|
68
|
+
exports.API_PROJECT_ROBOT_CONFIGS_CONNECTIONS_URL = 'https://{url}/robot-configs/connections/projects/{projectId}';
|
|
69
|
+
exports.API_PROJECT_ROBOT_CONFIGS_CONNECTION_URL = 'https://{url}/robot-configs/connections/projects/{projectId}/callsigns/{callsign}';
|
|
65
70
|
exports.API_PROJECT_OPERATION_URL = 'https://{url}/projects/{projectId}/operations';
|
|
66
71
|
exports.API_PROJECT_OPERATION_ID_URL = 'https://{url}/projects/{projectId}/operations/{operationId}';
|
|
67
72
|
exports.API_PROJECT_DASHBOARD_URL = 'https://{url}/projects/{projectId}/dashboards';
|
|
@@ -87,6 +92,9 @@ exports.API_PROJECT_DEFINITION_ACTION_URL = 'https://{url}/projects/{projectId}/
|
|
|
87
92
|
exports.API_PROJECT_DEFINITION_BUTTON_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/buttons';
|
|
88
93
|
exports.API_PROJECT_DEFINITION_TRIGGER_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/triggers';
|
|
89
94
|
exports.API_PROJECT_DEFINITION_GAMEPAD_URL = 'https://{url}/projects/{projectId}/robot-definitions/{definitionId}/gamepads';
|
|
95
|
+
exports.API_PROJECT_DEFINITION_EXPORT = 'https://{url}/import-export/projects/{projectId}/robot-definitions/{definitionId}/export';
|
|
96
|
+
exports.API_PROJECT_DEFINITION_IMPORT = 'https://{url}/import-export/projects/{projectId}/robot-definitions/import';
|
|
97
|
+
exports.API_PROJECT_ENVIRONMENT_URL = 'https://{url}/graphs/projects/{projectId}/environments';
|
|
90
98
|
exports.API_PROJECT_GROUP_TYPE_URL = 'https://{url}/projects/{projectId}/config-groups/{type}';
|
|
91
99
|
exports.API_PROJECT_GROUP_TYPE_ID_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}';
|
|
92
100
|
exports.API_PROJECT_GROUP_TYPE_PUBLISH_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/publish';
|
|
@@ -94,10 +102,6 @@ exports.API_PROJECT_GROUP_TYPE_CONFIG_URL = 'https://{url}/projects/{projectId}/
|
|
|
94
102
|
exports.API_PROJECT_GROUP_TYPE_VERSION_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{version}';
|
|
95
103
|
exports.API_PROJECT_GROUP_TYPE_OWNER_ID_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/owner/{ownerId}';
|
|
96
104
|
exports.API_PROJECT_GROUP_TYPE_OWNER_OVERRIDE_URL = 'https://{url}/projects/{projectId}/config-groups/{type}/{configGroupId}/{ownerId}/override';
|
|
97
|
-
exports.API_PROJECT_FUNCTION_URL = 'https://{url}/projects/{projectId}/functions';
|
|
98
|
-
exports.API_PROJECT_FUNCTION_ID_URL = 'https://{url}/projects/{projectId}/functions/{functionId}';
|
|
99
|
-
exports.API_PROJECT_FUNCTION_RUN_URL = 'https://{url}/projects/{projectId}/functions/{functionId}/run';
|
|
100
|
-
exports.API_PROJECT_FUNCTION_POD_URL = 'https://{url}/projects/{projectId}/functions/{functionId}/pods';
|
|
101
105
|
exports.API_PROJECT_EXPORT_URL = 'https://{url}/projects/{projectId}/export-jobs';
|
|
102
106
|
exports.API_PROJECT_STREAM_URL = 'https://{url}/projects/{projectId}/streams';
|
|
103
107
|
exports.API_PROJECT_STREAM_ID_URL = 'https://{url}/projects/{projectId}/streams/{streamId}';
|
|
@@ -123,18 +127,31 @@ exports.API_DD_INTEGRATION_PLANS_URL = 'https://{url}/projects/{projectId}/dd/pl
|
|
|
123
127
|
exports.API_DD_INTEGRATION_PLAN_BY_ID_URL = 'https://{url}/projects/{projectId}/dd/plan/{planId}';
|
|
124
128
|
exports.API_DD_INTEGRATION_OVERLAYS_URL = 'https://{url}/projects/{projectId}/dd/overlays';
|
|
125
129
|
exports.API_DD_INTEGRATION_ISSUES_URL = 'https://{url}/projects/{projectId}/dd/issues';
|
|
126
|
-
exports.
|
|
127
|
-
exports.
|
|
128
|
-
exports.
|
|
129
|
-
exports.
|
|
130
|
-
exports.
|
|
131
|
-
exports.
|
|
132
|
-
exports.
|
|
133
|
-
exports.
|
|
134
|
-
exports.
|
|
135
|
-
exports.
|
|
130
|
+
exports.API_DD_INTEGRATION_LOCATIONS_URL = 'https://{url}/projects/{projectId}/dd/locations';
|
|
131
|
+
exports.API_GRAPHS_MAPS_URL = 'https://{url}/graphs/projects/{projectId}/maps';
|
|
132
|
+
exports.API_GRAPHS_MAPS_DEPLOYED_URL = 'https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}';
|
|
133
|
+
exports.API_GRAPHS_MAPS_MERGE_URL = 'https://{url}/graphs/projects/{projectId}/maps/merge';
|
|
134
|
+
exports.API_GRAPHS_MAP_ID_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}';
|
|
135
|
+
exports.API_GRAPHS_MAPS_COPY_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/copy';
|
|
136
|
+
exports.API_GRAPHS_MAPS_DEPLOY_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/deploy';
|
|
137
|
+
exports.API_GRAPHS_MAPS_GEOJSON_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/geojson';
|
|
138
|
+
exports.API_GRAPHS_PANORAMA = 'https://{url}/graphs/projects/{projectId}/panoramas/{panoramaId}';
|
|
139
|
+
exports.API_GRAPHS_PANORAMA_OBSERVATIONS_URL = 'https://{url}/graphs/projects/{projectId}/panoramas/{panoramaId}/observations';
|
|
140
|
+
exports.API_GRAPHS_OBSERVATIONS_URL = 'https://{url}/graphs/projects/{projectId}/observations';
|
|
141
|
+
exports.API_GRAPHS_OBSERVATION_KEYS_URL = 'https://{url}/graphs/projects/{projectId}/observations/keys';
|
|
142
|
+
exports.API_GRAPHS_TARGET_UPLOAD_URL = 'https://{url}/graphs/projects/{projectId}/targets/upload';
|
|
143
|
+
exports.API_GRAPHS_TARGETS_URL = 'https://{url}/graphs/projects/{projectId}/targets';
|
|
144
|
+
exports.API_GRAPHS_ASSETS_UPLOAD_URL = 'https://{url}/graphs/projects/{projectId}/assets/upload';
|
|
145
|
+
exports.API_GRAPHS_ASSETS_URL = 'https://{url}/graphs/projects/{projectId}/assets';
|
|
136
146
|
exports.API_PROJECT_WORKFLOW_URL = 'https://{url}/projects/{projectId}/automate/flows';
|
|
137
147
|
exports.API_PROJECT_WORKFLOW_ID_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}';
|
|
138
148
|
exports.API_PROJECT_WORKFLOW_ASSET_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets';
|
|
139
|
-
exports.
|
|
149
|
+
exports.API_PROJECT_ROBOT_DEPLOYMENTS_URL = 'https://{url}/projects/{projectId}/robot-definitions/{profileId}/robots/{callsign}/automate/flows/deployments';
|
|
150
|
+
exports.API_PROJECT_PROFILE_DEPLOYMENTS_URL = 'https://{url}/projects/{projectId}/robot-definitions/{profileId}/automate/flows/deployments';
|
|
151
|
+
exports.API_PROJECT_ROBOT_NO_PROFILE_DEPLOYMENTS_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments';
|
|
152
|
+
exports.API_PROJECT_PROFILE_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/robot-definitions/{profileId}/automate/flows/deployments/{workflowId}';
|
|
153
|
+
exports.API_PROJECT_ROBOT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/automate/flows/deployments/{workflowId}';
|
|
154
|
+
exports.API_PROJECT_WORKFLOW_AFFECTED_URL = 'https://{url}/projects/{projectId}/automate/flows/{flowId}/robots';
|
|
140
155
|
exports.API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
|
156
|
+
exports.API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
|
|
157
|
+
exports.API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
|
|
@@ -5,7 +5,10 @@ const cleanObject = (object) => {
|
|
|
5
5
|
return {
|
|
6
6
|
...(function _flatten(o) {
|
|
7
7
|
return [...Object.entries(o)].reduce((obj, [key, val]) => {
|
|
8
|
-
if (
|
|
8
|
+
if (val === null) {
|
|
9
|
+
obj[key] = val;
|
|
10
|
+
}
|
|
11
|
+
else if (typeof val === 'object') {
|
|
9
12
|
obj[key] = _flatten(val);
|
|
10
13
|
}
|
|
11
14
|
else if (typeof val === 'function') {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { IRocosSDKConfig } from '../models
|
|
1
|
+
import { IRocosSDKConfig } from '../models';
|
|
2
|
+
type ConfigWithParent = IRocosSDKConfig & {
|
|
3
|
+
_parentConfig?: ConfigWithParent;
|
|
4
|
+
};
|
|
2
5
|
/**
|
|
3
6
|
* Flattens and orders the sdk config props to make a unique key
|
|
4
7
|
*
|
|
5
8
|
* @param config - SDK config {@link IRocosSDKConfig}
|
|
6
9
|
*/
|
|
7
|
-
export declare const getUniqueConfigKey: (config:
|
|
10
|
+
export declare const getUniqueConfigKey: (config: ConfigWithParent) => string;
|
|
11
|
+
export {};
|
|
@@ -7,10 +7,15 @@ exports.getUniqueConfigKey = void 0;
|
|
|
7
7
|
* @param config - SDK config {@link IRocosSDKConfig}
|
|
8
8
|
*/
|
|
9
9
|
const getUniqueConfigKey = (config) => {
|
|
10
|
-
|
|
10
|
+
let rootConfig = config;
|
|
11
|
+
if (rootConfig._parentConfig) {
|
|
12
|
+
// assume there is only one level of nesting
|
|
13
|
+
rootConfig = rootConfig._parentConfig;
|
|
14
|
+
}
|
|
15
|
+
return Object.keys(rootConfig)
|
|
11
16
|
.sort()
|
|
12
17
|
.map((item) => {
|
|
13
|
-
return item !== 'token' ? `${item}:${
|
|
18
|
+
return item !== 'token' ? `${item}:${rootConfig[item]}` : false;
|
|
14
19
|
})
|
|
15
20
|
.filter(Boolean)
|
|
16
21
|
.join();
|
package/cjs/helpers/index.d.ts
CHANGED
package/cjs/helpers/index.js
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AnyNode } from 'acorn';
|
|
2
|
+
import type { NodeType } from './nodes';
|
|
3
|
+
/**
|
|
4
|
+
* A map of node types to a set of property names that are allowed to be accessed
|
|
5
|
+
* on the prototype of the object.
|
|
6
|
+
*
|
|
7
|
+
* If the set is null, all properties are allowed.
|
|
8
|
+
*/
|
|
9
|
+
export type PrototypeWhitelist = Map<unknown, Set<string> | null>;
|
|
10
|
+
export type Scope = Map<string, unknown> | Record<string, unknown>;
|
|
11
|
+
export interface ContextOptions {
|
|
12
|
+
nodeBlacklist?: Set<NodeType>;
|
|
13
|
+
prototypeWhitelist?: PrototypeWhitelist;
|
|
14
|
+
functionCallsAllowed?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export default class Context {
|
|
17
|
+
readonly scope: Map<string, unknown>;
|
|
18
|
+
readonly isFunctionCallAllowed: boolean;
|
|
19
|
+
private readonly options;
|
|
20
|
+
constructor(scope?: Scope, options?: ContextOptions);
|
|
21
|
+
isNodeAllowed(nodeType: AnyNode['type']): boolean;
|
|
22
|
+
newChildContext(scope: Scope): Context;
|
|
23
|
+
/** Returns true if the property is allowed to be accessed on the prototype.
|
|
24
|
+
*
|
|
25
|
+
* - If the prototype is not in the whitelist, the property is allowed only if it is an own property.
|
|
26
|
+
* - If the prototype is in the whitelist, the property is allowed if it is in the set or the set is null.
|
|
27
|
+
*
|
|
28
|
+
* @param prototype The prototype which contains the property being accessed.
|
|
29
|
+
* @param property The name of the property being accessed.
|
|
30
|
+
* @param ownProperty Whether the property is owned by the object it is being accessed on.
|
|
31
|
+
*/
|
|
32
|
+
isPrototypeAllowed(prototype: unknown, property: string, ownProperty: boolean): boolean;
|
|
33
|
+
private static buildMap;
|
|
34
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Context {
|
|
4
|
+
constructor(scope, options) {
|
|
5
|
+
this.scope = scope ? Context.buildMap(scope) : new Map();
|
|
6
|
+
this.options = {
|
|
7
|
+
nodeBlacklist: options?.nodeBlacklist ?? new Set(),
|
|
8
|
+
prototypeWhitelist: options?.prototypeWhitelist ?? new Map(),
|
|
9
|
+
functionCallsAllowed: options?.functionCallsAllowed ?? true,
|
|
10
|
+
};
|
|
11
|
+
this.isFunctionCallAllowed = this.options.functionCallsAllowed;
|
|
12
|
+
}
|
|
13
|
+
isNodeAllowed(nodeType) {
|
|
14
|
+
return !this.options.nodeBlacklist.has(nodeType);
|
|
15
|
+
}
|
|
16
|
+
newChildContext(scope) {
|
|
17
|
+
let newEntries;
|
|
18
|
+
if (scope instanceof Map) {
|
|
19
|
+
newEntries = [...scope.entries()];
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
newEntries = Object.entries(scope);
|
|
23
|
+
}
|
|
24
|
+
const newScope = new Map([...this.scope.entries(), ...newEntries]);
|
|
25
|
+
return new Context(newScope, this.options);
|
|
26
|
+
}
|
|
27
|
+
/** Returns true if the property is allowed to be accessed on the prototype.
|
|
28
|
+
*
|
|
29
|
+
* - If the prototype is not in the whitelist, the property is allowed only if it is an own property.
|
|
30
|
+
* - If the prototype is in the whitelist, the property is allowed if it is in the set or the set is null.
|
|
31
|
+
*
|
|
32
|
+
* @param prototype The prototype which contains the property being accessed.
|
|
33
|
+
* @param property The name of the property being accessed.
|
|
34
|
+
* @param ownProperty Whether the property is owned by the object it is being accessed on.
|
|
35
|
+
*/
|
|
36
|
+
isPrototypeAllowed(prototype, property, ownProperty) {
|
|
37
|
+
const whitelist = this.options.prototypeWhitelist.get(prototype);
|
|
38
|
+
// If the object owns the property, and it's not in the whitelist, it's allowed.
|
|
39
|
+
// This prevents direct calls to non-whitelisted properties on allowed prototypes
|
|
40
|
+
// e.g. Object.prototype.hasOwnProperty.call(obj, 'toString')
|
|
41
|
+
if (whitelist === undefined)
|
|
42
|
+
return ownProperty;
|
|
43
|
+
// all properties allowed if no set is provided
|
|
44
|
+
if (whitelist === null)
|
|
45
|
+
return true;
|
|
46
|
+
return whitelist.has(property);
|
|
47
|
+
}
|
|
48
|
+
static buildMap(obj) {
|
|
49
|
+
return obj instanceof Map ? obj : new Map(Object.entries(obj));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = Context;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as kscript from './kscript';
|
|
@@ -0,0 +1,27 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.kscript = void 0;
|
|
27
|
+
exports.kscript = __importStar(require("./kscript"));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContextOptions, PrototypeWhitelist, Scope } from './Context';
|
|
2
|
+
import { Node } from './nodes';
|
|
3
|
+
export declare function execute(code: string, scope?: Scope, options?: ContextOptions): unknown;
|
|
4
|
+
export declare function compile(code: string, scope?: Scope, options?: ContextOptions): Node;
|
|
5
|
+
export declare const SAFE_GLOBALS: Map<string, unknown>;
|
|
6
|
+
export declare const SAFE_PROTOTYPES: PrototypeWhitelist;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SAFE_PROTOTYPES = exports.SAFE_GLOBALS = exports.compile = exports.execute = void 0;
|
|
7
|
+
const Context_1 = __importDefault(require("./Context"));
|
|
8
|
+
const acorn_1 = require("acorn");
|
|
9
|
+
const utils_1 = require("./utils");
|
|
10
|
+
function execute(code, scope, options) {
|
|
11
|
+
return compile(code, scope, options).run();
|
|
12
|
+
}
|
|
13
|
+
exports.execute = execute;
|
|
14
|
+
function compile(code, scope, options) {
|
|
15
|
+
let program;
|
|
16
|
+
try {
|
|
17
|
+
// we add the brackets to ensure that object literals are parsed correctly
|
|
18
|
+
program = (0, acorn_1.parse)(`(${code})`, { ecmaVersion: 2020, sourceType: 'script' });
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (error instanceof SyntaxError) {
|
|
22
|
+
// fallback to non-wrapped code for edge cases where the brackets cause issues
|
|
23
|
+
program = (0, acorn_1.parse)(`${code}`, { ecmaVersion: 2020, sourceType: 'script' });
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const context = new Context_1.default(scope ?? exports.SAFE_GLOBALS, {
|
|
30
|
+
prototypeWhitelist: exports.SAFE_PROTOTYPES,
|
|
31
|
+
...options,
|
|
32
|
+
});
|
|
33
|
+
return (0, utils_1.construct)(program, context);
|
|
34
|
+
}
|
|
35
|
+
exports.compile = compile;
|
|
36
|
+
exports.SAFE_GLOBALS = new Map(Object.entries({
|
|
37
|
+
console: {
|
|
38
|
+
debug: console.debug,
|
|
39
|
+
error: console.error,
|
|
40
|
+
info: console.info,
|
|
41
|
+
log: console.log,
|
|
42
|
+
warn: console.warn,
|
|
43
|
+
},
|
|
44
|
+
isFinite,
|
|
45
|
+
isNaN,
|
|
46
|
+
Number,
|
|
47
|
+
Object,
|
|
48
|
+
Array,
|
|
49
|
+
Symbol,
|
|
50
|
+
Error,
|
|
51
|
+
JSON,
|
|
52
|
+
Math,
|
|
53
|
+
Date,
|
|
54
|
+
RegExp,
|
|
55
|
+
}));
|
|
56
|
+
exports.SAFE_PROTOTYPES = new Map([
|
|
57
|
+
[Number.prototype, new Set(['toString', 'toFixed', 'toExponential', 'toPrecision'])],
|
|
58
|
+
[
|
|
59
|
+
String.prototype,
|
|
60
|
+
new Set([
|
|
61
|
+
'toString',
|
|
62
|
+
'charAt',
|
|
63
|
+
'charCodeAt',
|
|
64
|
+
'concat',
|
|
65
|
+
'indexOf',
|
|
66
|
+
'lastIndexOf',
|
|
67
|
+
'localeCompare',
|
|
68
|
+
'match',
|
|
69
|
+
'replace',
|
|
70
|
+
'search',
|
|
71
|
+
'slice',
|
|
72
|
+
'split',
|
|
73
|
+
'substring',
|
|
74
|
+
'toLowerCase',
|
|
75
|
+
'toUpperCase',
|
|
76
|
+
'trim',
|
|
77
|
+
'valueOf',
|
|
78
|
+
]),
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
Array.prototype,
|
|
82
|
+
new Set([
|
|
83
|
+
'filter',
|
|
84
|
+
'map',
|
|
85
|
+
'find',
|
|
86
|
+
'findIndex',
|
|
87
|
+
'forEach',
|
|
88
|
+
'every',
|
|
89
|
+
'some',
|
|
90
|
+
'reduce',
|
|
91
|
+
'reduceRight',
|
|
92
|
+
'sort',
|
|
93
|
+
'slice',
|
|
94
|
+
'splice',
|
|
95
|
+
'concat',
|
|
96
|
+
'indexOf',
|
|
97
|
+
'lastIndexOf',
|
|
98
|
+
'includes',
|
|
99
|
+
'join',
|
|
100
|
+
'reverse',
|
|
101
|
+
'shift',
|
|
102
|
+
'unshift',
|
|
103
|
+
'pop',
|
|
104
|
+
'push',
|
|
105
|
+
'copyWithin',
|
|
106
|
+
'fill',
|
|
107
|
+
'entries',
|
|
108
|
+
'keys',
|
|
109
|
+
'values',
|
|
110
|
+
'flat',
|
|
111
|
+
'flatMap',
|
|
112
|
+
]),
|
|
113
|
+
],
|
|
114
|
+
[Object.prototype, new Set(['toString'])],
|
|
115
|
+
]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnyNode, Identifier } from 'acorn';
|
|
2
|
+
import type Context from '../Context';
|
|
3
|
+
import Node from './Node';
|
|
4
|
+
/** An Identifier is a reference to a variable.
|
|
5
|
+
*
|
|
6
|
+
* Variables must be declared in the current scope.
|
|
7
|
+
* If the variable is not found, undefined is returned.
|
|
8
|
+
*/
|
|
9
|
+
export default class IdentifierNode extends Node<Identifier> {
|
|
10
|
+
constructor(node: AnyNode, context: Context);
|
|
11
|
+
run(): unknown;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Node_1 = __importDefault(require("./Node"));
|
|
7
|
+
/** An Identifier is a reference to a variable.
|
|
8
|
+
*
|
|
9
|
+
* Variables must be declared in the current scope.
|
|
10
|
+
* If the variable is not found, undefined is returned.
|
|
11
|
+
*/
|
|
12
|
+
class IdentifierNode extends Node_1.default {
|
|
13
|
+
constructor(node, context) {
|
|
14
|
+
super(node, context, 'Identifier');
|
|
15
|
+
}
|
|
16
|
+
run() {
|
|
17
|
+
return this.scope.get(this.node.name);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = IdentifierNode;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AnyNode, Literal } from 'acorn';
|
|
2
|
+
import Context from '../Context';
|
|
3
|
+
import Node from './Node';
|
|
4
|
+
/** Represents a literal value
|
|
5
|
+
*
|
|
6
|
+
* e.g. `1`, `'hello'`, `true`
|
|
7
|
+
*/
|
|
8
|
+
export default class LiteralNode extends Node<Literal> {
|
|
9
|
+
constructor(node: AnyNode, context: Context);
|
|
10
|
+
run(): unknown;
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Node_1 = __importDefault(require("./Node"));
|
|
7
|
+
/** Represents a literal value
|
|
8
|
+
*
|
|
9
|
+
* e.g. `1`, `'hello'`, `true`
|
|
10
|
+
*/
|
|
11
|
+
class LiteralNode extends Node_1.default {
|
|
12
|
+
constructor(node, context) {
|
|
13
|
+
super(node, context, 'Literal');
|
|
14
|
+
}
|
|
15
|
+
run() {
|
|
16
|
+
if (this.node.bigint) {
|
|
17
|
+
throw new Error('BigInts are not supported');
|
|
18
|
+
}
|
|
19
|
+
return this.node.value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = LiteralNode;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnyNode } from 'acorn';
|
|
2
|
+
import type Context from '../Context';
|
|
3
|
+
export default abstract class Node<T extends AnyNode = AnyNode> {
|
|
4
|
+
protected context: Context;
|
|
5
|
+
protected node: T;
|
|
6
|
+
protected scope: Context['scope'];
|
|
7
|
+
protected constructor(node: AnyNode, context: Context, expectedType: T['type'] | T['type'][]);
|
|
8
|
+
abstract run(): unknown;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Node {
|
|
4
|
+
constructor(node, context, expectedType) {
|
|
5
|
+
this.context = context;
|
|
6
|
+
const expectedTypes = Array.isArray(expectedType) ? expectedType : [expectedType];
|
|
7
|
+
if (!expectedTypes.includes(node.type)) {
|
|
8
|
+
console.error(node);
|
|
9
|
+
throw new Error(`Expected node type to be ${expectedTypes.join(' or ')}, but got ${node.type}`);
|
|
10
|
+
}
|
|
11
|
+
this.node = node;
|
|
12
|
+
this.scope = context.scope;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.default = Node;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AnyNode, Program } from 'acorn';
|
|
2
|
+
import Context from '../Context';
|
|
3
|
+
import Node from './Node';
|
|
4
|
+
/** Represents the root node of the program
|
|
5
|
+
*
|
|
6
|
+
* Since the sandbox only supports a single statement, this node will only ever run the first child.
|
|
7
|
+
*/
|
|
8
|
+
export default class ProgramNode extends Node<Program> {
|
|
9
|
+
constructor(node: AnyNode, scope: Context);
|
|
10
|
+
run(): unknown;
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Node_1 = __importDefault(require("./Node"));
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
/** Represents the root node of the program
|
|
9
|
+
*
|
|
10
|
+
* Since the sandbox only supports a single statement, this node will only ever run the first child.
|
|
11
|
+
*/
|
|
12
|
+
class ProgramNode extends Node_1.default {
|
|
13
|
+
constructor(node, scope) {
|
|
14
|
+
super(node, scope, 'Program');
|
|
15
|
+
}
|
|
16
|
+
run() {
|
|
17
|
+
const children = this.node.body;
|
|
18
|
+
if (children.length !== 1) {
|
|
19
|
+
throw new Error('Only a single statement is supported in the sandbox');
|
|
20
|
+
}
|
|
21
|
+
return (0, utils_1.construct)(children[0], this.context).run();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = ProgramNode;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AnyNode, TemplateLiteral } from 'acorn';
|
|
2
|
+
import Context from '../Context';
|
|
3
|
+
import Node from './Node';
|
|
4
|
+
/**
|
|
5
|
+
* A template literal is a string literal that allows embedded expressions.
|
|
6
|
+
*
|
|
7
|
+
* e.g. `Hello ${name}`
|
|
8
|
+
*
|
|
9
|
+
* The `quasis` property is an array of strings that are the static parts of the template literal.
|
|
10
|
+
* The `expressions` property is an array of expressions that are the dynamic parts of the template literal.
|
|
11
|
+
*
|
|
12
|
+
* The template literal is constructed by merging the static parts with the results of evaluating the dynamic parts.
|
|
13
|
+
*
|
|
14
|
+
* i.e. `Hello ${name}. My name is ${name}.`
|
|
15
|
+
* Would result in three quasi values: `Hello `, `. My name is ` and `.`
|
|
16
|
+
* And two expressions: `Identifier<name>` and `Identifier<name>`
|
|
17
|
+
*
|
|
18
|
+
* There is *always* one more quasi value than there are expressions, even if the last quasi is an empty string.
|
|
19
|
+
*/
|
|
20
|
+
export default class TemplateLiteralNode extends Node<TemplateLiteral> {
|
|
21
|
+
constructor(node: AnyNode, scope: Context);
|
|
22
|
+
run(): unknown;
|
|
23
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Node_1 = __importDefault(require("./Node"));
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
/**
|
|
9
|
+
* A template literal is a string literal that allows embedded expressions.
|
|
10
|
+
*
|
|
11
|
+
* e.g. `Hello ${name}`
|
|
12
|
+
*
|
|
13
|
+
* The `quasis` property is an array of strings that are the static parts of the template literal.
|
|
14
|
+
* The `expressions` property is an array of expressions that are the dynamic parts of the template literal.
|
|
15
|
+
*
|
|
16
|
+
* The template literal is constructed by merging the static parts with the results of evaluating the dynamic parts.
|
|
17
|
+
*
|
|
18
|
+
* i.e. `Hello ${name}. My name is ${name}.`
|
|
19
|
+
* Would result in three quasi values: `Hello `, `. My name is ` and `.`
|
|
20
|
+
* And two expressions: `Identifier<name>` and `Identifier<name>`
|
|
21
|
+
*
|
|
22
|
+
* There is *always* one more quasi value than there are expressions, even if the last quasi is an empty string.
|
|
23
|
+
*/
|
|
24
|
+
class TemplateLiteralNode extends Node_1.default {
|
|
25
|
+
constructor(node, scope) {
|
|
26
|
+
super(node, scope, 'TemplateLiteral');
|
|
27
|
+
}
|
|
28
|
+
run() {
|
|
29
|
+
return this.node.quasis.reduce((acc, quasi, i) => {
|
|
30
|
+
const expression = this.node.expressions[i] ? (0, utils_1.construct)(this.node.expressions[i], this.context).run() : '';
|
|
31
|
+
return acc + quasi.value.raw + expression;
|
|
32
|
+
}, '');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = TemplateLiteralNode;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AnyNode, ArrayExpression } from 'acorn';
|
|
2
|
+
import type Context from '../../Context';
|
|
3
|
+
import Node from '../Node';
|
|
4
|
+
export default class ArrayExpressionNode extends Node<ArrayExpression> {
|
|
5
|
+
constructor(node: AnyNode, context: Context);
|
|
6
|
+
run(): unknown;
|
|
7
|
+
}
|