@dronedeploy/rocos-js-sdk 3.0.1-alpha.9 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (373) hide show
  1. package/README.md +59 -29
  2. package/cjs/IRocosSDK.d.ts +4 -3
  3. package/cjs/RocosSDK.d.ts +19 -7
  4. package/cjs/RocosSDK.js +31 -10
  5. package/cjs/api/streams/caller/CallerStream.js +5 -2
  6. package/cjs/api/streams/caller/CallerStreamNode.js +2 -1
  7. package/cjs/api/streams/command/CommandStream.js +5 -2
  8. package/cjs/api/streams/command/CommandStreamNode.js +2 -1
  9. package/cjs/api/streams/control/ControlStream.js +5 -2
  10. package/cjs/api/streams/control/ControlStreamAbstract.d.ts +1 -1
  11. package/cjs/api/streams/control/ControlStreamNode.js +2 -1
  12. package/cjs/api/streams/fileAccessor/FileAccessorStream.js +4 -1
  13. package/cjs/api/streams/fileAccessor/FileAccessorStreamNode.js +3 -1
  14. package/cjs/api/streams/search/SearchStream.js +5 -2
  15. package/cjs/api/streams/search/SearchStreamNode.js +2 -1
  16. package/cjs/api/streams/telemetry/TelemetryStream.js +4 -1
  17. package/cjs/api/streams/telemetry/TelemetryStreamAbstract.d.ts +1 -1
  18. package/cjs/api/streams/telemetry/TelemetryStreamNode.js +2 -1
  19. package/cjs/api/streams/webRTCSignalling/WebRTCSignallingStream.js +5 -2
  20. package/cjs/constants/api.d.ts +31 -15
  21. package/cjs/constants/api.js +35 -18
  22. package/cjs/helpers/cleanObject.js +4 -1
  23. package/cjs/helpers/getUniqueConfigKey.d.ts +6 -2
  24. package/cjs/helpers/getUniqueConfigKey.js +7 -2
  25. package/cjs/helpers/index.d.ts +1 -0
  26. package/cjs/helpers/index.js +1 -0
  27. package/cjs/helpers/kscript/Context.d.ts +34 -0
  28. package/cjs/helpers/kscript/Context.js +52 -0
  29. package/cjs/helpers/kscript/index.d.ts +1 -0
  30. package/cjs/helpers/kscript/index.js +27 -0
  31. package/cjs/helpers/kscript/kscript.d.ts +6 -0
  32. package/cjs/helpers/kscript/kscript.js +115 -0
  33. package/cjs/helpers/kscript/nodes/Identifier.d.ts +12 -0
  34. package/cjs/helpers/kscript/nodes/Identifier.js +20 -0
  35. package/cjs/helpers/kscript/nodes/Literal.d.ts +11 -0
  36. package/cjs/helpers/kscript/nodes/Literal.js +22 -0
  37. package/cjs/helpers/kscript/nodes/Node.d.ts +9 -0
  38. package/cjs/helpers/kscript/nodes/Node.js +15 -0
  39. package/cjs/helpers/kscript/nodes/Program.d.ts +11 -0
  40. package/cjs/helpers/kscript/nodes/Program.js +24 -0
  41. package/cjs/helpers/kscript/nodes/TemplateLiteral.d.ts +23 -0
  42. package/cjs/helpers/kscript/nodes/TemplateLiteral.js +35 -0
  43. package/cjs/helpers/kscript/nodes/expressions/ArrayExpression.d.ts +7 -0
  44. package/cjs/helpers/kscript/nodes/expressions/ArrayExpression.js +31 -0
  45. package/cjs/helpers/kscript/nodes/expressions/ArrowFunctionExpression.d.ts +14 -0
  46. package/cjs/helpers/kscript/nodes/expressions/ArrowFunctionExpression.js +40 -0
  47. package/cjs/helpers/kscript/nodes/expressions/BinaryExpression.d.ts +16 -0
  48. package/cjs/helpers/kscript/nodes/expressions/BinaryExpression.js +104 -0
  49. package/cjs/helpers/kscript/nodes/expressions/CallExpression.d.ts +8 -0
  50. package/cjs/helpers/kscript/nodes/expressions/CallExpression.js +38 -0
  51. package/cjs/helpers/kscript/nodes/expressions/ChainExpression.d.ts +16 -0
  52. package/cjs/helpers/kscript/nodes/expressions/ChainExpression.js +25 -0
  53. package/cjs/helpers/kscript/nodes/expressions/ConditionalExpression.d.ts +14 -0
  54. package/cjs/helpers/kscript/nodes/expressions/ConditionalExpression.js +30 -0
  55. package/cjs/helpers/kscript/nodes/expressions/ExpressionStatement.d.ts +7 -0
  56. package/cjs/helpers/kscript/nodes/expressions/ExpressionStatement.js +18 -0
  57. package/cjs/helpers/kscript/nodes/expressions/LogicalExpression.d.ts +10 -0
  58. package/cjs/helpers/kscript/nodes/expressions/LogicalExpression.js +47 -0
  59. package/cjs/helpers/kscript/nodes/expressions/MemberExpression.d.ts +44 -0
  60. package/cjs/helpers/kscript/nodes/expressions/MemberExpression.js +98 -0
  61. package/cjs/helpers/kscript/nodes/expressions/ObjectExpression.d.ts +11 -0
  62. package/cjs/helpers/kscript/nodes/expressions/ObjectExpression.js +59 -0
  63. package/cjs/helpers/kscript/nodes/expressions/UnaryExpression.d.ts +12 -0
  64. package/cjs/helpers/kscript/nodes/expressions/UnaryExpression.js +44 -0
  65. package/cjs/helpers/kscript/nodes/expressions/index.d.ts +11 -0
  66. package/cjs/helpers/kscript/nodes/expressions/index.js +28 -0
  67. package/cjs/helpers/kscript/nodes/index.d.ts +4 -0
  68. package/cjs/helpers/kscript/nodes/index.js +10 -0
  69. package/cjs/helpers/kscript/nodes/nodeTypes.d.ts +33 -0
  70. package/cjs/helpers/kscript/nodes/nodeTypes.js +29 -0
  71. package/cjs/helpers/kscript/utils.d.ts +4 -0
  72. package/cjs/helpers/kscript/utils.js +15 -0
  73. package/cjs/helpers/websandbox/connection.d.ts +2 -1
  74. package/cjs/helpers/websandbox/connection.js +6 -5
  75. package/cjs/helpers/websandbox/frame/frame.js +4 -1
  76. package/cjs/helpers/websandbox/frame/frame.source.js +1 -1
  77. package/cjs/helpers/websandbox/frame/worker/manager.d.ts +8 -4
  78. package/cjs/helpers/websandbox/frame/worker/manager.js +32 -14
  79. package/cjs/helpers/websandbox/frame/worker/worker.source.js +1 -1
  80. package/cjs/helpers/websandbox/sandbox.d.ts +1 -1
  81. package/cjs/helpers/websandbox/sandbox.js +7 -7
  82. package/cjs/models/IConnectedCallsign.d.ts +10 -0
  83. package/cjs/models/IConnectedCallsign.js +8 -0
  84. package/cjs/models/RocosError.d.ts +3 -0
  85. package/cjs/models/RocosError.js +3 -0
  86. package/cjs/models/ServiceEnum.d.ts +20 -17
  87. package/cjs/models/ServiceEnum.js +20 -17
  88. package/cjs/models/TelemetryStatus.d.ts +12 -0
  89. package/cjs/models/TelemetryStatus.js +17 -0
  90. package/cjs/models/Token.d.ts +2 -2
  91. package/cjs/models/Token.js +5 -5
  92. package/cjs/models/asset-storage/{AssetModelItem.d.ts → AssetItem.d.ts} +2 -0
  93. package/cjs/models/device-credentials/DeviceCredentials.d.ts +61 -0
  94. package/cjs/models/device-credentials/DeviceCredentials.js +2 -0
  95. package/cjs/models/graph/Position.d.ts +6 -0
  96. package/cjs/models/graph/Position.js +2 -0
  97. package/cjs/models/graph/Quaternion.d.ts +6 -0
  98. package/cjs/models/graph/Quaternion.js +2 -0
  99. package/cjs/models/graph/Vector3.d.ts +5 -0
  100. package/cjs/models/graph/Vector3.js +2 -0
  101. package/cjs/models/graph/index.d.ts +3 -0
  102. package/cjs/models/graph/index.js +19 -0
  103. package/cjs/models/index.d.ts +9 -2
  104. package/cjs/models/index.js +9 -2
  105. package/cjs/models/integrations/Location.d.ts +24 -0
  106. package/cjs/models/integrations/Location.js +2 -0
  107. package/cjs/models/integrations/PaginatedResults.d.ts +4 -0
  108. package/cjs/models/integrations/PaginatedResults.js +2 -0
  109. package/cjs/models/maps/Panorama.d.ts +12 -21
  110. package/cjs/models/projects/ExternalProject.d.ts +10 -0
  111. package/cjs/models/projects/ExternalProject.js +2 -0
  112. package/cjs/models/projects/NewProjectRequest.d.ts +8 -0
  113. package/cjs/models/projects/NewProjectRequest.js +2 -0
  114. package/cjs/models/target/Target.d.ts +30 -0
  115. package/cjs/models/target/Target.js +15 -0
  116. package/cjs/node/RocosSDKNode.d.ts +1 -5
  117. package/cjs/node/RocosSDKNode.js +9 -9
  118. package/cjs/services/AssetStorageService.d.ts +9 -1
  119. package/cjs/services/AssetStorageService.js +12 -1
  120. package/cjs/services/AuthService.d.ts +12 -1
  121. package/cjs/services/AuthService.js +25 -1
  122. package/cjs/services/DeviceCredentialsService.d.ts +15 -0
  123. package/cjs/services/DeviceCredentialsService.js +56 -0
  124. package/cjs/services/EnvironmentService.d.ts +34 -0
  125. package/cjs/services/EnvironmentService.js +56 -0
  126. package/cjs/services/EvaluatorService.js +1 -1
  127. package/cjs/services/IntegrationService.d.ts +7 -1
  128. package/cjs/services/IntegrationService.js +8 -0
  129. package/cjs/services/MapService.d.ts +18 -8
  130. package/cjs/services/MapService.js +37 -19
  131. package/cjs/services/ProfileService.d.ts +24 -0
  132. package/cjs/services/ProfileService.js +34 -0
  133. package/cjs/services/ProjectService.d.ts +7 -2
  134. package/cjs/services/ProjectService.js +7 -3
  135. package/cjs/services/RTPWebRTCService.d.ts +6 -1
  136. package/cjs/services/RTPWebRTCService.js +10 -2
  137. package/cjs/services/RobotService.d.ts +3 -1
  138. package/cjs/services/RobotService.js +6 -0
  139. package/cjs/services/SpotProvisioningService.d.ts +1 -1
  140. package/cjs/services/SpotProvisioningServiceNode.d.ts +1 -1
  141. package/cjs/services/TargetService.d.ts +17 -0
  142. package/cjs/services/TargetService.js +66 -0
  143. package/cjs/services/TelemetryService.d.ts +10 -1
  144. package/cjs/services/TelemetryService.js +27 -5
  145. package/cjs/services/WorkflowService.d.ts +18 -8
  146. package/cjs/services/WorkflowService.js +37 -11
  147. package/cjs/services/index.d.ts +11 -9
  148. package/cjs/services/index.js +11 -9
  149. package/cjs/store/RocosStore.d.ts +1 -2
  150. package/esm/IRocosSDK.d.ts +4 -3
  151. package/esm/RocosSDK.d.ts +19 -7
  152. package/esm/RocosSDK.js +32 -11
  153. package/esm/api/streams/caller/CallerStream.js +5 -2
  154. package/esm/api/streams/caller/CallerStreamNode.js +2 -1
  155. package/esm/api/streams/command/CommandStream.js +5 -2
  156. package/esm/api/streams/command/CommandStreamNode.js +2 -1
  157. package/esm/api/streams/control/ControlStream.js +5 -2
  158. package/esm/api/streams/control/ControlStreamAbstract.d.ts +1 -1
  159. package/esm/api/streams/control/ControlStreamNode.js +2 -1
  160. package/esm/api/streams/fileAccessor/FileAccessorStream.js +4 -1
  161. package/esm/api/streams/fileAccessor/FileAccessorStreamNode.js +3 -1
  162. package/esm/api/streams/search/SearchStream.js +5 -2
  163. package/esm/api/streams/search/SearchStreamNode.js +2 -1
  164. package/esm/api/streams/telemetry/TelemetryStream.js +4 -1
  165. package/esm/api/streams/telemetry/TelemetryStreamAbstract.d.ts +1 -1
  166. package/esm/api/streams/telemetry/TelemetryStreamNode.js +2 -1
  167. package/esm/api/streams/webRTCSignalling/WebRTCSignallingStream.js +5 -2
  168. package/esm/constants/api.d.ts +31 -15
  169. package/esm/constants/api.js +31 -15
  170. package/esm/helpers/cleanObject.js +4 -1
  171. package/esm/helpers/getUniqueConfigKey.d.ts +6 -2
  172. package/esm/helpers/getUniqueConfigKey.js +7 -2
  173. package/esm/helpers/index.d.ts +1 -0
  174. package/esm/helpers/index.js +1 -0
  175. package/esm/helpers/kscript/Context.d.ts +34 -0
  176. package/esm/helpers/kscript/Context.js +49 -0
  177. package/esm/helpers/kscript/index.d.ts +1 -0
  178. package/esm/helpers/kscript/index.js +1 -0
  179. package/esm/helpers/kscript/kscript.d.ts +6 -0
  180. package/esm/helpers/kscript/kscript.js +107 -0
  181. package/esm/helpers/kscript/nodes/Identifier.d.ts +12 -0
  182. package/esm/helpers/kscript/nodes/Identifier.js +14 -0
  183. package/esm/helpers/kscript/nodes/Literal.d.ts +11 -0
  184. package/esm/helpers/kscript/nodes/Literal.js +16 -0
  185. package/esm/helpers/kscript/nodes/Node.d.ts +9 -0
  186. package/esm/helpers/kscript/nodes/Node.js +12 -0
  187. package/esm/helpers/kscript/nodes/Program.d.ts +11 -0
  188. package/esm/helpers/kscript/nodes/Program.js +18 -0
  189. package/esm/helpers/kscript/nodes/TemplateLiteral.d.ts +23 -0
  190. package/esm/helpers/kscript/nodes/TemplateLiteral.js +29 -0
  191. package/esm/helpers/kscript/nodes/expressions/ArrayExpression.d.ts +7 -0
  192. package/esm/helpers/kscript/nodes/expressions/ArrayExpression.js +25 -0
  193. package/esm/helpers/kscript/nodes/expressions/ArrowFunctionExpression.d.ts +14 -0
  194. package/esm/helpers/kscript/nodes/expressions/ArrowFunctionExpression.js +34 -0
  195. package/esm/helpers/kscript/nodes/expressions/BinaryExpression.d.ts +16 -0
  196. package/esm/helpers/kscript/nodes/expressions/BinaryExpression.js +98 -0
  197. package/esm/helpers/kscript/nodes/expressions/CallExpression.d.ts +8 -0
  198. package/esm/helpers/kscript/nodes/expressions/CallExpression.js +32 -0
  199. package/esm/helpers/kscript/nodes/expressions/ChainExpression.d.ts +16 -0
  200. package/esm/helpers/kscript/nodes/expressions/ChainExpression.js +19 -0
  201. package/esm/helpers/kscript/nodes/expressions/ConditionalExpression.d.ts +14 -0
  202. package/esm/helpers/kscript/nodes/expressions/ConditionalExpression.js +24 -0
  203. package/esm/helpers/kscript/nodes/expressions/ExpressionStatement.d.ts +7 -0
  204. package/esm/helpers/kscript/nodes/expressions/ExpressionStatement.js +12 -0
  205. package/esm/helpers/kscript/nodes/expressions/LogicalExpression.d.ts +10 -0
  206. package/esm/helpers/kscript/nodes/expressions/LogicalExpression.js +41 -0
  207. package/esm/helpers/kscript/nodes/expressions/MemberExpression.d.ts +44 -0
  208. package/esm/helpers/kscript/nodes/expressions/MemberExpression.js +92 -0
  209. package/esm/helpers/kscript/nodes/expressions/ObjectExpression.d.ts +11 -0
  210. package/esm/helpers/kscript/nodes/expressions/ObjectExpression.js +53 -0
  211. package/esm/helpers/kscript/nodes/expressions/UnaryExpression.d.ts +12 -0
  212. package/esm/helpers/kscript/nodes/expressions/UnaryExpression.js +38 -0
  213. package/esm/helpers/kscript/nodes/expressions/index.d.ts +11 -0
  214. package/esm/helpers/kscript/nodes/expressions/index.js +11 -0
  215. package/esm/helpers/kscript/nodes/index.d.ts +4 -0
  216. package/esm/helpers/kscript/nodes/index.js +3 -0
  217. package/esm/helpers/kscript/nodes/nodeTypes.d.ts +33 -0
  218. package/esm/helpers/kscript/nodes/nodeTypes.js +24 -0
  219. package/esm/helpers/kscript/utils.d.ts +4 -0
  220. package/esm/helpers/kscript/utils.js +11 -0
  221. package/esm/helpers/websandbox/connection.d.ts +2 -1
  222. package/esm/helpers/websandbox/connection.js +6 -5
  223. package/esm/helpers/websandbox/frame/frame.js +4 -1
  224. package/esm/helpers/websandbox/frame/frame.source.js +1 -1
  225. package/esm/helpers/websandbox/frame/worker/manager.d.ts +8 -4
  226. package/esm/helpers/websandbox/frame/worker/manager.js +32 -14
  227. package/esm/helpers/websandbox/frame/worker/worker.source.js +1 -1
  228. package/esm/helpers/websandbox/sandbox.d.ts +1 -1
  229. package/esm/helpers/websandbox/sandbox.js +7 -7
  230. package/esm/models/IConnectedCallsign.d.ts +10 -0
  231. package/esm/models/IConnectedCallsign.js +5 -0
  232. package/esm/models/RocosError.d.ts +3 -0
  233. package/esm/models/RocosError.js +3 -0
  234. package/esm/models/ServiceEnum.d.ts +20 -17
  235. package/esm/models/ServiceEnum.js +20 -17
  236. package/esm/models/TelemetryStatus.d.ts +12 -0
  237. package/esm/models/TelemetryStatus.js +14 -0
  238. package/esm/models/Token.d.ts +2 -2
  239. package/esm/models/Token.js +5 -5
  240. package/esm/models/asset-storage/{AssetModelItem.d.ts → AssetItem.d.ts} +2 -0
  241. package/esm/models/device-credentials/DeviceCredentials.d.ts +61 -0
  242. package/esm/models/graph/Position.d.ts +6 -0
  243. package/esm/models/graph/Quaternion.d.ts +6 -0
  244. package/esm/models/graph/Vector3.d.ts +5 -0
  245. package/esm/models/graph/index.d.ts +3 -0
  246. package/esm/models/graph/index.js +3 -0
  247. package/esm/models/index.d.ts +9 -2
  248. package/esm/models/index.js +9 -2
  249. package/esm/models/integrations/Location.d.ts +24 -0
  250. package/esm/models/integrations/PaginatedResults.d.ts +4 -0
  251. package/esm/models/maps/Panorama.d.ts +12 -21
  252. package/esm/models/projects/ExternalProject.d.ts +10 -0
  253. package/esm/models/projects/NewProjectRequest.d.ts +8 -0
  254. package/esm/models/target/Target.d.ts +30 -0
  255. package/esm/models/target/Target.js +9 -0
  256. package/esm/node/RocosSDKNode.d.ts +1 -5
  257. package/esm/node/RocosSDKNode.js +10 -10
  258. package/esm/services/AssetStorageService.d.ts +9 -1
  259. package/esm/services/AssetStorageService.js +13 -2
  260. package/esm/services/AuthService.d.ts +12 -1
  261. package/esm/services/AuthService.js +25 -1
  262. package/esm/services/BaseServiceAbstract.js +1 -1
  263. package/esm/services/DeviceCredentialsService.d.ts +15 -0
  264. package/esm/services/DeviceCredentialsService.js +52 -0
  265. package/esm/services/EnvironmentService.d.ts +34 -0
  266. package/esm/services/EnvironmentService.js +52 -0
  267. package/esm/services/EvaluatorService.js +1 -1
  268. package/esm/services/IntegrationService.d.ts +7 -1
  269. package/esm/services/IntegrationService.js +10 -2
  270. package/esm/services/MapService.d.ts +18 -8
  271. package/esm/services/MapService.js +38 -20
  272. package/esm/services/ProfileService.d.ts +24 -0
  273. package/esm/services/ProfileService.js +35 -1
  274. package/esm/services/ProjectService.d.ts +7 -2
  275. package/esm/services/ProjectService.js +9 -5
  276. package/esm/services/RTPWebRTCService.d.ts +6 -1
  277. package/esm/services/RTPWebRTCService.js +10 -2
  278. package/esm/services/RobotService.d.ts +3 -1
  279. package/esm/services/RobotService.js +8 -2
  280. package/esm/services/SpotProvisioningService.d.ts +1 -1
  281. package/esm/services/SpotProvisioningServiceNode.d.ts +1 -1
  282. package/esm/services/TargetService.d.ts +17 -0
  283. package/esm/services/TargetService.js +62 -0
  284. package/esm/services/TelemetryService.d.ts +10 -1
  285. package/esm/services/TelemetryService.js +28 -6
  286. package/esm/services/WorkflowService.d.ts +18 -8
  287. package/esm/services/WorkflowService.js +38 -12
  288. package/esm/services/index.d.ts +11 -9
  289. package/esm/services/index.js +11 -9
  290. package/esm/store/RocosStore.d.ts +1 -2
  291. package/package.json +2 -2
  292. package/cjs/helpers/cleanObject.spec.js +0 -55
  293. package/cjs/helpers/flattenObject.spec.js +0 -31
  294. package/cjs/helpers/flattenOneOf.spec.js +0 -159
  295. package/cjs/helpers/formatServiceUrl.spec.js +0 -18
  296. package/cjs/helpers/getSha256Hex.spec.js +0 -19
  297. package/cjs/helpers/getSha256HexNode.spec.js +0 -10
  298. package/cjs/helpers/getURLSearchParams.spec.js +0 -21
  299. package/cjs/helpers/nanosecondToMillisecond.spec.js +0 -22
  300. package/cjs/helpers/splitRobotTopic.spec.js +0 -53
  301. package/cjs/helpers/standardDeviation.spec.d.ts +0 -1
  302. package/cjs/helpers/standardDeviation.spec.js +0 -13
  303. package/cjs/helpers/websandbox/frame/worker/manager.spec.d.ts +0 -4
  304. package/cjs/helpers/websandbox/frame/worker/manager.spec.js +0 -132
  305. package/cjs/models/CallsignStatus.d.ts +0 -6
  306. package/cjs/models/CallsignStatus.js +0 -10
  307. package/cjs/models/ExternalProject.d.ts +0 -6
  308. package/cjs/models/ExternalProject.js +0 -6
  309. package/cjs/models/Token.spec.d.ts +0 -1
  310. package/cjs/models/Token.spec.js +0 -110
  311. package/cjs/services/AuthService.spec.d.ts +0 -1
  312. package/cjs/services/AuthService.spec.js +0 -165
  313. package/cjs/services/CallerService.spec.d.ts +0 -1
  314. package/cjs/services/CallerService.spec.js +0 -229
  315. package/cjs/services/FunctionService.d.ts +0 -68
  316. package/cjs/services/FunctionService.js +0 -103
  317. package/cjs/services/PlatformTimeService.spec.d.ts +0 -1
  318. package/cjs/services/PlatformTimeService.spec.js +0 -182
  319. package/cjs/services/RTPWebRTCService.spec.d.ts +0 -4
  320. package/cjs/services/RTPWebRTCService.spec.js +0 -171
  321. package/cjs/services/TelemetryService.spec.d.ts +0 -1
  322. package/cjs/services/TelemetryService.spec.js +0 -39
  323. package/esm/helpers/cleanObject.spec.d.ts +0 -1
  324. package/esm/helpers/cleanObject.spec.js +0 -53
  325. package/esm/helpers/flattenObject.spec.d.ts +0 -1
  326. package/esm/helpers/flattenObject.spec.js +0 -29
  327. package/esm/helpers/flattenOneOf.spec.d.ts +0 -1
  328. package/esm/helpers/flattenOneOf.spec.js +0 -157
  329. package/esm/helpers/formatServiceUrl.spec.d.ts +0 -1
  330. package/esm/helpers/formatServiceUrl.spec.js +0 -16
  331. package/esm/helpers/getSha256Hex.spec.d.ts +0 -1
  332. package/esm/helpers/getSha256Hex.spec.js +0 -14
  333. package/esm/helpers/getSha256HexNode.spec.d.ts +0 -1
  334. package/esm/helpers/getSha256HexNode.spec.js +0 -8
  335. package/esm/helpers/getURLSearchParams.spec.d.ts +0 -1
  336. package/esm/helpers/getURLSearchParams.spec.js +0 -19
  337. package/esm/helpers/nanosecondToMillisecond.spec.d.ts +0 -1
  338. package/esm/helpers/nanosecondToMillisecond.spec.js +0 -20
  339. package/esm/helpers/splitRobotTopic.spec.d.ts +0 -1
  340. package/esm/helpers/splitRobotTopic.spec.js +0 -51
  341. package/esm/helpers/standardDeviation.spec.d.ts +0 -1
  342. package/esm/helpers/standardDeviation.spec.js +0 -11
  343. package/esm/helpers/websandbox/frame/worker/manager.spec.d.ts +0 -4
  344. package/esm/helpers/websandbox/frame/worker/manager.spec.js +0 -127
  345. package/esm/models/CallsignStatus.d.ts +0 -6
  346. package/esm/models/CallsignStatus.js +0 -7
  347. package/esm/models/ExternalProject.d.ts +0 -6
  348. package/esm/models/ExternalProject.js +0 -2
  349. package/esm/models/Token.spec.d.ts +0 -1
  350. package/esm/models/Token.spec.js +0 -108
  351. package/esm/models/asset-storage/AssetModelItem.js +0 -1
  352. package/esm/services/AuthService.spec.d.ts +0 -1
  353. package/esm/services/AuthService.spec.js +0 -163
  354. package/esm/services/CallerService.spec.d.ts +0 -1
  355. package/esm/services/CallerService.spec.js +0 -227
  356. package/esm/services/FunctionService.d.ts +0 -68
  357. package/esm/services/FunctionService.js +0 -99
  358. package/esm/services/PlatformTimeService.spec.d.ts +0 -1
  359. package/esm/services/PlatformTimeService.spec.js +0 -180
  360. package/esm/services/RTPWebRTCService.spec.d.ts +0 -4
  361. package/esm/services/RTPWebRTCService.spec.js +0 -169
  362. package/esm/services/TelemetryService.spec.d.ts +0 -1
  363. package/esm/services/TelemetryService.spec.js +0 -37
  364. /package/cjs/models/asset-storage/{AssetModelItem.js → AssetItem.js} +0 -0
  365. /package/{cjs/helpers/cleanObject.spec.d.ts → esm/models/asset-storage/AssetItem.js} +0 -0
  366. /package/{cjs/helpers/flattenObject.spec.d.ts → esm/models/device-credentials/DeviceCredentials.js} +0 -0
  367. /package/{cjs/helpers/flattenOneOf.spec.d.ts → esm/models/graph/Position.js} +0 -0
  368. /package/{cjs/helpers/formatServiceUrl.spec.d.ts → esm/models/graph/Quaternion.js} +0 -0
  369. /package/{cjs/helpers/getSha256Hex.spec.d.ts → esm/models/graph/Vector3.js} +0 -0
  370. /package/{cjs/helpers/getSha256HexNode.spec.d.ts → esm/models/integrations/Location.js} +0 -0
  371. /package/{cjs/helpers/getURLSearchParams.spec.d.ts → esm/models/integrations/PaginatedResults.js} +0 -0
  372. /package/{cjs/helpers/nanosecondToMillisecond.spec.d.ts → esm/models/projects/ExternalProject.js} +0 -0
  373. /package/{cjs/helpers/splitRobotTopic.spec.d.ts → esm/models/projects/NewProjectRequest.js} +0 -0
@@ -0,0 +1,44 @@
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
+ /** A unary expression is an expression that consists of a single operand and an operator
9
+ *
10
+ * e.g. `+1`, `-2`, `!true`, `typeof x`
11
+ */
12
+ class UnaryExpressionNode extends Node_1.default {
13
+ constructor(node, context) {
14
+ super(node, context, 'UnaryExpression');
15
+ }
16
+ run() {
17
+ const argument = (0, utils_1.construct)(this.node.argument, this.context).run();
18
+ switch (this.node.operator) {
19
+ case '+':
20
+ case '-':
21
+ return this.arithmetic(this.node.operator, argument);
22
+ case '!':
23
+ return !argument;
24
+ case 'typeof':
25
+ return typeof argument;
26
+ default:
27
+ throw new Error(`Unsupported operator: ${this.node.operator}`);
28
+ }
29
+ }
30
+ arithmetic(operator, argument) {
31
+ if (typeof argument !== 'number') {
32
+ throw new Error('Unary arithmetic operators are only supported for numbers');
33
+ }
34
+ switch (operator) {
35
+ case '+':
36
+ return +argument;
37
+ case '-':
38
+ return -argument;
39
+ default:
40
+ throw new Error(`Unsupported operator: ${operator}`);
41
+ }
42
+ }
43
+ }
44
+ exports.default = UnaryExpressionNode;
@@ -0,0 +1,11 @@
1
+ export { default as ExpressionStatement } from './ExpressionStatement';
2
+ export { default as ArrayExpression } from './ArrayExpression';
3
+ export { default as ObjectExpression } from './ObjectExpression';
4
+ export { default as BinaryExpression } from './BinaryExpression';
5
+ export { default as UnaryExpression } from './UnaryExpression';
6
+ export { default as LogicalExpression } from './LogicalExpression';
7
+ export { default as ConditionalExpression } from './ConditionalExpression';
8
+ export { default as CallExpression } from './CallExpression';
9
+ export { default as ArrowFunctionExpression } from './ArrowFunctionExpression';
10
+ export { default as MemberExpression } from './MemberExpression';
11
+ export { default as ChainExpression } from './ChainExpression';
@@ -0,0 +1,28 @@
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.ChainExpression = exports.MemberExpression = exports.ArrowFunctionExpression = exports.CallExpression = exports.ConditionalExpression = exports.LogicalExpression = exports.UnaryExpression = exports.BinaryExpression = exports.ObjectExpression = exports.ArrayExpression = exports.ExpressionStatement = void 0;
7
+ var ExpressionStatement_1 = require("./ExpressionStatement");
8
+ Object.defineProperty(exports, "ExpressionStatement", { enumerable: true, get: function () { return __importDefault(ExpressionStatement_1).default; } });
9
+ var ArrayExpression_1 = require("./ArrayExpression");
10
+ Object.defineProperty(exports, "ArrayExpression", { enumerable: true, get: function () { return __importDefault(ArrayExpression_1).default; } });
11
+ var ObjectExpression_1 = require("./ObjectExpression");
12
+ Object.defineProperty(exports, "ObjectExpression", { enumerable: true, get: function () { return __importDefault(ObjectExpression_1).default; } });
13
+ var BinaryExpression_1 = require("./BinaryExpression");
14
+ Object.defineProperty(exports, "BinaryExpression", { enumerable: true, get: function () { return __importDefault(BinaryExpression_1).default; } });
15
+ var UnaryExpression_1 = require("./UnaryExpression");
16
+ Object.defineProperty(exports, "UnaryExpression", { enumerable: true, get: function () { return __importDefault(UnaryExpression_1).default; } });
17
+ var LogicalExpression_1 = require("./LogicalExpression");
18
+ Object.defineProperty(exports, "LogicalExpression", { enumerable: true, get: function () { return __importDefault(LogicalExpression_1).default; } });
19
+ var ConditionalExpression_1 = require("./ConditionalExpression");
20
+ Object.defineProperty(exports, "ConditionalExpression", { enumerable: true, get: function () { return __importDefault(ConditionalExpression_1).default; } });
21
+ var CallExpression_1 = require("./CallExpression");
22
+ Object.defineProperty(exports, "CallExpression", { enumerable: true, get: function () { return __importDefault(CallExpression_1).default; } });
23
+ var ArrowFunctionExpression_1 = require("./ArrowFunctionExpression");
24
+ Object.defineProperty(exports, "ArrowFunctionExpression", { enumerable: true, get: function () { return __importDefault(ArrowFunctionExpression_1).default; } });
25
+ var MemberExpression_1 = require("./MemberExpression");
26
+ Object.defineProperty(exports, "MemberExpression", { enumerable: true, get: function () { return __importDefault(MemberExpression_1).default; } });
27
+ var ChainExpression_1 = require("./ChainExpression");
28
+ Object.defineProperty(exports, "ChainExpression", { enumerable: true, get: function () { return __importDefault(ChainExpression_1).default; } });
@@ -0,0 +1,4 @@
1
+ import { NodeType, default as nodes } from './nodeTypes';
2
+ import Context from '../Context';
3
+ import Node from './Node';
4
+ export { type Node, type NodeType, nodes, Context };
@@ -0,0 +1,10 @@
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.Context = exports.nodes = void 0;
7
+ const nodeTypes_1 = __importDefault(require("./nodeTypes"));
8
+ Object.defineProperty(exports, "nodes", { enumerable: true, get: function () { return nodeTypes_1.default; } });
9
+ const Context_1 = __importDefault(require("../Context"));
10
+ exports.Context = Context_1.default;
@@ -0,0 +1,33 @@
1
+ import { ArrayExpression, ArrowFunctionExpression, BinaryExpression, CallExpression, ChainExpression, ConditionalExpression, ExpressionStatement, LogicalExpression, MemberExpression, ObjectExpression, UnaryExpression } from './expressions';
2
+ import { AnyNode } from 'acorn';
3
+ import type Context from '../Context';
4
+ import Identifier from './Identifier';
5
+ import Literal from './Literal';
6
+ import Node from './Node';
7
+ import Program from './Program';
8
+ import TemplateLiteral from './TemplateLiteral';
9
+ type NodeConstructor = {
10
+ new (node: AnyNode, scope: Context): Node<AnyNode>;
11
+ };
12
+ export type NodeMap = Map<AnyNode['type'], NodeConstructor>;
13
+ declare const nodes: {
14
+ readonly Program: typeof Program;
15
+ readonly Literal: typeof Literal;
16
+ readonly ExpressionStatement: typeof ExpressionStatement;
17
+ readonly ArrayExpression: typeof ArrayExpression;
18
+ readonly ObjectExpression: typeof ObjectExpression;
19
+ readonly Identifier: typeof Identifier;
20
+ readonly BinaryExpression: typeof BinaryExpression;
21
+ readonly UnaryExpression: typeof UnaryExpression;
22
+ readonly LogicalExpression: typeof LogicalExpression;
23
+ readonly ConditionalExpression: typeof ConditionalExpression;
24
+ readonly IfStatement: typeof ConditionalExpression;
25
+ readonly TemplateLiteral: typeof TemplateLiteral;
26
+ readonly ArrowFunctionExpression: typeof ArrowFunctionExpression;
27
+ readonly CallExpression: typeof CallExpression;
28
+ readonly MemberExpression: typeof MemberExpression;
29
+ readonly ChainExpression: typeof ChainExpression;
30
+ };
31
+ export type NodeType = keyof typeof nodes;
32
+ declare const _default: NodeMap;
33
+ export default _default;
@@ -0,0 +1,29 @@
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 expressions_1 = require("./expressions");
7
+ const Identifier_1 = __importDefault(require("./Identifier"));
8
+ const Literal_1 = __importDefault(require("./Literal"));
9
+ const Program_1 = __importDefault(require("./Program"));
10
+ const TemplateLiteral_1 = __importDefault(require("./TemplateLiteral"));
11
+ const nodes = {
12
+ Program: Program_1.default,
13
+ Literal: Literal_1.default,
14
+ ExpressionStatement: expressions_1.ExpressionStatement,
15
+ ArrayExpression: expressions_1.ArrayExpression,
16
+ ObjectExpression: expressions_1.ObjectExpression,
17
+ Identifier: Identifier_1.default,
18
+ BinaryExpression: expressions_1.BinaryExpression,
19
+ UnaryExpression: expressions_1.UnaryExpression,
20
+ LogicalExpression: expressions_1.LogicalExpression,
21
+ ConditionalExpression: expressions_1.ConditionalExpression,
22
+ IfStatement: expressions_1.ConditionalExpression,
23
+ TemplateLiteral: TemplateLiteral_1.default,
24
+ ArrowFunctionExpression: expressions_1.ArrowFunctionExpression,
25
+ CallExpression: expressions_1.CallExpression,
26
+ MemberExpression: expressions_1.MemberExpression,
27
+ ChainExpression: expressions_1.ChainExpression,
28
+ };
29
+ exports.default = new Map(Object.entries(nodes));
@@ -0,0 +1,4 @@
1
+ import { Node } from './nodes';
2
+ import { AnyNode } from 'acorn';
3
+ import Context from './Context';
4
+ export declare function construct(node: AnyNode, context: Context): Node<AnyNode>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.construct = void 0;
4
+ const nodes_1 = require("./nodes");
5
+ function construct(node, context) {
6
+ if (!context.isNodeAllowed(node.type)) {
7
+ throw new Error(`Blacklisted Operation: ${node.type}`);
8
+ }
9
+ const nodeClass = nodes_1.nodes.get(node.type);
10
+ if (!nodeClass) {
11
+ throw new Error(`Unknown node type: ${node.type}`);
12
+ }
13
+ return Reflect.construct(nodeClass, [node, context]);
14
+ }
15
+ exports.construct = construct;
@@ -39,6 +39,8 @@ export default class Connection<Local extends APIDeclaration<Local>, Remote exte
39
39
  * @param args - arguments to pass to remote method
40
40
  */
41
41
  callRemoteMethod<Method extends keyof Remote>(name: Method, ...args: Parameters<Remote[Method]>): Promise<ReturnType<Remote[Method]>>;
42
+ /** Log a message if debug mode is enabled */
43
+ log(...args: unknown[]): void;
42
44
  private onMessageListener;
43
45
  private callLocalMethod;
44
46
  /** Respond to remote call
@@ -62,6 +64,5 @@ export default class Connection<Local extends APIDeclaration<Local>, Remote exte
62
64
  */
63
65
  private popCallback;
64
66
  private postMessage;
65
- private log;
66
67
  }
67
68
  export {};
@@ -45,6 +45,12 @@ class Connection {
45
45
  });
46
46
  });
47
47
  }
48
+ /** Log a message if debug mode is enabled */
49
+ log(...args) {
50
+ if (this.options.debugMode) {
51
+ console.debug(`[${this.name}]`, ...args);
52
+ }
53
+ }
48
54
  onMessageListener(e) {
49
55
  this.log('Received message', e);
50
56
  const { data } = e;
@@ -127,10 +133,5 @@ class Connection {
127
133
  this.log('sending message', { data, targetOrigin });
128
134
  this.postMessageInternal(data, targetOrigin);
129
135
  }
130
- log(...args) {
131
- if (this.options.debugMode) {
132
- console.debug(`[${this.name}]`, ...args);
133
- }
134
- }
135
136
  }
136
137
  exports.default = Connection;
@@ -17,7 +17,10 @@ class Frame {
17
17
  debugMode: isDebugMode,
18
18
  });
19
19
  void this.connection.callRemoteMethod('iframeInitialised');
20
- this.workerManager = new worker_1.default();
20
+ // use roughly half the number of logical cores available clamped between 1 and 6
21
+ const workers = Math.min(Math.max(Math.ceil(navigator.hardwareConcurrency / 2), 1), 6);
22
+ this.connection.log(`Creating ${workers} workers`);
23
+ this.workerManager = new worker_1.default(workers);
21
24
  }
22
25
  async runCode(task) {
23
26
  return this.workerManager.execute(task);
@@ -6,5 +6,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  };
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const worker_source_1 = __importDefault(require("./worker/worker.source"));
9
- const source = `(()=>{"use strict";var e={880:(e,t)=>{var s;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.RESPONSE="response",e.MESSAGE="message"}(s||(s={}));const r={allowedSenderOrigin:void 0,debugMode:!1};t.default=class{constructor(e,t,s,i,o={}){this.callbacks=new Map,this.serviceMethods=new Map,this.name=e,this.options={...r,...o},this.log("Created connection w/ allowedOrigin:",this.options.allowedSenderOrigin),this.serviceMethods=new Map(Object.entries(s));const[n]=crypto.getRandomValues(new Uint32Array(1));this.incrementalID=n,this.postMessageInternal=t,i((e=>this.onMessageListener(e)))}callRemoteMethod(e,...t){return this.log("Calling Remote Method",{name:e,args:t}),new Promise(((r,i)=>{const o=this.registerCallback(r,i);this.postMessage({callId:o,type:s.MESSAGE,methodName:e,arguments:t})}))}onMessageListener(e){this.log("Received message",e);const{data:t}=e,{allowedSenderOrigin:r}=this.options;switch(r&&e.origin!==r&&console.warn(\`Received message from invalid origin: \${e.origin}\`),t.type){case s.RESPONSE:return void this.popCallback(t.callId,t.success,t.result);case s.MESSAGE:this.callLocalMethod(t.methodName,t.arguments).then((e=>this.responseOtherSide(t.callId,e))).catch((e=>this.responseOtherSide(t.callId,e,!1)))}}async callLocalMethod(e,t){this.log("calling local method",e,t);const s=this.serviceMethods.get(e);if(!s)throw new Error(\`service method \${e} not found\`);return s(...t)}responseOtherSide(e,t,r=!0){this.log("responding to remote call",{id:e,result:t,success:r});const i=t=>{this.postMessage({callId:e,type:s.RESPONSE,success:r,result:t})};try{i(t)}catch(e){e instanceof DOMException&&i(JSON.parse(JSON.stringify(t)))}}registerCallback(e,t){const s=(++this.incrementalID).toString();return this.log("registering callback for id",s),this.callbacks.set(s,{success:e,failure:t}),s}popCallback(e,t,s){this.log("calling callback for id",e,{success:t,result:s});const r=this.callbacks.get(e);t?r?.success(s):r?.failure(s),this.callbacks.delete(e)}postMessage(e,t="*"){this.log("sending message",{data:e,targetOrigin:t}),this.postMessageInternal(e,t)}log(...e){this.options.debugMode&&console.debug(\`[\${this.name}]\`,...e)}}},306:function(e,t,s){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(s(880)),o=r(s(54)),n=new class{constructor(){const e=!!window?.debugMode;this.connection=new i.default("FRAME",window.parent.postMessage.bind(window.parent),{startTask:this.runCode.bind(this)},(e=>{window.addEventListener("message",e)}),{debugMode:e}),this.connection.callRemoteMethod("iframeInitialised"),this.workerManager=new o.default}async runCode(e){return this.workerManager.execute(e)}};t.default=n},54:function(e,t,s){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(s(420));t.default=i.default},420:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.messageListeners=new Map,this.worker=this.createWorker()}async execute(e){const t={...e,contextVariable:e.contextVariable??"ctx"},s=this.runTask(t),r=new Promise(((t,s)=>{const r=AbortSignal.timeout(e.timeout);r.addEventListener("abort",(()=>{s(r.reason)}))}));return Promise.race([s,r]).catch((e=>{throw"TimeoutError"===e.name&&this.terminate(),e})).finally((()=>{this.removeMessageListener(e.id)}))}terminate(){for(const e of this.messageListeners.values())this.worker.removeEventListener("message",e);this.worker.terminate(),this.worker=this.createWorker()}runTask(e){return new Promise(((t,s)=>{const r=r=>{const{data:i}=r;i.id===e.id&&(i.success?t(i.result):s(i.result))};this.messageListeners.set(e.id,r),this.worker.addEventListener("message",r),this.worker.postMessage(e)}))}createWorker(){const e=URL.createObjectURL(new Blob(["${worker_source_1.default.replace(/(['`"$])/g, '\\$1')}"],{type:"application/javascript"}));return new Worker(e)}removeMessageListener(e){const t=this.messageListeners.get(e);t&&this.worker.removeEventListener("message",t)}}}},t={};!function s(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,s),o.exports}(306)})();`;
9
+ const source = `(()=>{"use strict";var e;!function(e){e.RESPONSE="response",e.MESSAGE="message"}(e||(e={}));const s={allowedSenderOrigin:void 0,debugMode:!1};class t{constructor(e,t,r,n,o={}){this.callbacks=new Map,this.serviceMethods=new Map,this.name=e,this.options={...s,...o},this.log("Created connection w/ allowedOrigin:",this.options.allowedSenderOrigin),this.serviceMethods=new Map(Object.entries(r));const[i]=crypto.getRandomValues(new Uint32Array(1));this.incrementalID=i,this.postMessageInternal=t,n((e=>this.onMessageListener(e)))}callRemoteMethod(s,...t){return this.log("Calling Remote Method",{name:s,args:t}),new Promise(((r,n)=>{const o=this.registerCallback(r,n);this.postMessage({callId:o,type:e.MESSAGE,methodName:s,arguments:t})}))}log(...e){this.options.debugMode&&console.debug(\`[\${this.name}]\`,...e)}onMessageListener(s){this.log("Received message",s);const{data:t}=s,{allowedSenderOrigin:r}=this.options;switch(r&&s.origin!==r&&console.warn(\`Received message from invalid origin: \${s.origin}\`),t.type){case e.RESPONSE:return void this.popCallback(t.callId,t.success,t.result);case e.MESSAGE:this.callLocalMethod(t.methodName,t.arguments).then((e=>this.responseOtherSide(t.callId,e))).catch((e=>this.responseOtherSide(t.callId,e,!1)))}}async callLocalMethod(e,s){this.log("calling local method",e,s);const t=this.serviceMethods.get(e);if(!t)throw new Error(\`service method \${e} not found\`);return t(...s)}responseOtherSide(s,t,r=!0){this.log("responding to remote call",{id:s,result:t,success:r});const n=t=>{this.postMessage({callId:s,type:e.RESPONSE,success:r,result:t})};try{n(t)}catch(e){e instanceof DOMException&&n(JSON.parse(JSON.stringify(t)))}}registerCallback(e,s){const t=(++this.incrementalID).toString();return this.log("registering callback for id",t),this.callbacks.set(t,{success:e,failure:s}),t}popCallback(e,s,t){this.log("calling callback for id",e,{success:s,result:t});const r=this.callbacks.get(e);s?r?.success(t):r?.failure(t),this.callbacks.delete(e)}postMessage(e,s="*"){this.log("sending message",{data:e,targetOrigin:s}),this.postMessageInternal(e,s)}}new class{constructor(){const e=!!window?.debugMode;this.connection=new t("FRAME",window.parent.postMessage.bind(window.parent),{startTask:this.runCode.bind(this)},(e=>{window.addEventListener("message",e)}),{debugMode:e}),this.connection.callRemoteMethod("iframeInitialised");const s=Math.max(Math.ceil(navigator.hardwareConcurrency/2),1);this.connection.log(\`Creating \${s} workers\`),this.workerManager=new class{constructor(e=1){this.messageListeners=new Map,this.requestedWorkers=e,this.workers=Array.from({length:e},(()=>this.createWorker())),this.nextWorkerGenerator=this.nextWorker()}async execute(e){const s=this.nextWorkerGenerator.next().value,t={...e,contextVariable:e.contextVariable??"ctx"},r=this.runTask(s,t),n=new Promise(((s,t)=>{const r=AbortSignal.timeout(e.timeout);r.addEventListener("abort",(()=>{t(r.reason)}))}));return Promise.race([r,n]).catch((e=>{if("TimeoutError"===e.name)throw this.terminate(s),new DOMException("soft timeout reached","TimeoutError");throw e})).finally((()=>{this.removeMessageListener(e.id)}))}terminate(e){for(const s of this.messageListeners.values())e.removeEventListener("message",s);e.terminate(),this.rebuildWorkers()}runTask(e,s){return new Promise(((t,r)=>{const n=e=>{const{data:n}=e;n.id===s.id&&(n.success?t(n.result):r(n.result))};this.messageListeners.set(s.id,n),e.addEventListener("message",n),e.postMessage(s)}))}createWorker(){const e=URL.createObjectURL(new Blob(["${worker_source_1.default.replace(/(['`"$])/g, '\\$1')}"],{type:"application/javascript"}));return new Worker(e)}rebuildWorkers(){const e=this.requestedWorkers-this.workers.length;if(e<0)throw new Error("Cannot have less than 0 workers");if(e<=0)return;const s=Array.from({length:e},(()=>this.createWorker()));this.workers.push(...s)}*nextWorker(){let e=0;for(;;)e=(e+1)%this.workers.length,yield this.workers[e]}removeMessageListener(e){const s=this.messageListeners.get(e);s&&(this.workers.forEach((e=>e.removeEventListener("message",s))),this.messageListeners.delete(e))}}(s)}async runCode(e){return this.workerManager.execute(e)}}})();`;
10
10
  exports.default = source;
@@ -1,11 +1,15 @@
1
1
  import { Task } from '../../types';
2
2
  export default class Manager {
3
- private worker;
4
- private messageListeners;
5
- constructor();
3
+ private readonly requestedWorkers;
4
+ private readonly workers;
5
+ private nextWorkerIndex;
6
+ private readonly messageListeners;
7
+ constructor(workers?: number);
6
8
  execute(task: Task): Promise<unknown>;
7
- terminate(): void;
9
+ private terminate;
8
10
  private runTask;
9
11
  private createWorker;
12
+ private rebuildWorkers;
13
+ private getWorker;
10
14
  private removeMessageListener;
11
15
  }
@@ -3,16 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // this token (__WORKER_SOURCE__) is replaced by webpack with the source of the worker
4
4
  const WORKER_SOURCE = '__WORKER_SOURCE__';
5
5
  class Manager {
6
- constructor() {
6
+ constructor(workers = 1) {
7
+ this.nextWorkerIndex = 0;
7
8
  this.messageListeners = new Map();
8
- this.worker = this.createWorker();
9
+ this.requestedWorkers = workers;
10
+ this.workers = Array.from({ length: workers }, () => this.createWorker());
9
11
  }
10
12
  async execute(task) {
13
+ const worker = this.getWorker();
11
14
  const workerTask = {
12
15
  ...task,
13
16
  contextVariable: task.contextVariable ?? 'ctx',
14
17
  };
15
- const result = this.runTask(workerTask);
18
+ const result = this.runTask(worker, workerTask);
16
19
  const timeout = new Promise((_, reject) => {
17
20
  const signal = AbortSignal.timeout(task.timeout);
18
21
  signal.addEventListener('abort', () => {
@@ -22,7 +25,8 @@ class Manager {
22
25
  return Promise.race([result, timeout])
23
26
  .catch((e) => {
24
27
  if (e.name === 'TimeoutError') {
25
- this.terminate();
28
+ this.terminate(worker);
29
+ throw new DOMException('soft timeout reached', 'TimeoutError');
26
30
  }
27
31
  throw e;
28
32
  })
@@ -30,14 +34,14 @@ class Manager {
30
34
  this.removeMessageListener(task.id);
31
35
  });
32
36
  }
33
- terminate() {
37
+ terminate(worker) {
34
38
  for (const listener of this.messageListeners.values()) {
35
- this.worker.removeEventListener('message', listener);
39
+ worker.removeEventListener('message', listener);
36
40
  }
37
- this.worker.terminate();
38
- this.worker = this.createWorker();
41
+ worker.terminate();
42
+ this.rebuildWorkers();
39
43
  }
40
- runTask(task) {
44
+ runTask(worker, task) {
41
45
  return new Promise((resolve, reject) => {
42
46
  const listener = (event) => {
43
47
  const { data } = event;
@@ -51,20 +55,34 @@ class Manager {
51
55
  }
52
56
  };
53
57
  this.messageListeners.set(task.id, listener);
54
- this.worker.addEventListener('message', listener);
55
- this.worker.postMessage(task);
58
+ worker.addEventListener('message', listener);
59
+ worker.postMessage(task);
56
60
  });
57
61
  }
58
62
  createWorker() {
59
63
  const blob = URL.createObjectURL(new Blob([WORKER_SOURCE], { type: 'application/javascript' }));
60
64
  return new Worker(blob);
61
65
  }
66
+ rebuildWorkers() {
67
+ const needed = this.requestedWorkers - this.workers.length;
68
+ if (needed < 0)
69
+ throw new Error('Cannot have less than 0 workers');
70
+ if (needed <= 0)
71
+ return;
72
+ const newWorkers = Array.from({ length: needed }, () => this.createWorker());
73
+ this.workers.push(...newWorkers);
74
+ }
75
+ getWorker() {
76
+ const worker = this.workers[this.nextWorkerIndex];
77
+ this.nextWorkerIndex = (this.nextWorkerIndex + 1) % this.workers.length;
78
+ return worker;
79
+ }
62
80
  removeMessageListener(id) {
63
81
  const listener = this.messageListeners.get(id);
64
- if (!listener) {
82
+ if (!listener)
65
83
  return;
66
- }
67
- this.worker.removeEventListener('message', listener);
84
+ this.workers.forEach((worker) => worker.removeEventListener('message', listener));
85
+ this.messageListeners.delete(id);
68
86
  }
69
87
  }
70
88
  exports.default = Manager;
@@ -2,5 +2,5 @@
2
2
  // Auto-generated file
3
3
  /* eslint-disable */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- const source = `(()=>{"use strict";(()=>{const e=["TEMPORARY","PERSISTENT","console","self","onmessage","postMessage","global","allowed","Array","Boolean","Date","Function","Number","Object","RegExp","String","Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","isFinite","isNaN","parseFloat","parseInt","Infinity","JSON","Math","NaN","undefined"];[...Object.getOwnPropertyNames(self),...Object.getOwnPropertyNames(self.__proto__)].forEach((r=>{e.includes(r)||Object.defineProperty(self,r,{get:()=>{throw new Error(\`Security Exception: cannot access \${r}\`)},set:()=>{throw new Error(\`Security Exception: cannot set \${r}\`)},configurable:!1})})),onmessage=e=>{let r,t=!0;try{r=Function(e.data.contextVariable,\`"use strict";return (\${e.data.code});\`)(e.data.context)}catch(e){r=e,t=!1}const o={id:e.data.id,result:r,success:t};postMessage(o)}})()})();`;
5
+ const source = `(()=>{"use strict";const e=["TEMPORARY","PERSISTENT","console","self","onmessage","postMessage","global","allowed","Array","Boolean","Date","Function","Number","Object","RegExp","String","Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","isFinite","isNaN","parseFloat","parseInt","Infinity","JSON","Math","NaN","undefined"];[...Object.getOwnPropertyNames(self),...Object.getOwnPropertyNames(self.__proto__)].forEach((r=>{e.includes(r)||Object.defineProperty(self,r,{get:()=>{throw new Error(\`Security Exception: cannot access \${r}\`)},set:()=>{throw new Error(\`Security Exception: cannot set \${r}\`)},configurable:!1})})),onmessage=e=>{let r,t=!0;try{r=Function(e.data.contextVariable,\`"use strict";return (\${e.data.code});\`)(e.data.context)}catch(e){r=e,t=!1}const o={id:e.data.id,result:r,success:t};postMessage(o)}})();`;
6
6
  exports.default = source;
@@ -44,7 +44,7 @@ export default class WebSandbox {
44
44
  *
45
45
  * This will remove the iframe from the DOM and remove the message listener.
46
46
  */
47
- destroy(): void;
47
+ destroy(reason?: unknown): void;
48
48
  private initialise;
49
49
  private validateOptions;
50
50
  private destroyAndRebuild;
@@ -35,8 +35,8 @@ class WebSandbox {
35
35
  this.initialised = this.initialise();
36
36
  this.frameAbortController = new AbortController();
37
37
  if (options.abortSignal) {
38
- this.promisifyAbortSignal(options.abortSignal).catch(() => {
39
- void this.destroyAndRebuild(this.frame.id);
38
+ this.promisifyAbortSignal(options.abortSignal).catch((reason) => {
39
+ void this.destroyAndRebuild(this.frame.id, reason);
40
40
  });
41
41
  }
42
42
  }
@@ -51,8 +51,8 @@ class WebSandbox {
51
51
  *
52
52
  * This will remove the iframe from the DOM and remove the message listener.
53
53
  */
54
- destroy() {
55
- this.frameAbortController.abort();
54
+ destroy(reason) {
55
+ this.frameAbortController.abort(reason);
56
56
  this.frame.remove();
57
57
  this.removeMessageListener();
58
58
  }
@@ -85,11 +85,11 @@ class WebSandbox {
85
85
  throw new Error('maximum timeout must be less than or equal to 5000ms');
86
86
  }
87
87
  }
88
- async destroyAndRebuild(frameId) {
88
+ async destroyAndRebuild(frameId, reason) {
89
89
  if (this.frame.id !== frameId) {
90
90
  return;
91
91
  }
92
- this.destroy();
92
+ this.destroy(reason);
93
93
  this.frame = this.createFrame();
94
94
  this.frameAbortController = new AbortController();
95
95
  await this.initialise();
@@ -123,7 +123,7 @@ class WebSandbox {
123
123
  const signals = [task, timeout, frameAbortedSignal, userAbortedSignal].filter((i) => i !== null);
124
124
  return Promise.race(signals).catch(async (e) => {
125
125
  if (e.name === 'TimeoutError') {
126
- await this.destroyAndRebuild(frameId);
126
+ await this.destroyAndRebuild(frameId, 'task timed out');
127
127
  }
128
128
  throw e;
129
129
  });
@@ -0,0 +1,10 @@
1
+ export declare enum ConnectionStatus {
2
+ CONNECTED = "CONNECTED",
3
+ DISCONNECTED = "DISCONNECTED"
4
+ }
5
+ export interface IConnectedCallsign {
6
+ status: ConnectionStatus;
7
+ details: {
8
+ duration: number;
9
+ };
10
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionStatus = void 0;
4
+ var ConnectionStatus;
5
+ (function (ConnectionStatus) {
6
+ ConnectionStatus["CONNECTED"] = "CONNECTED";
7
+ ConnectionStatus["DISCONNECTED"] = "DISCONNECTED";
8
+ })(ConnectionStatus || (exports.ConnectionStatus = ConnectionStatus = {}));
@@ -24,6 +24,9 @@ export declare const errorCodes: {
24
24
  MAPS_SERVICE_ERROR: string;
25
25
  EVALUATOR_SERVICE_ERROR: string;
26
26
  WEBRTC_SERVICE_ERROR: string;
27
+ DEVICE_CREDENTIALS_SERVICE_ERROR: string;
28
+ TARGET_SERVICE_ERROR: string;
29
+ ENVIRONMENT_SERVICE_ERROR: string;
27
30
  };
28
31
  export declare class RocosError extends Error {
29
32
  code?: string;
@@ -27,6 +27,9 @@ exports.errorCodes = {
27
27
  MAPS_SERVICE_ERROR: 'MAPS_SERVICE_ERROR',
28
28
  EVALUATOR_SERVICE_ERROR: 'EVALUATOR_SERVICE_ERROR',
29
29
  WEBRTC_SERVICE_ERROR: 'WEBRTC_SERVICE_ERROR',
30
+ DEVICE_CREDENTIALS_SERVICE_ERROR: 'DEVICE_CREDENTIALS_SERVICE_ERROR',
31
+ TARGET_SERVICE_ERROR: 'TARGET_SERVICE_ERROR',
32
+ ENVIRONMENT_SERVICE_ERROR: 'ENVIRONMENT_SERVICE_ERROR',
30
33
  };
31
34
  class RocosError extends Error {
32
35
  constructor(err, code, statusCode) {
@@ -1,28 +1,31 @@
1
1
  export declare enum ServiceEnum {
2
+ ASSET_STORAGE = "asset_storage",
2
3
  AUTH = "auth",
3
- TELEMETRY = "telemetry",
4
- ROBOT = "robot",
5
- EVENT = "event",
6
- PROJECT = "project",
7
4
  CALLER = "caller",
8
5
  COMMAND = "command",
9
- CONTROL = "control",
10
- SEARCH = "search",
11
6
  CONFIG_GROUP = "config_group",
7
+ CONTROL = "control",
12
8
  DASHBOARD = "dashboard",
9
+ DEVICE_CREDENTIALS = "device_credentials",
10
+ ENVIRONMENT = "environment",
11
+ EVENT = "event",
12
+ EVALUATOR = "evaluator",
13
+ FILE_ACCESSOR = "file_accessor",
13
14
  FUNCTION = "function",
14
- STREAM = "stream",
15
- USER = "user",
16
- TIME_SYNCER = "time_syncer",
17
- WORKFLOW = "workflow",
18
- ASSET_STORAGE = "asset_storage",
15
+ INTEGRATION = "integration",
16
+ MAP = "map",
17
+ PROJECT = "project",
19
18
  PROFILE = "profile",
20
- WEBRTC_SIGNALLING = "webrtc_signalling",
21
- FILE_ACCESSOR = "file_accessor",
19
+ ROBOT = "robot",
20
+ RTP_WEBRTC = "rtp_webrtc",
22
21
  SCHEDULE = "schedule",
22
+ SEARCH = "search",
23
23
  SPOT_PROVISIONER = "spot_provisioner",
24
- INTEGRATION = "integration",
25
- MAP = "map",
26
- EVALUATOR = "evaluator",
27
- RTP_WEBRTC = "rtp_webrtc"
24
+ STREAM = "stream",
25
+ TARGET = "target",
26
+ TELEMETRY = "telemetry",
27
+ TIME_SYNCER = "time_syncer",
28
+ USER = "user",
29
+ WEBRTC_SIGNALLING = "webrtc_signalling",
30
+ WORKFLOW = "workflow"
28
31
  }
@@ -3,30 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ServiceEnum = void 0;
4
4
  var ServiceEnum;
5
5
  (function (ServiceEnum) {
6
+ ServiceEnum["ASSET_STORAGE"] = "asset_storage";
6
7
  ServiceEnum["AUTH"] = "auth";
7
- ServiceEnum["TELEMETRY"] = "telemetry";
8
- ServiceEnum["ROBOT"] = "robot";
9
- ServiceEnum["EVENT"] = "event";
10
- ServiceEnum["PROJECT"] = "project";
11
8
  ServiceEnum["CALLER"] = "caller";
12
9
  ServiceEnum["COMMAND"] = "command";
13
- ServiceEnum["CONTROL"] = "control";
14
- ServiceEnum["SEARCH"] = "search";
15
10
  ServiceEnum["CONFIG_GROUP"] = "config_group";
11
+ ServiceEnum["CONTROL"] = "control";
16
12
  ServiceEnum["DASHBOARD"] = "dashboard";
17
- ServiceEnum["FUNCTION"] = "function";
18
- ServiceEnum["STREAM"] = "stream";
19
- ServiceEnum["USER"] = "user";
20
- ServiceEnum["TIME_SYNCER"] = "time_syncer";
21
- ServiceEnum["WORKFLOW"] = "workflow";
22
- ServiceEnum["ASSET_STORAGE"] = "asset_storage";
23
- ServiceEnum["PROFILE"] = "profile";
24
- ServiceEnum["WEBRTC_SIGNALLING"] = "webrtc_signalling";
13
+ ServiceEnum["DEVICE_CREDENTIALS"] = "device_credentials";
14
+ ServiceEnum["ENVIRONMENT"] = "environment";
15
+ ServiceEnum["EVENT"] = "event";
16
+ ServiceEnum["EVALUATOR"] = "evaluator";
25
17
  ServiceEnum["FILE_ACCESSOR"] = "file_accessor";
26
- ServiceEnum["SCHEDULE"] = "schedule";
27
- ServiceEnum["SPOT_PROVISIONER"] = "spot_provisioner";
18
+ ServiceEnum["FUNCTION"] = "function";
28
19
  ServiceEnum["INTEGRATION"] = "integration";
29
20
  ServiceEnum["MAP"] = "map";
30
- ServiceEnum["EVALUATOR"] = "evaluator";
21
+ ServiceEnum["PROJECT"] = "project";
22
+ ServiceEnum["PROFILE"] = "profile";
23
+ ServiceEnum["ROBOT"] = "robot";
31
24
  ServiceEnum["RTP_WEBRTC"] = "rtp_webrtc";
25
+ ServiceEnum["SCHEDULE"] = "schedule";
26
+ ServiceEnum["SEARCH"] = "search";
27
+ ServiceEnum["SPOT_PROVISIONER"] = "spot_provisioner";
28
+ ServiceEnum["STREAM"] = "stream";
29
+ ServiceEnum["TARGET"] = "target";
30
+ ServiceEnum["TELEMETRY"] = "telemetry";
31
+ ServiceEnum["TIME_SYNCER"] = "time_syncer";
32
+ ServiceEnum["USER"] = "user";
33
+ ServiceEnum["WEBRTC_SIGNALLING"] = "webrtc_signalling";
34
+ ServiceEnum["WORKFLOW"] = "workflow";
32
35
  })(ServiceEnum || (exports.ServiceEnum = ServiceEnum = {}));
@@ -0,0 +1,12 @@
1
+ export declare enum TelemetryMonitorStatus {
2
+ UNKNOWN = "unknown",
3
+ CONNECTED = "connected",
4
+ DISCONNECTED = "disconnected",
5
+ ERROR = "error"
6
+ }
7
+ export declare enum CallsignStatus {
8
+ UNKNOWN = "unknown",
9
+ ONLINE = "online",
10
+ OFFLINE = "offline",
11
+ ERROR = "error"
12
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CallsignStatus = exports.TelemetryMonitorStatus = void 0;
4
+ var TelemetryMonitorStatus;
5
+ (function (TelemetryMonitorStatus) {
6
+ TelemetryMonitorStatus["UNKNOWN"] = "unknown";
7
+ TelemetryMonitorStatus["CONNECTED"] = "connected";
8
+ TelemetryMonitorStatus["DISCONNECTED"] = "disconnected";
9
+ TelemetryMonitorStatus["ERROR"] = "error";
10
+ })(TelemetryMonitorStatus || (exports.TelemetryMonitorStatus = TelemetryMonitorStatus = {}));
11
+ var CallsignStatus;
12
+ (function (CallsignStatus) {
13
+ CallsignStatus["UNKNOWN"] = "unknown";
14
+ CallsignStatus["ONLINE"] = "online";
15
+ CallsignStatus["OFFLINE"] = "offline";
16
+ CallsignStatus["ERROR"] = "error";
17
+ })(CallsignStatus || (exports.CallsignStatus = CallsignStatus = {}));