@wandelbots/nova-js 3.3.2 → 3.3.3
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/dist/{LoginWithAuth0-wQB-Sol1.mjs → LoginWithAuth0-DBe9CXOr.mjs} +97 -13
- package/dist/LoginWithAuth0-DBe9CXOr.mjs.map +1 -0
- package/dist/{LoginWithAuth0-CBD9BXXz.cjs → LoginWithAuth0-iXpPiCcz.cjs} +162 -12
- package/dist/LoginWithAuth0-iXpPiCcz.cjs.map +1 -0
- package/dist/{NovaClient-qJnHcx2s.d.mts → NovaClient-C0GXOu4w.d.mts} +2 -1
- package/dist/{NovaClient-CV7ooIkD.d.cts.map → NovaClient-C0GXOu4w.d.mts.map} +1 -1
- package/dist/{NovaClient-B8XM3OPO.mjs → NovaClient-C27dk3Ql.mjs} +12 -64
- package/dist/NovaClient-C27dk3Ql.mjs.map +1 -0
- package/dist/{NovaClient-CV7ooIkD.d.cts → NovaClient-PNinV5c4.d.cts} +2 -1
- package/dist/{NovaClient-qJnHcx2s.d.mts.map → NovaClient-PNinV5c4.d.cts.map} +1 -1
- package/dist/{NovaClient-D2EItmiH.cjs → NovaClient-j40sHBBq.cjs} +20 -114
- package/dist/NovaClient-j40sHBBq.cjs.map +1 -0
- package/dist/index.cjs +14 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +34 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/lib/v1/index.cjs +3 -3
- package/dist/lib/v1/index.cjs.map +1 -1
- package/dist/lib/v1/index.d.cts +1 -1
- package/dist/lib/v1/index.d.mts +1 -1
- package/dist/lib/v1/index.mjs +2 -2
- package/dist/lib/v2/index.cjs +11 -10
- package/dist/lib/v2/index.cjs.map +1 -1
- package/dist/lib/v2/index.d.cts +1 -0
- package/dist/lib/v2/index.d.cts.map +1 -1
- package/dist/lib/v2/index.d.mts +1 -0
- package/dist/lib/v2/index.d.mts.map +1 -1
- package/dist/lib/v2/index.mjs +11 -10
- package/dist/lib/v2/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/LoginWithAuth0.ts +13 -15
- package/src/lib/converters.ts +61 -0
- package/src/lib/v1/NovaClient.ts +14 -15
- package/src/lib/v2/NovaClient.ts +15 -16
- package/dist/LoginWithAuth0-CBD9BXXz.cjs.map +0 -1
- package/dist/LoginWithAuth0-wQB-Sol1.mjs.map +0 -1
- package/dist/NovaClient-B8XM3OPO.mjs.map +0 -1
- package/dist/NovaClient-D2EItmiH.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NovaClient-j40sHBBq.cjs","names":["MOTION_DELTA_THRESHOLD","tryParseJson","nova: NovaClient","controller: ControllerInstance","motionGroup: MotionGroupPhysical","initialMotionState: MotionGroupStateResponse","motionStateSocket: AutoReconnectingWebsocket","isVirtual: boolean","tcps: RobotTcp[]","motionGroupSpecification: MotionGroupSpecification","safetySetup: SafetySetup","mounting: Mounting | null","initialControllerState: RobotControllerState","controllerStateSocket: AutoReconnectingWebsocket","THREE","motionStream: MotionStreamConnection","opts: JoggerConnectionOpts","tryParseJson","commands: Command[]","isSameCoordinateSystem","Vector3","jointVelocityLimits: number[]","Vector3","tryParseJson","nova: NovaClient","controller: ControllerInstance","motionGroup: MotionGroupPhysical","initialMotionState: MotionGroupStateResponse","motionStateSocket: AutoReconnectingWebsocket","cellId: string","opts: BaseConfiguration & {\n axiosInstance?: AxiosInstance\n mock?: boolean\n }","SystemApi","CellApi","DeviceConfigurationApi","MotionGroupApi","MotionGroupInfosApi","ControllerApi","ProgramApi","ProgramValuesApi","ControllerIOsApi","MotionGroupKinematicApi","MotionApi","CoordinateSystemsApi","ApplicationApi","MotionGroupJoggingApi","VirtualRobotApi","VirtualRobotSetupApi","VirtualRobotModeApi","VirtualRobotBehaviorApi","LibraryProgramMetadataApi","LibraryProgramApi","LibraryRecipeMetadataApi","LibraryRecipeApi","StoreObjectApi","StoreCollisionComponentsApi","StoreCollisionScenesApi","pathToRegexp","AxiosError","availableStorage","parseNovaInstanceUrl","config","loginWithAuth0","AutoReconnectingWebsocket"],"sources":["../src/lib/v1/wandelscriptUtils.ts","../src/lib/v1/motionStateUpdate.ts","../src/lib/v1/ConnectedMotionGroup.ts","../src/lib/v1/JoggerConnection.ts","../src/lib/v1/MotionStreamConnection.ts","../src/lib/v1/NovaCellAPIClient.ts","../src/lib/v1/mock/MockNovaInstance.ts","../src/lib/v1/NovaClient.ts"],"sourcesContent":["import type { Pose } from \"@wandelbots/nova-api/v1\"\n\n/**\n * Convert a Pose object representing a motion group position\n * into a string which represents that pose in Wandelscript.\n */\nexport function poseToWandelscriptString(\n pose: Pick<Pose, \"position\" | \"orientation\">,\n) {\n const position = [pose.position.x, pose.position.y, pose.position.z]\n const orientation = [\n pose.orientation?.x ?? 0,\n pose.orientation?.y ?? 0,\n pose.orientation?.z ?? 0,\n ]\n\n const positionValues = position.map((v) => v.toFixed(1))\n // Rotation needs more precision since it's in radians\n const rotationValues = orientation.map((v) => v.toFixed(4))\n\n return `(${positionValues.concat(rotationValues).join(\", \")})`\n}\n","import type { TcpPose } from \"@wandelbots/nova-api/v1\"\n\nexport function jointValuesEqual(\n oldJointValues: number[],\n newJointValues: number[],\n changeDeltaThreshold: number,\n): boolean {\n if (newJointValues.length !== oldJointValues.length) {\n return true\n }\n\n for (let jointIndex = 0; jointIndex < newJointValues.length; jointIndex++) {\n if (\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n Math.abs(newJointValues[jointIndex]! - oldJointValues[jointIndex]!) >\n changeDeltaThreshold\n ) {\n return false\n }\n }\n\n return true\n}\n\nexport function tcpPoseEqual(\n oldTcp: TcpPose | undefined,\n newTcp: TcpPose | undefined,\n changeDeltaThreshold: number,\n): boolean {\n // undefined -> defined (+reverse) transition\n if ((oldTcp === undefined && newTcp) || (oldTcp && newTcp === undefined)) {\n return false\n }\n\n // the typechecker cannot resolve states to \"!= undefined\" if \"&&\" is used\n if (oldTcp === undefined || newTcp === undefined) {\n return true\n }\n\n let changedDelta = 0\n changedDelta += Math.abs(oldTcp.orientation.x - newTcp.orientation.x)\n changedDelta += Math.abs(oldTcp.orientation.y - newTcp.orientation.y)\n changedDelta += Math.abs(oldTcp.orientation.z - newTcp.orientation.z)\n changedDelta += Math.abs(oldTcp.position.x - newTcp.position.x)\n changedDelta += Math.abs(oldTcp.position.y - newTcp.position.y)\n changedDelta += Math.abs(oldTcp.position.z - newTcp.position.z)\n\n if (changedDelta > changeDeltaThreshold) {\n return false\n }\n\n return (\n oldTcp.coordinate_system === newTcp.coordinate_system &&\n oldTcp.tcp === newTcp.tcp\n )\n}\n","import type {\n ControllerInstance,\n MotionGroupPhysical,\n MotionGroupSpecification,\n MotionGroupStateResponse,\n Mounting,\n RobotControllerState,\n RobotControllerStateOperationModeEnum,\n RobotControllerStateSafetyStateEnum,\n RobotTcp,\n SafetySetup,\n} from \"@wandelbots/nova-api/v1\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport * as THREE from \"three\"\nimport type { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../converters\"\nimport { jointValuesEqual, tcpPoseEqual } from \"./motionStateUpdate\"\nimport type { NovaClient } from \"./NovaClient\"\n\nconst MOTION_DELTA_THRESHOLD = 0.0001\n\nexport type MotionGroupOption = {\n selectionId: string\n} & MotionGroupPhysical\n\n/**\n * Store representing the current state of a connected motion group.\n */\nexport class ConnectedMotionGroup {\n static async connect(\n nova: NovaClient,\n motionGroupId: string,\n controllers: ControllerInstance[],\n ) {\n const [_motionGroupIndex, controllerId] = motionGroupId.split(\"@\") as [\n string,\n string,\n ]\n const controller = controllers.find((c) => c.controller === controllerId)\n const motionGroup = controller?.physical_motion_groups.find(\n (mg) => mg.motion_group === motionGroupId,\n )\n if (!controller || !motionGroup) {\n throw new Error(\n `Controller ${controllerId} or motion group ${motionGroupId} not found`,\n )\n }\n\n const motionStateSocket = nova.openReconnectingWebsocket(\n `/motion-groups/${motionGroupId}/state-stream`,\n )\n\n // Wait for the first message to get the initial state\n const firstMessage = await motionStateSocket.firstMessage()\n const initialMotionState = tryParseJson(firstMessage.data)\n ?.result as MotionGroupStateResponse\n\n if (!initialMotionState) {\n throw new Error(\n `Unable to parse initial motion state message ${firstMessage.data}`,\n )\n }\n\n console.log(\n `Connected motion state websocket to motion group ${motionGroup.motion_group}. Initial state:\\n `,\n initialMotionState,\n )\n\n // Check if robot is virtual or physical\n const config = await nova.api.controller.getRobotController(\n controller.controller,\n )\n const isVirtual = config.configuration.kind === \"VirtualController\"\n\n // If there's a configured mounting, we need it to show the right\n // position of the robot model\n const mounting = await (async () => {\n try {\n const mounting = await nova.api.motionGroupInfos.getMounting(\n motionGroup.motion_group,\n )\n return mounting\n } catch (err) {\n console.error(\n `Error fetching mounting for ${motionGroup.motion_group}`,\n err,\n )\n return null\n }\n })()\n\n // Open the websocket to monitor controller state for e.g. e-stop\n const controllerStateSocket = nova.openReconnectingWebsocket(\n `/controllers/${controller.controller}/state-stream?response_rate=1000`,\n )\n\n // Wait for the first message to get the initial state\n const firstControllerMessage = await controllerStateSocket.firstMessage()\n const initialControllerState = tryParseJson(firstControllerMessage.data)\n ?.result as RobotControllerState\n\n if (!initialControllerState) {\n throw new Error(\n `Unable to parse initial controller state message ${firstControllerMessage.data}`,\n )\n }\n\n console.log(\n `Connected controller state websocket to controller ${controller.controller}. Initial state:\\n `,\n initialControllerState,\n )\n\n // Find out what TCPs this motion group has (we need it for jogging)\n const { tcps } = await nova.api.motionGroupInfos.listTcps(motionGroupId)\n\n const motionGroupSpecification =\n await nova.api.motionGroupInfos.getMotionGroupSpecification(motionGroupId)\n\n const safetySetup =\n await nova.api.motionGroupInfos.getSafetySetup(motionGroupId)\n\n return new ConnectedMotionGroup(\n nova,\n controller,\n motionGroup,\n initialMotionState,\n motionStateSocket,\n isVirtual,\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n tcps!,\n motionGroupSpecification,\n safetySetup,\n mounting,\n initialControllerState,\n controllerStateSocket,\n )\n }\n\n connectedJoggingCartesianSocket: WebSocket | null = null\n connectedJoggingJointsSocket: WebSocket | null = null\n // biome-ignore lint/suspicious/noExplicitAny: legacy code\n planData: any | null // tmp\n joggingVelocity: number = 10\n\n // Not mobx-observable as this changes very fast; should be observed\n // using animation frames\n rapidlyChangingMotionState: MotionGroupStateResponse\n\n // Response rate on the websocket should be a bit slower on this one since\n // we don't use the motion data\n controllerState: RobotControllerState\n\n /**\n * Reflects activation state of the motion group / robot servos. The\n * movement controls in the UI should only be enabled in the \"active\" state\n */\n activationState: \"inactive\" | \"activating\" | \"deactivating\" | \"active\" =\n \"inactive\"\n\n constructor(\n readonly nova: NovaClient,\n readonly controller: ControllerInstance,\n readonly motionGroup: MotionGroupPhysical,\n readonly initialMotionState: MotionGroupStateResponse,\n readonly motionStateSocket: AutoReconnectingWebsocket,\n readonly isVirtual: boolean,\n readonly tcps: RobotTcp[],\n readonly motionGroupSpecification: MotionGroupSpecification,\n readonly safetySetup: SafetySetup,\n readonly mounting: Mounting | null,\n readonly initialControllerState: RobotControllerState,\n readonly controllerStateSocket: AutoReconnectingWebsocket,\n ) {\n this.rapidlyChangingMotionState = initialMotionState\n this.controllerState = initialControllerState\n\n // Track controller state updates (e.g. safety state and operation mode)\n controllerStateSocket.addEventListener(\"message\", (event) => {\n const data = tryParseJson(event.data)?.result\n\n if (!data) {\n return\n }\n\n runInAction(() => {\n this.controllerState = data\n })\n })\n\n motionStateSocket.addEventListener(\"message\", (event) => {\n const motionStateResponse = tryParseJson(event.data)?.result as\n | MotionGroupStateResponse\n | undefined\n\n if (!motionStateResponse) {\n throw new Error(\n `Failed to get motion state for ${this.motionGroupId}: ${event.data}`,\n )\n }\n\n // handle motionState message\n if (\n !jointValuesEqual(\n this.rapidlyChangingMotionState.state.joint_position.joints,\n motionStateResponse.state.joint_position.joints,\n MOTION_DELTA_THRESHOLD,\n )\n ) {\n runInAction(() => {\n this.rapidlyChangingMotionState.state = motionStateResponse.state\n })\n }\n\n // handle tcpPose message\n if (\n !tcpPoseEqual(\n this.rapidlyChangingMotionState.tcp_pose,\n motionStateResponse.tcp_pose,\n MOTION_DELTA_THRESHOLD,\n )\n ) {\n runInAction(() => {\n this.rapidlyChangingMotionState.tcp_pose =\n motionStateResponse.tcp_pose\n })\n }\n })\n makeAutoObservable(this)\n }\n\n get motionGroupId() {\n return this.motionGroup.motion_group\n }\n\n get controllerId() {\n return this.controller.controller\n }\n\n get modelFromController() {\n return this.motionGroup.model_from_controller\n }\n\n get wandelscriptIdentifier() {\n const num = this.motionGroupId.split(\"@\")[0]\n return `${this.controllerId.replaceAll(\"-\", \"_\")}_${num}`\n }\n\n /** Jogging velocity in radians for rotation and joint movement */\n get joggingVelocityRads() {\n return (this.joggingVelocity * Math.PI) / 180\n }\n\n get joints() {\n return this.initialMotionState.state.joint_position.joints.map((_, i) => {\n return {\n index: i,\n }\n })\n }\n\n get dhParameters() {\n return this.motionGroupSpecification.dh_parameters\n }\n\n get safetyZones() {\n return this.safetySetup.safety_zones\n }\n\n /** Gets the robot mounting position offset in 3D viz coordinates */\n get mountingPosition(): [number, number, number] {\n if (!this.mounting) {\n return [0, 0, 0]\n }\n\n return [\n this.mounting.pose.position.x / 1000,\n this.mounting.pose.position.y / 1000,\n this.mounting.pose.position.z / 1000,\n ]\n }\n\n /** Gets the robot mounting position rotation in 3D viz coordinates */\n get mountingQuaternion() {\n const rotationVector = new THREE.Vector3(\n this.mounting?.pose.orientation?.x || 0,\n this.mounting?.pose.orientation?.y || 0,\n this.mounting?.pose.orientation?.z || 0,\n )\n\n const magnitude = rotationVector.length()\n const axis = rotationVector.normalize()\n\n return new THREE.Quaternion().setFromAxisAngle(axis, magnitude)\n }\n\n /**\n * Whether the controller is currently in a safety state\n * corresponding to an emergency stop\n */\n get isEstopActive() {\n const estopStates: RobotControllerStateSafetyStateEnum[] = [\n \"SAFETY_STATE_ROBOT_EMERGENCY_STOP\",\n \"SAFETY_STATE_DEVICE_EMERGENCY_STOP\",\n ]\n\n return estopStates.includes(this.controllerState.safety_state)\n }\n\n /**\n * Whether the controller is in a safety state\n * that may be non-functional for robot pad purposes\n */\n get isMoveableSafetyState() {\n const goodSafetyStates: RobotControllerStateSafetyStateEnum[] = [\n \"SAFETY_STATE_NORMAL\",\n \"SAFETY_STATE_REDUCED\",\n ]\n\n return goodSafetyStates.includes(this.controllerState.safety_state)\n }\n\n /**\n * Whether the controller is in an operation mode that allows movement\n */\n get isMoveableOperationMode() {\n const goodOperationModes: RobotControllerStateOperationModeEnum[] = [\n \"OPERATION_MODE_AUTO\",\n \"OPERATION_MODE_MANUAL\",\n \"OPERATION_MODE_MANUAL_T1\",\n \"OPERATION_MODE_MANUAL_T2\",\n ]\n\n return goodOperationModes.includes(this.controllerState.operation_mode)\n }\n\n /**\n * Whether the robot is currently active and can be moved, based on the\n * safety state, operation mode and servo toggle activation state.\n */\n get canBeMoved() {\n return (\n this.isMoveableSafetyState &&\n this.isMoveableOperationMode &&\n this.activationState === \"active\"\n )\n }\n\n async deactivate() {\n if (this.activationState !== \"active\") {\n console.error(\"Tried to deactivate while already deactivating\")\n return\n }\n\n runInAction(() => {\n this.activationState = \"deactivating\"\n })\n\n try {\n await this.nova.api.controller.setDefaultMode(\n this.controllerId,\n \"MODE_MONITOR\",\n )\n\n runInAction(() => {\n this.activationState = \"inactive\"\n })\n } catch (err) {\n runInAction(() => {\n this.activationState = \"active\"\n })\n throw err\n }\n }\n\n async activate() {\n if (this.activationState !== \"inactive\") {\n console.error(\"Tried to activate while already activating\")\n return\n }\n\n runInAction(() => {\n this.activationState = \"activating\"\n })\n\n try {\n await this.nova.api.controller.setDefaultMode(\n this.controllerId,\n \"MODE_CONTROL\",\n )\n\n runInAction(() => {\n this.activationState = \"active\"\n })\n } catch (err) {\n runInAction(() => {\n this.activationState = \"inactive\"\n })\n throw err\n }\n }\n\n toggleActivation() {\n if (this.activationState === \"inactive\") {\n this.activate()\n } else if (this.activationState === \"active\") {\n this.deactivate()\n }\n }\n\n dispose() {\n this.motionStateSocket.close()\n if (this.connectedJoggingCartesianSocket)\n this.connectedJoggingCartesianSocket.close()\n if (this.connectedJoggingJointsSocket)\n this.connectedJoggingJointsSocket.close()\n }\n\n setJoggingVelocity(velocity: number) {\n this.joggingVelocity = velocity\n }\n}\n","import type { Command, Joints, TcpPose } from \"@wandelbots/nova-api/v1\"\nimport { Vector3 } from \"three/src/math/Vector3.js\"\nimport type { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { isSameCoordinateSystem, tryParseJson } from \"../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\nexport type JoggerConnectionOpts = {\n /**\n * When an error message is received from the jogging websocket, it\n * will be passed here. If this handler is not provided, the error will\n * instead be thrown as an unhandled error.\n */\n onError?: (err: unknown) => void\n}\n\nexport class JoggerConnection {\n // Currently a separate websocket is needed for each mode, pester API people\n // to merge these for simplicity\n cartesianWebsocket: AutoReconnectingWebsocket | null = null\n jointWebsocket: AutoReconnectingWebsocket | null = null\n cartesianJoggingOpts: {\n tcpId?: string\n coordSystemId?: string\n } = {}\n\n static async open(\n nova: NovaClient,\n motionGroupId: string,\n opts: JoggerConnectionOpts = {},\n ) {\n const motionStream = await nova.connectMotionStream(motionGroupId)\n\n return new JoggerConnection(motionStream, opts)\n }\n\n constructor(\n readonly motionStream: MotionStreamConnection,\n readonly opts: JoggerConnectionOpts = {},\n ) {}\n\n get motionGroupId() {\n return this.motionStream.motionGroupId\n }\n\n get nova() {\n return this.motionStream.nova\n }\n\n get numJoints() {\n return this.motionStream.joints.length\n }\n\n get activeJoggingMode() {\n if (this.cartesianWebsocket) return \"cartesian\"\n if (this.jointWebsocket) return \"joint\"\n return \"increment\"\n }\n\n get activeWebsocket() {\n return this.cartesianWebsocket || this.jointWebsocket\n }\n\n async stop() {\n // Why not call the stopJogging API endpoint?\n // Because this results in the websocket closing and we\n // would like to keep it open for now.\n\n if (this.cartesianWebsocket) {\n this.cartesianWebsocket.sendJson({\n motion_group: this.motionGroupId,\n position_direction: { x: 0, y: 0, z: 0 },\n rotation_direction: { x: 0, y: 0, z: 0 },\n position_velocity: 0,\n rotation_velocity: 0,\n tcp: this.cartesianJoggingOpts.tcpId,\n coordinate_system: this.cartesianJoggingOpts.coordSystemId,\n })\n }\n\n if (this.jointWebsocket) {\n this.jointWebsocket.sendJson({\n motion_group: this.motionGroupId,\n joint_velocities: new Array(this.numJoints).fill(0),\n })\n }\n }\n\n dispose() {\n if (this.cartesianWebsocket) {\n this.cartesianWebsocket.dispose()\n }\n\n if (this.jointWebsocket) {\n this.jointWebsocket.dispose()\n }\n }\n\n setJoggingMode(\n mode: \"cartesian\" | \"joint\" | \"increment\",\n cartesianJoggingOpts?: {\n tcpId?: string\n coordSystemId?: string\n },\n ) {\n console.log(\"Setting jogging mode to\", mode)\n if (cartesianJoggingOpts) {\n // Websocket needs to be reopened to change options\n if (\n JSON.stringify(this.cartesianJoggingOpts) !==\n JSON.stringify(cartesianJoggingOpts)\n ) {\n if (this.cartesianWebsocket) {\n this.cartesianWebsocket.dispose()\n this.cartesianWebsocket = null\n }\n }\n\n this.cartesianJoggingOpts = cartesianJoggingOpts\n }\n\n if (mode !== \"cartesian\" && this.cartesianWebsocket) {\n this.cartesianWebsocket.dispose()\n this.cartesianWebsocket = null\n }\n\n if (mode !== \"joint\" && this.jointWebsocket) {\n this.jointWebsocket.dispose()\n this.jointWebsocket = null\n }\n\n if (mode === \"cartesian\" && !this.cartesianWebsocket) {\n this.cartesianWebsocket = this.nova.openReconnectingWebsocket(\n `/motion-groups/move-tcp`,\n )\n\n this.cartesianWebsocket.addEventListener(\n \"message\",\n (ev: MessageEvent) => {\n const data = tryParseJson(ev.data)\n if (data && \"error\" in data) {\n if (this.opts.onError) {\n this.opts.onError(ev.data)\n } else {\n throw new Error(ev.data)\n }\n }\n },\n )\n }\n\n if (mode === \"joint\" && !this.jointWebsocket) {\n this.jointWebsocket = this.nova.openReconnectingWebsocket(\n `/motion-groups/move-joint`,\n )\n\n this.jointWebsocket.addEventListener(\"message\", (ev: MessageEvent) => {\n const data = tryParseJson(ev.data)\n if (data && \"error\" in data) {\n if (this.opts.onError) {\n this.opts.onError(ev.data)\n } else {\n throw new Error(ev.data)\n }\n }\n })\n }\n }\n\n /**\n * Start rotation of a single robot joint at the specified velocity\n */\n async startJointRotation({\n joint,\n direction,\n velocityRadsPerSec,\n }: {\n /** Index of the joint to rotate */\n joint: number\n /** Direction of rotation (\"+\" or \"-\") */\n direction: \"+\" | \"-\"\n /** Speed of the rotation in radians per second */\n velocityRadsPerSec: number\n }) {\n if (!this.jointWebsocket) {\n throw new Error(\n \"Joint jogging websocket not connected; call setJoggingMode first\",\n )\n }\n\n const jointVelocities = new Array(this.numJoints).fill(0)\n\n jointVelocities[joint] =\n direction === \"-\" ? -velocityRadsPerSec : velocityRadsPerSec\n\n this.jointWebsocket.sendJson({\n motion_group: this.motionGroupId,\n joint_velocities: jointVelocities,\n })\n }\n\n /**\n * Start the TCP moving along a specified axis at a given velocity\n */\n async startTCPTranslation({\n axis,\n direction,\n velocityMmPerSec,\n }: {\n axis: \"x\" | \"y\" | \"z\"\n direction: \"-\" | \"+\"\n velocityMmPerSec: number\n }) {\n if (!this.cartesianWebsocket) {\n throw new Error(\n \"Cartesian jogging websocket not connected; call setJoggingMode first\",\n )\n }\n\n const zeroVector = { x: 0, y: 0, z: 0 }\n const joggingVector = Object.assign({}, zeroVector)\n joggingVector[axis] = direction === \"-\" ? -1 : 1\n\n this.cartesianWebsocket.sendJson({\n motion_group: this.motionGroupId,\n position_direction: joggingVector,\n rotation_direction: zeroVector,\n position_velocity: velocityMmPerSec,\n rotation_velocity: 0,\n tcp: this.cartesianJoggingOpts.tcpId,\n coordinate_system: this.cartesianJoggingOpts.coordSystemId,\n })\n }\n\n /**\n * Start the TCP rotating around a specified axis at a given velocity\n */\n async startTCPRotation({\n axis,\n direction,\n velocityRadsPerSec,\n }: {\n axis: \"x\" | \"y\" | \"z\"\n direction: \"-\" | \"+\"\n velocityRadsPerSec: number\n }) {\n if (!this.cartesianWebsocket) {\n throw new Error(\n \"Cartesian jogging websocket not connected; call setJoggingMode first\",\n )\n }\n\n const zeroVector = { x: 0, y: 0, z: 0 }\n const joggingVector = Object.assign({}, zeroVector)\n joggingVector[axis] = direction === \"-\" ? -1 : 1\n\n this.cartesianWebsocket.sendJson({\n motion_group: this.motionGroupId,\n position_direction: zeroVector,\n rotation_direction: joggingVector,\n position_velocity: 0,\n rotation_velocity: velocityRadsPerSec,\n tcp: this.cartesianJoggingOpts.tcpId,\n coordinate_system: this.cartesianJoggingOpts.coordSystemId,\n })\n }\n\n /**\n * Move the robot by a fixed distance in a single cartesian\n * axis, either rotating or translating relative to the TCP.\n * Promise resolves only after the motion has completed.\n */\n async runIncrementalCartesianMotion({\n currentTcpPose,\n currentJoints,\n coordSystemId,\n velocityInRelevantUnits,\n axis,\n direction,\n motion,\n }: {\n currentTcpPose: TcpPose\n currentJoints: Joints\n coordSystemId: string\n velocityInRelevantUnits: number\n axis: \"x\" | \"y\" | \"z\"\n direction: \"-\" | \"+\"\n motion:\n | {\n type: \"rotate\"\n distanceRads: number\n }\n | {\n type: \"translate\"\n distanceMm: number\n }\n }) {\n const commands: Command[] = []\n\n if (\n !isSameCoordinateSystem(currentTcpPose.coordinate_system, coordSystemId)\n ) {\n throw new Error(\n `Current TCP pose coordinate system ${currentTcpPose.coordinate_system} does not match target coordinate system ${coordSystemId}`,\n )\n }\n\n if (motion.type === \"translate\") {\n const targetTcpPosition = Object.assign({}, currentTcpPose.position)\n targetTcpPosition[axis] +=\n motion.distanceMm * (direction === \"-\" ? -1 : 1)\n\n commands.push({\n settings: {\n limits_override: {\n tcp_velocity_limit: velocityInRelevantUnits,\n },\n },\n line: {\n position: targetTcpPosition,\n orientation: currentTcpPose.orientation,\n coordinate_system: coordSystemId,\n },\n })\n } else if (motion.type === \"rotate\") {\n // Concatenate rotations expressed by rotation vectors\n // Equations taken from https://physics.stackexchange.com/a/287819\n\n // Compute axis and angle of current rotation vector\n const currentRotationVector = new Vector3(\n currentTcpPose.orientation.x,\n currentTcpPose.orientation.y,\n currentTcpPose.orientation.z,\n )\n\n const currentRotationRad = currentRotationVector.length()\n const currentRotationDirection = currentRotationVector.clone().normalize()\n\n // Compute axis and angle of difference rotation vector\n const differenceRotationRad =\n motion.distanceRads * (direction === \"-\" ? -1 : 1)\n\n const differenceRotationDirection = new Vector3(0.0, 0.0, 0.0)\n differenceRotationDirection[axis] = 1.0\n\n // Some abbreviations to make the following equations more readable\n const f1 =\n Math.cos(0.5 * differenceRotationRad) *\n Math.cos(0.5 * currentRotationRad)\n const f2 =\n Math.sin(0.5 * differenceRotationRad) *\n Math.sin(0.5 * currentRotationRad)\n const f3 =\n Math.sin(0.5 * differenceRotationRad) *\n Math.cos(0.5 * currentRotationRad)\n const f4 =\n Math.cos(0.5 * differenceRotationRad) *\n Math.sin(0.5 * currentRotationRad)\n\n const dotProduct = differenceRotationDirection.dot(\n currentRotationDirection,\n )\n\n const crossProduct = differenceRotationDirection\n .clone()\n .cross(currentRotationDirection)\n\n // Compute angle of concatenated rotation\n const newRotationRad = 2.0 * Math.acos(f1 - f2 * dotProduct)\n\n // Compute rotation vector of concatenated rotation\n const f5 = newRotationRad / Math.sin(0.5 * newRotationRad)\n\n const targetTcpOrientation = new Vector3()\n .addScaledVector(crossProduct, f2)\n .addScaledVector(differenceRotationDirection, f3)\n .addScaledVector(currentRotationDirection, f4)\n .multiplyScalar(f5)\n\n commands.push({\n settings: {\n limits_override: {\n tcp_orientation_velocity_limit: velocityInRelevantUnits,\n },\n },\n line: {\n position: currentTcpPose.position,\n orientation: targetTcpOrientation,\n coordinate_system: coordSystemId,\n },\n })\n }\n\n const motionPlanRes = await this.nova.api.motion.planMotion({\n motion_group: this.motionGroupId,\n start_joint_position: currentJoints,\n tcp: this.cartesianJoggingOpts.tcpId,\n commands,\n })\n\n const plannedMotion = motionPlanRes.plan_successful_response?.motion\n if (!plannedMotion) {\n throw new Error(\n `Failed to plan jogging increment motion ${JSON.stringify(motionPlanRes)}`,\n )\n }\n\n await this.nova.api.motion.streamMoveForward(\n plannedMotion,\n 100,\n undefined,\n undefined,\n undefined,\n {\n // Might take a while at low velocity\n timeout: 1000 * 60,\n },\n )\n }\n\n /**\n * Rotate a single robot joint by a fixed number of radians\n * Promise resolves only after the motion has completed.\n */\n async runIncrementalJointRotation({\n joint,\n currentJoints,\n velocityRadsPerSec,\n direction,\n distanceRads,\n }: {\n joint: number\n currentJoints: Joints\n velocityRadsPerSec: number\n direction: \"-\" | \"+\"\n distanceRads: number\n }) {\n const targetJoints = [...currentJoints.joints]\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n targetJoints[joint]! += distanceRads * (direction === \"-\" ? -1 : 1)\n\n const jointVelocityLimits: number[] = new Array(\n currentJoints.joints.length,\n ).fill(velocityRadsPerSec)\n\n const motionPlanRes = await this.nova.api.motion.planMotion({\n motion_group: this.motionGroupId,\n start_joint_position: currentJoints,\n commands: [\n {\n settings: {\n limits_override: {\n joint_velocity_limits: {\n joints: jointVelocityLimits,\n },\n },\n },\n joint_ptp: {\n joints: targetJoints,\n },\n },\n ],\n })\n\n const plannedMotion = motionPlanRes.plan_successful_response?.motion\n if (!plannedMotion) {\n console.error(\"Failed to plan jogging increment motion\", motionPlanRes)\n return\n }\n\n await this.nova.api.motion.streamMoveForward(\n plannedMotion,\n 100,\n undefined,\n undefined,\n undefined,\n {\n // Might take a while at low velocity\n timeout: 1000 * 60,\n },\n )\n }\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type {\n ControllerInstance,\n MotionGroupPhysical,\n MotionGroupStateResponse,\n Vector3d,\n} from \"@wandelbots/nova-api/v1\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport { Vector3 } from \"three\"\nimport type { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../converters\"\nimport { jointValuesEqual, tcpPoseEqual } from \"./motionStateUpdate\"\nimport type { NovaClient } from \"./NovaClient\"\n\nconst MOTION_DELTA_THRESHOLD = 0.0001\n\nfunction unwrapRotationVector(\n newRotationVectorApi: Vector3d,\n currentRotationVectorApi: Vector3d,\n): Vector3d {\n const currentRotationVector = new Vector3(\n currentRotationVectorApi.x,\n currentRotationVectorApi.y,\n currentRotationVectorApi.z,\n )\n\n const newRotationVector = new Vector3(\n newRotationVectorApi.x,\n newRotationVectorApi.y,\n newRotationVectorApi.z,\n )\n\n const currentAngle = currentRotationVector.length()\n const currentAxis = currentRotationVector.normalize()\n\n let newAngle = newRotationVector.length()\n let newAxis = newRotationVector.normalize()\n\n // Align rotation axes\n if (newAxis.dot(currentAxis) < 0) {\n newAngle = -newAngle\n newAxis = newAxis.multiplyScalar(-1.0)\n }\n\n // Shift rotation angle close to previous one to extend domain of rotation angles beyond [0, pi]\n // - this simplifies interpolation and prevents abruptly changing signs of the rotation angles\n let angleDifference = newAngle - currentAngle\n angleDifference -=\n 2.0 * Math.PI * Math.floor((angleDifference + Math.PI) / (2.0 * Math.PI))\n\n newAngle = currentAngle + angleDifference\n\n return newAxis.multiplyScalar(newAngle)\n}\n\n/**\n * Store representing the current state of a connected motion group.\n */\nexport class MotionStreamConnection {\n static async open(nova: NovaClient, motionGroupId: string) {\n const { instances: controllers } =\n await nova.api.controller.listControllers()\n\n const [_motionGroupIndex, controllerId] = motionGroupId.split(\"@\") as [\n string,\n string,\n ]\n const controller = controllers.find((c) => c.controller === controllerId)\n const motionGroup = controller?.physical_motion_groups.find(\n (mg) => mg.motion_group === motionGroupId,\n )\n if (!controller || !motionGroup) {\n throw new Error(\n `Controller ${controllerId} or motion group ${motionGroupId} not found`,\n )\n }\n\n const motionStateSocket = nova.openReconnectingWebsocket(\n `/motion-groups/${motionGroupId}/state-stream`,\n )\n\n // Wait for the first message to get the initial state\n const firstMessage = await motionStateSocket.firstMessage()\n const initialMotionState = tryParseJson(firstMessage.data)\n ?.result as MotionGroupStateResponse\n\n if (!initialMotionState) {\n throw new Error(\n `Unable to parse initial motion state message ${firstMessage.data}`,\n )\n }\n\n console.log(\n `Connected motion state websocket to motion group ${motionGroup.motion_group}. Initial state:\\n `,\n initialMotionState,\n )\n\n return new MotionStreamConnection(\n nova,\n controller,\n motionGroup,\n initialMotionState,\n motionStateSocket,\n )\n }\n\n // Not mobx-observable as this changes very fast; should be observed\n // using animation frames\n rapidlyChangingMotionState: MotionGroupStateResponse\n\n constructor(\n readonly nova: NovaClient,\n readonly controller: ControllerInstance,\n readonly motionGroup: MotionGroupPhysical,\n readonly initialMotionState: MotionGroupStateResponse,\n readonly motionStateSocket: AutoReconnectingWebsocket,\n ) {\n this.rapidlyChangingMotionState = initialMotionState\n\n motionStateSocket.addEventListener(\"message\", (event) => {\n const motionStateResponse = tryParseJson(event.data)?.result as\n | MotionGroupStateResponse\n | undefined\n\n if (!motionStateResponse) {\n throw new Error(\n `Failed to get motion state for ${this.motionGroupId}: ${event.data}`,\n )\n }\n\n // handle motionState message\n if (\n !jointValuesEqual(\n this.rapidlyChangingMotionState.state.joint_position.joints,\n motionStateResponse.state.joint_position.joints,\n MOTION_DELTA_THRESHOLD,\n )\n ) {\n runInAction(() => {\n this.rapidlyChangingMotionState.state = motionStateResponse.state\n })\n }\n\n // handle tcpPose message\n if (\n !tcpPoseEqual(\n this.rapidlyChangingMotionState.tcp_pose,\n motionStateResponse.tcp_pose,\n MOTION_DELTA_THRESHOLD,\n )\n ) {\n runInAction(() => {\n if (this.rapidlyChangingMotionState.tcp_pose == null) {\n this.rapidlyChangingMotionState.tcp_pose =\n motionStateResponse.tcp_pose\n } else {\n this.rapidlyChangingMotionState.tcp_pose = {\n position: motionStateResponse.tcp_pose!.position,\n orientation: unwrapRotationVector(\n motionStateResponse.tcp_pose!.orientation,\n this.rapidlyChangingMotionState.tcp_pose!.orientation,\n ),\n tcp: motionStateResponse.tcp_pose!.tcp,\n coordinate_system:\n motionStateResponse.tcp_pose!.coordinate_system,\n }\n }\n })\n }\n })\n makeAutoObservable(this)\n }\n\n get motionGroupId() {\n return this.motionGroup.motion_group\n }\n\n get controllerId() {\n return this.controller.controller\n }\n\n get modelFromController() {\n return this.motionGroup.model_from_controller\n }\n\n get wandelscriptIdentifier() {\n const num = this.motionGroupId.split(\"@\")[0]\n return `${this.controllerId.replaceAll(\"-\", \"_\")}_${num}`\n }\n\n get joints() {\n return this.initialMotionState.state.joint_position.joints.map((_, i) => {\n return {\n index: i,\n }\n })\n }\n\n dispose() {\n this.motionStateSocket.close()\n }\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\n/** biome-ignore-all lint/suspicious/noExplicitAny: legacy code */\nimport type {\n BaseAPI,\n Configuration as BaseConfiguration,\n} from \"@wandelbots/nova-api/v1\"\nimport {\n ApplicationApi,\n CellApi,\n ControllerApi,\n ControllerIOsApi,\n CoordinateSystemsApi,\n DeviceConfigurationApi,\n LibraryProgramApi,\n LibraryProgramMetadataApi,\n LibraryRecipeApi,\n LibraryRecipeMetadataApi,\n MotionApi,\n MotionGroupApi,\n MotionGroupInfosApi,\n MotionGroupJoggingApi,\n MotionGroupKinematicApi,\n ProgramApi,\n ProgramValuesApi,\n StoreCollisionComponentsApi,\n StoreCollisionScenesApi,\n StoreObjectApi,\n SystemApi,\n VirtualRobotApi,\n VirtualRobotBehaviorApi,\n VirtualRobotModeApi,\n VirtualRobotSetupApi,\n} from \"@wandelbots/nova-api/v1\"\nimport type { AxiosInstance } from \"axios\"\nimport axios from \"axios\"\n\ntype OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R\n ? (...args: P) => R\n : never\n\ntype UnwrapAxiosResponseReturn<T> = T extends (...a: any) => any\n ? (\n ...a: Parameters<T>\n ) => Promise<Awaited<ReturnType<T>> extends { data: infer D } ? D : never>\n : never\n\nexport type WithCellId<T> = {\n [P in keyof T]: UnwrapAxiosResponseReturn<OmitFirstArg<T[P]>>\n}\n\nexport type WithUnwrappedAxiosResponse<T> = {\n [P in keyof T]: UnwrapAxiosResponseReturn<T[P]>\n}\n\n/**\n * API client providing type-safe access to all the Nova API REST endpoints\n * associated with a specific cell id.\n */\nexport class NovaCellAPIClient {\n constructor(\n readonly cellId: string,\n readonly opts: BaseConfiguration & {\n axiosInstance?: AxiosInstance\n mock?: boolean\n },\n ) {}\n\n /**\n * Some TypeScript sorcery which alters the API class methods so you don't\n * have to pass the cell id to every single one, and de-encapsulates the\n * response data\n */\n private withCellId<T extends BaseAPI>(\n ApiConstructor: new (\n config: BaseConfiguration,\n basePath: string,\n axios: AxiosInstance,\n ) => T,\n ) {\n const apiClient = new ApiConstructor(\n {\n ...this.opts,\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n },\n this.opts.basePath ?? \"\",\n this.opts.axiosInstance ?? axios.create(),\n ) as {\n [key: string | symbol]: any\n }\n\n for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient)!)) {\n if (key !== \"constructor\" && typeof apiClient[key] === \"function\") {\n const originalFunction = apiClient[key]\n apiClient[key] = (...args: any[]) => {\n return originalFunction\n .apply(apiClient, [this.cellId, ...args])\n .then((res: any) => res.data)\n }\n }\n }\n\n return apiClient as WithCellId<T>\n }\n\n /**\n * As withCellId, but only does the response unwrapping\n */\n private withUnwrappedResponsesOnly<T extends BaseAPI>(\n ApiConstructor: new (\n config: BaseConfiguration,\n basePath: string,\n axios: AxiosInstance,\n ) => T,\n ) {\n const apiClient = new ApiConstructor(\n {\n ...this.opts,\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n },\n this.opts.basePath ?? \"\",\n this.opts.axiosInstance ?? axios.create(),\n ) as {\n [key: string | symbol]: any\n }\n\n for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient)!)) {\n if (key !== \"constructor\" && typeof apiClient[key] === \"function\") {\n const originalFunction = apiClient[key]\n apiClient[key] = (...args: any[]) => {\n return originalFunction\n .apply(apiClient, args)\n .then((res: any) => res.data)\n }\n }\n }\n\n return apiClient as WithUnwrappedAxiosResponse<T>\n }\n\n readonly system = this.withUnwrappedResponsesOnly(SystemApi)\n readonly cell = this.withUnwrappedResponsesOnly(CellApi)\n\n readonly deviceConfig = this.withCellId(DeviceConfigurationApi)\n\n readonly motionGroup = this.withCellId(MotionGroupApi)\n readonly motionGroupInfos = this.withCellId(MotionGroupInfosApi)\n\n readonly controller = this.withCellId(ControllerApi)\n\n readonly program = this.withCellId(ProgramApi)\n readonly programValues = this.withCellId(ProgramValuesApi)\n\n readonly controllerIOs = this.withCellId(ControllerIOsApi)\n\n readonly motionGroupKinematic = this.withCellId(MotionGroupKinematicApi)\n readonly motion = this.withCellId(MotionApi)\n\n readonly coordinateSystems = this.withCellId(CoordinateSystemsApi)\n\n readonly application = this.withCellId(ApplicationApi)\n readonly applicationGlobal = this.withUnwrappedResponsesOnly(ApplicationApi)\n\n readonly motionGroupJogging = this.withCellId(MotionGroupJoggingApi)\n\n readonly virtualRobot = this.withCellId(VirtualRobotApi)\n readonly virtualRobotSetup = this.withCellId(VirtualRobotSetupApi)\n readonly virtualRobotMode = this.withCellId(VirtualRobotModeApi)\n readonly virtualRobotBehavior = this.withCellId(VirtualRobotBehaviorApi)\n\n readonly libraryProgramMetadata = this.withCellId(LibraryProgramMetadataApi)\n readonly libraryProgram = this.withCellId(LibraryProgramApi)\n readonly libraryRecipeMetadata = this.withCellId(LibraryRecipeMetadataApi)\n readonly libraryRecipe = this.withCellId(LibraryRecipeApi)\n\n readonly storeObject = this.withCellId(StoreObjectApi)\n readonly storeCollisionComponents = this.withCellId(\n StoreCollisionComponentsApi,\n )\n readonly storeCollisionScenes = this.withCellId(StoreCollisionScenesApi)\n}\n","import type {\n ControllerInstanceList,\n MotionGroupSpecification,\n MotionGroupStateResponse,\n RobotController,\n SafetySetup,\n} from \"@wandelbots/nova-api/v1\"\nimport type { AxiosResponse, InternalAxiosRequestConfig } from \"axios\"\nimport { AxiosError } from \"axios\"\nimport * as pathToRegexp from \"path-to-regexp\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\n\n/**\n * Ultra-simplified mock Nova server for testing stuff\n */\nexport class MockNovaInstance {\n readonly connections: AutoReconnectingWebsocket[] = []\n\n async handleAPIRequest(\n config: InternalAxiosRequestConfig,\n ): Promise<AxiosResponse> {\n const apiHandlers = [\n {\n method: \"GET\",\n path: \"/cells/:cellId/controllers\",\n handle() {\n return {\n instances: [\n {\n controller: \"mock-ur5e\",\n model_name: \"UniversalRobots::Controller\",\n host: \"mock-ur5e\",\n allow_software_install_on_controller: true,\n physical_motion_groups: [\n {\n motion_group: \"0@mock-ur5e\",\n name_from_controller: \"UR5e\",\n active: false,\n model_from_controller: \"UniversalRobots_UR5e\",\n },\n ],\n has_error: false,\n error_details: \"\",\n },\n ],\n } satisfies ControllerInstanceList\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId\",\n handle() {\n return {\n configuration: {\n kind: \"VirtualController\",\n manufacturer: \"universalrobots\",\n position: \"[0,-1.571,-1.571,-1.571,1.571,-1.571,0]\",\n type: \"universalrobots-ur5e\",\n },\n name: \"mock-ur5\",\n } satisfies RobotController\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/motion-groups/:motionGroupId/specification\",\n handle() {\n return {\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n theta: 0,\n a: 0,\n d: 162.25,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0,\n theta: 0,\n a: -425,\n d: 0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0,\n theta: 0,\n a: -392.2,\n d: 0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 1.5707963267948966,\n theta: 0,\n a: 0,\n d: 133.3,\n reverse_rotation_direction: false,\n },\n {\n alpha: -1.5707963267948966,\n theta: 0,\n a: 0,\n d: 99.7,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0,\n theta: 0,\n a: 0,\n d: 99.6,\n reverse_rotation_direction: false,\n },\n ],\n mechanical_joint_limits: [\n {\n joint: \"JOINTNAME_AXIS_1\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_2\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_3\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_4\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_5\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_6\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n ],\n } satisfies MotionGroupSpecification\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/motion-groups/:motionGroupId/safety-setup\",\n handle() {\n return {\n safety_settings: [\n {\n safety_state: \"SAFETY_NORMAL\",\n settings: {\n joint_position_limits: [\n {\n joint: \"JOINTNAME_AXIS_1\",\n lower_limit: -2.96705961227417,\n upper_limit: 2.96705961227417,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_2\",\n lower_limit: -1.7453292608261108,\n upper_limit: 2.7925267219543457,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_3\",\n lower_limit: -3.3161256313323975,\n upper_limit: 0.40142571926116943,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_4\",\n lower_limit: -3.4906585216522217,\n upper_limit: 3.4906585216522217,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_5\",\n lower_limit: -2.4434609413146973,\n upper_limit: 2.4434609413146973,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_6\",\n lower_limit: -4.71238899230957,\n upper_limit: 4.71238899230957,\n unlimited: false,\n },\n ],\n joint_velocity_limits: [\n {\n joint: \"JOINTNAME_AXIS_1\",\n limit: 3.1415927410125732,\n },\n {\n joint: \"JOINTNAME_AXIS_2\",\n limit: 3.1415927410125732,\n },\n {\n joint: \"JOINTNAME_AXIS_3\",\n limit: 3.4906585216522217,\n },\n {\n joint: \"JOINTNAME_AXIS_4\",\n limit: 6.108652591705322,\n },\n {\n joint: \"JOINTNAME_AXIS_5\",\n limit: 6.108652591705322,\n },\n {\n joint: \"JOINTNAME_AXIS_6\",\n limit: 6.981317043304443,\n },\n ],\n joint_acceleration_limits: [],\n joint_torque_limits: [],\n tcp_velocity_limit: 1800,\n },\n },\n ],\n safety_zones: [\n {\n id: 1,\n priority: 0,\n geometry: {\n compound: {\n child_geometries: [\n {\n convex_hull: {\n vertices: [\n {\n x: -800,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: 1330,\n z: -1820,\n },\n {\n x: -800,\n y: 1330,\n z: -1820,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: -800,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: -1330,\n z: 1500,\n },\n {\n x: -800,\n y: -1330,\n z: 1500,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: -800,\n y: -1330,\n z: -1820,\n },\n {\n x: -800,\n y: 1330,\n z: -1820,\n },\n {\n x: -800,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: -1330,\n z: 1500,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: -1330,\n z: 1500,\n },\n {\n x: 1650,\n y: -1330,\n z: 1500,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: 1330,\n z: -1820,\n },\n {\n x: 1650,\n y: 1330,\n z: -1820,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: 1500,\n },\n {\n x: 1650,\n y: -1330,\n z: 1500,\n },\n {\n x: 1650,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: 1330,\n z: -1820,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Cell workzone\",\n },\n motion_group_uid: 1,\n },\n {\n id: 2,\n priority: 0,\n geometry: {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: -1850,\n },\n {\n x: 865,\n y: 1330,\n z: -1850,\n },\n {\n x: 865,\n y: -720,\n z: -1850,\n },\n {\n x: 1650,\n y: -720,\n z: -1850,\n },\n {\n x: 1650,\n y: 1330,\n z: -920,\n },\n {\n x: 865,\n y: 1330,\n z: -920,\n },\n {\n x: 865,\n y: -720,\n z: -920,\n },\n {\n x: 1650,\n y: -720,\n z: -920,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Transport\",\n },\n motion_group_uid: 1,\n },\n {\n id: 3,\n priority: 0,\n geometry: {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: -600,\n },\n {\n x: 865,\n y: 1330,\n z: -600,\n },\n {\n x: 865,\n y: 430,\n z: -600,\n },\n {\n x: 1650,\n y: 430,\n z: -600,\n },\n {\n x: 1650,\n y: 1330,\n z: -1250,\n },\n {\n x: 865,\n y: 1330,\n z: -1250,\n },\n {\n x: 865,\n y: 430,\n z: -1250,\n },\n {\n x: 1650,\n y: 430,\n z: -1250,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Tunel\",\n },\n motion_group_uid: 1,\n },\n {\n id: 4,\n priority: 0,\n geometry: {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: -760,\n z: -440,\n },\n {\n x: 900,\n y: -760,\n z: -440,\n },\n {\n x: 900,\n y: -1330,\n z: -440,\n },\n {\n x: 1650,\n y: -1330,\n z: -440,\n },\n {\n x: 1650,\n y: -760,\n z: -1800,\n },\n {\n x: 900,\n y: -760,\n z: -1800,\n },\n {\n x: 900,\n y: -1330,\n z: -1800,\n },\n {\n x: 1650,\n y: -1330,\n z: -1800,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Fanuc controller\",\n },\n motion_group_uid: 1,\n },\n {\n id: 6,\n priority: 0,\n geometry: {\n convex_hull: {\n vertices: [\n {\n x: -200,\n y: -200,\n z: -1900,\n },\n {\n x: 200,\n y: -200,\n z: -1900,\n },\n {\n x: 200,\n y: 200,\n z: -1900,\n },\n {\n x: -200,\n y: 200,\n z: -1900,\n },\n {\n x: -200,\n y: -200,\n z: -350,\n },\n {\n x: 200,\n y: -200,\n z: -350,\n },\n {\n x: 200,\n y: 200,\n z: -350,\n },\n {\n x: -200,\n y: 200,\n z: -350,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Robot base\",\n },\n motion_group_uid: 1,\n },\n ],\n robot_model_geometries: [\n {\n link_index: 1,\n geometry: {\n sphere: {\n radius: 270,\n },\n init_pose: {\n position: {\n x: -70,\n y: -70,\n z: -50,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"link1_sphere\",\n },\n },\n {\n link_index: 2,\n geometry: {\n capsule: {\n radius: 160,\n cylinder_height: 800,\n },\n init_pose: {\n position: {\n x: -450,\n y: 40,\n z: 170,\n },\n orientation: {\n x: 0,\n y: -Math.SQRT1_2,\n z: 0,\n w: Math.SQRT1_2,\n },\n },\n id: \"link2_capsule\",\n },\n },\n {\n link_index: 3,\n geometry: {\n sphere: {\n radius: 270,\n },\n init_pose: {\n position: {\n x: -110,\n y: 10,\n z: -100,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"link3_sphere\",\n },\n },\n {\n link_index: 4,\n geometry: {\n capsule: {\n radius: 110,\n cylinder_height: 600,\n },\n init_pose: {\n position: {\n x: 0,\n y: 300,\n z: 40,\n },\n orientation: {\n x: -Math.SQRT1_2,\n y: 0,\n z: 0,\n w: Math.SQRT1_2,\n },\n },\n id: \"link4_capsule\",\n },\n },\n {\n link_index: 5,\n geometry: {\n sphere: {\n radius: 75,\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: -50,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"link5_sphere\",\n },\n },\n ],\n tool_geometries: [],\n } satisfies SafetySetup\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/coordinate-systems\",\n handle() {\n return {\n coordinatesystems: [\n {\n coordinate_system: \"\",\n name: \"world\",\n reference_uid: \"\",\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n rotation: {\n angles: [0, 0, 0],\n type: \"ROTATION_VECTOR\",\n },\n },\n ],\n } //satisfies CoordinateSystems\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/motion-groups/:motionGroupId/tcps\",\n handle() {\n return {\n tcps: [\n {\n id: \"Flange\",\n readable_name: \"Default-Flange\",\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n rotation: {\n angles: [0, 0, 0, 0],\n type: \"ROTATION_VECTOR\",\n },\n },\n {\n id: \"complex-tcp-position\",\n readable_name: \"Complex TCP Position\",\n position: {\n x: -200,\n y: 300,\n z: 150,\n },\n rotation: {\n angles: [\n -0.12139440409113832, -0.06356210998212003,\n -0.2023240068185639, 0,\n ],\n type: \"ROTATION_VECTOR\",\n },\n },\n ],\n }\n },\n },\n ]\n\n const method = config.method?.toUpperCase() || \"GET\"\n const path = `/cells${config.url?.split(\"/cells\")[1]?.split(\"?\")[0]}`\n\n for (const handler of apiHandlers) {\n const match = pathToRegexp.match(handler.path)(path || \"\")\n if (method === handler.method && match) {\n const json = handler.handle()\n return {\n status: 200,\n statusText: \"Success\",\n data: JSON.stringify(json),\n headers: {},\n config,\n request: {\n responseURL: config.url,\n },\n }\n }\n }\n\n throw new AxiosError(\n `No mock handler matched this request: ${method} ${path}`,\n \"404\",\n config,\n )\n\n // return {\n // status: 404,\n // statusText: \"Not Found\",\n // data: \"\",\n // headers: {},\n // config,\n // request: {\n // responseURL: config.url,\n // },\n // }\n }\n\n handleWebsocketConnection(socket: AutoReconnectingWebsocket) {\n this.connections.push(socket)\n\n setTimeout(() => {\n socket.dispatchEvent(new Event(\"open\"))\n\n console.log(\"Websocket connection opened from\", socket.url)\n\n if (socket.url.includes(\"/state-stream\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify(defaultMotionState),\n }),\n )\n }\n\n if (socket.url.includes(\"/move-joint\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify({\n result: {\n motion_group: \"0@ur\",\n state: {\n controller: \"ur\",\n operation_mode: \"OPERATION_MODE_AUTO\",\n safety_state: \"SAFETY_STATE_NORMAL\",\n timestamp: \"2024-09-18T12:48:26.096266444Z\",\n velocity_override: 100,\n motion_groups: [\n {\n motion_group: \"0@ur\",\n controller: \"ur\",\n joint_position: {\n joints: [\n 1.3492152690887451, -1.5659207105636597,\n 1.6653711795806885, -1.0991662740707397,\n -1.829018235206604, 1.264623761177063,\n ],\n },\n joint_velocity: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n flange_pose: {\n position: {\n x: 6.437331889439328,\n y: -628.4123774830913,\n z: 577.0569957147832,\n },\n orientation: {\n x: -1.683333649797158,\n y: -1.9783363827298732,\n z: -0.4928031860165713,\n },\n coordinate_system: \"\",\n },\n tcp_pose: {\n position: {\n x: 6.437331889439328,\n y: -628.4123774830913,\n z: 577.0569957147832,\n },\n orientation: {\n x: -1.683333649797158,\n y: -1.9783363827298732,\n z: -0.4928031860165713,\n },\n coordinate_system: \"\",\n tcp: \"Flange\",\n },\n velocity: {\n linear: {\n x: 0,\n y: 0,\n z: 0,\n },\n angular: {\n x: -0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n force: {\n force: {\n x: 0,\n y: 0,\n z: 0,\n },\n moment: {\n x: 0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n joint_limit_reached: {\n limit_reached: [\n false,\n false,\n false,\n false,\n false,\n false,\n ],\n },\n joint_current: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n sequence_number: \"671259\",\n },\n ],\n sequence_number: \"671259\",\n },\n movement_state: \"MOVEMENT_STATE_MOVING\",\n },\n }),\n }),\n )\n }\n\n if (socket.url.includes(\"/move-tcp\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify({\n result: {\n motion_group: \"0@ur\",\n state: {\n controller: \"ur\",\n operation_mode: \"OPERATION_MODE_AUTO\",\n safety_state: \"SAFETY_STATE_NORMAL\",\n timestamp: \"2024-09-18T12:43:12.188335774Z\",\n velocity_override: 100,\n motion_groups: [\n {\n motion_group: \"0@ur\",\n controller: \"ur\",\n joint_position: {\n joints: [\n 1.3352527618408203, -1.5659207105636597,\n 1.6653711795806885, -1.110615611076355,\n -1.829018235206604, 1.264623761177063,\n ],\n },\n joint_velocity: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n flange_pose: {\n position: {\n x: -2.763015284002938,\n y: -630.2151479701106,\n z: 577.524509114342,\n },\n orientation: {\n x: -1.704794877102097,\n y: -1.9722372952861567,\n z: -0.4852079204210754,\n },\n coordinate_system: \"\",\n },\n tcp_pose: {\n position: {\n x: -2.763015284002938,\n y: -630.2151479701106,\n z: 577.524509114342,\n },\n orientation: {\n x: -1.704794877102097,\n y: -1.9722372952861567,\n z: -0.4852079204210754,\n },\n coordinate_system: \"\",\n tcp: \"Flange\",\n },\n velocity: {\n linear: {\n x: 0,\n y: 0,\n z: 0,\n },\n angular: {\n x: -0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n force: {\n force: {\n x: 0,\n y: 0,\n z: 0,\n },\n moment: {\n x: 0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n joint_limit_reached: {\n limit_reached: [\n false,\n false,\n false,\n false,\n false,\n false,\n ],\n },\n joint_current: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n sequence_number: \"627897\",\n },\n ],\n sequence_number: \"627897\",\n },\n movement_state: \"MOVEMENT_STATE_MOVING\",\n },\n }),\n }),\n )\n }\n }, 10)\n }\n\n handleWebsocketMessage(socket: AutoReconnectingWebsocket, message: string) {\n console.log(`Received message on ${socket.url}`, message)\n }\n}\n\nconst defaultMotionState = {\n result: {\n state: {\n motion_group: \"0@universalrobots-ur5e\",\n controller: \"universalrobots-ur5e\",\n joint_position: {\n joints: [\n 1.1699999570846558, -1.5700000524520874, 1.3600000143051147,\n 1.0299999713897705, 1.2899999618530273, 1.2799999713897705,\n ],\n },\n joint_velocity: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n flange_pose: {\n position: {\n x: 1.3300010259703043,\n y: -409.2680714682808,\n z: 531.0203477065281,\n },\n orientation: {\n x: 1.7564919306270736,\n y: -1.7542521568325058,\n z: 0.7326972590614671,\n },\n coordinate_system: \"\",\n },\n tcp_pose: {\n position: {\n x: 1.3300010259703043,\n y: -409.2680714682808,\n z: 531.0203477065281,\n },\n orientation: {\n x: 1.7564919306270736,\n y: -1.7542521568325058,\n z: 0.7326972590614671,\n },\n coordinate_system: \"\",\n tcp: \"Flange\",\n },\n velocity: {\n linear: {\n x: 0,\n y: 0,\n z: 0,\n },\n angular: {\n x: 0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n force: {\n force: {\n x: 0,\n y: 0,\n z: 0,\n },\n moment: {\n x: 0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n joint_current: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n sequence_number: \"1\",\n },\n tcp_pose: {\n position: {\n x: 302.90748476115556,\n y: -152.87065869452337,\n z: 424.0454619321661,\n },\n orientation: {\n x: 2.3403056115045353,\n y: -1.1706836379431356,\n z: 0.9772511964246311,\n },\n coordinate_system: \"\",\n tcp: \"Flange\",\n },\n } satisfies MotionGroupStateResponse,\n}\n","/**\n * @fileoverview\n * @deprecated The nova v1 client is deprecated. Please use the v2 client from `@wandelbots/nova-js/v2` instead.\n */\n\nimport type { Configuration as BaseConfiguration } from \"@wandelbots/nova-api/v1\"\nimport type { AxiosRequestConfig } from \"axios\"\nimport axios, { isAxiosError } from \"axios\"\nimport urlJoin from \"url-join\"\nimport { loginWithAuth0 } from \"../../LoginWithAuth0.js\"\nimport { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket.js\"\nimport { availableStorage } from \"../availableStorage.js\"\nimport { parseNovaInstanceUrl } from \"../converters.js\"\nimport { ConnectedMotionGroup } from \"./ConnectedMotionGroup.js\"\nimport { JoggerConnection } from \"./JoggerConnection.js\"\nimport { MotionStreamConnection } from \"./MotionStreamConnection.js\"\nimport { NovaCellAPIClient } from \"./NovaCellAPIClient.js\"\nimport { MockNovaInstance } from \"./mock/MockNovaInstance.js\"\n\nexport type NovaClientConfig = {\n /**\n * Url of the deployed Nova instance to connect to\n * e.g. https://saeattii.instance.wandelbots.io\n */\n instanceUrl: string | \"https://mock.example.com\"\n\n /**\n * Identifier of the cell on the Nova instance to connect this client to.\n * If omitted, the default identifier \"cell\" is used.\n **/\n cellId?: string\n\n /**\n * Username for basic auth to the Nova instance.\n * @deprecated use accessToken instead\n */\n username?: string\n\n /**\n * Password for basic auth to the Nova instance.\n * @deprecated use accessToken instead\n */\n password?: string\n\n /**\n * Access token for Bearer authentication.\n */\n accessToken?: string\n} & Omit<BaseConfiguration, \"isJsonMime\" | \"basePath\">\n\ntype NovaClientConfigWithDefaults = NovaClientConfig & { cellId: string }\n\n/**\n * Client for connecting to a Nova instance and controlling robots.\n * @deprecated The nova v1 client is deprecated. Please use the v2 client from `@wandelbots/nova-js/v2` instead.\n */\nexport class NovaClient {\n readonly api: NovaCellAPIClient\n readonly config: NovaClientConfigWithDefaults\n readonly mock?: MockNovaInstance\n readonly instanceUrl: URL\n authPromise: Promise<string | null> | null = null\n accessToken: string | null = null\n\n constructor(config: NovaClientConfig) {\n const cellId = config.cellId ?? \"cell\"\n this.config = {\n cellId,\n ...config,\n }\n this.accessToken =\n config.accessToken ||\n availableStorage.getString(\"wbjs.access_token\") ||\n null\n\n if (this.config.instanceUrl === \"https://mock.example.com\") {\n this.mock = new MockNovaInstance()\n }\n this.instanceUrl = parseNovaInstanceUrl(this.config.instanceUrl)\n\n // Set up Axios instance with interceptor for token fetching\n const axiosInstance = axios.create({\n baseURL: urlJoin(this.config.instanceUrl, \"/api/v1\"),\n // TODO - backend needs to set proper CORS headers for this\n headers:\n typeof window !== \"undefined\" &&\n window.location.origin.includes(\"localhost\")\n ? {}\n : {\n // Identify the client to the backend for logging purposes\n \"X-Wandelbots-Client\": \"Wandelbots-Nova-JS-SDK\",\n },\n })\n\n axiosInstance.interceptors.request.use(async (request) => {\n if (!request.headers.Authorization) {\n if (this.accessToken) {\n request.headers.Authorization = `Bearer ${this.accessToken}`\n } else if (this.config.username && this.config.password) {\n request.headers.Authorization = `Basic ${btoa(`${config.username}:${config.password}`)}`\n }\n }\n return request\n })\n\n if (typeof window !== \"undefined\") {\n axiosInstance.interceptors.response.use(\n (r) => r,\n async (error) => {\n if (isAxiosError(error)) {\n if (error.response?.status === 401) {\n // If we hit a 401, attempt to login the user and retry with\n // a new access token\n try {\n await this.renewAuthentication()\n\n if (error.config) {\n if (this.accessToken) {\n error.config.headers.Authorization = `Bearer ${this.accessToken}`\n } else {\n delete error.config.headers.Authorization\n }\n return axiosInstance.request(error.config)\n }\n } catch (err) {\n return Promise.reject(err)\n }\n } else if (error.response?.status === 503) {\n // Check if the server as a whole is down\n const res = await fetch(window.location.href)\n if (res.status === 503) {\n // Go to 503 page\n window.location.reload()\n }\n }\n }\n\n return Promise.reject(error)\n },\n )\n }\n\n this.api = new NovaCellAPIClient(cellId, {\n ...config,\n basePath: urlJoin(this.instanceUrl.href, \"/api/v1\"),\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n return this.mock!.handleAPIRequest(config)\n },\n } satisfies AxiosRequestConfig)\n : {}),\n ...config.baseOptions,\n },\n axiosInstance,\n })\n }\n\n async renewAuthentication(): Promise<void> {\n if (this.authPromise) {\n // Don't double up\n return\n }\n\n const storedToken = availableStorage.getString(\"wbjs.access_token\")\n if (storedToken && this.accessToken !== storedToken) {\n // Might be newer than the one we have\n this.accessToken = storedToken\n return\n }\n\n // Otherwise, perform login flow\n this.authPromise = loginWithAuth0(this.instanceUrl)\n try {\n this.accessToken = await this.authPromise\n if (this.accessToken) {\n // Cache access token so we don't need to log in every refresh\n availableStorage.setString(\"wbjs.access_token\", this.accessToken)\n } else {\n availableStorage.delete(\"wbjs.access_token\")\n }\n } finally {\n this.authPromise = null\n }\n }\n\n makeWebsocketURL(path: string): string {\n const url = new URL(\n urlJoin(\n this.instanceUrl.href,\n `/api/v1/cells/${this.config.cellId}`,\n path,\n ),\n )\n url.protocol = url.protocol.replace(\"http\", \"ws\")\n url.protocol = url.protocol.replace(\"https\", \"wss\")\n\n // If provided, add basic auth credentials to the URL\n // NOTE - basic auth is deprecated on websockets and doesn't work in Safari\n // use tokens instead\n if (this.accessToken) {\n url.searchParams.append(\"token\", this.accessToken)\n } else if (this.config.username && this.config.password) {\n url.username = this.config.username\n url.password = this.config.password\n }\n\n return url.toString()\n }\n\n /**\n * Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.\n * If you explicitly want to reconnect an existing websocket, call `reconnect`\n * on the returned object.\n */\n openReconnectingWebsocket(path: string) {\n return new AutoReconnectingWebsocket(this.makeWebsocketURL(path), {\n mock: this.mock,\n })\n }\n\n /**\n * Connect to the motion state websocket(s) for a given motion group\n */\n async connectMotionStream(motionGroupId: string) {\n return await MotionStreamConnection.open(this, motionGroupId)\n }\n\n /**\n * Connect to the jogging websocket(s) for a given motion group\n */\n async connectJogger(motionGroupId: string) {\n return await JoggerConnection.open(this, motionGroupId)\n }\n\n async connectMotionGroups(\n motionGroupIds: string[],\n ): Promise<ConnectedMotionGroup[]> {\n const { instances } = await this.api.controller.listControllers()\n\n return Promise.all(\n motionGroupIds.map((motionGroupId) =>\n ConnectedMotionGroup.connect(this, motionGroupId, instances),\n ),\n )\n }\n\n async connectMotionGroup(\n motionGroupId: string,\n ): Promise<ConnectedMotionGroup> {\n const motionGroups = await this.connectMotionGroups([motionGroupId])\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n return motionGroups[0]!\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAMA,SAAgB,yBACd,MACA;CACA,MAAM,WAAW;EAAC,KAAK,SAAS;EAAG,KAAK,SAAS;EAAG,KAAK,SAAS;EAAE;CACpE,MAAM,cAAc;EAClB,KAAK,aAAa,KAAK;EACvB,KAAK,aAAa,KAAK;EACvB,KAAK,aAAa,KAAK;EACxB;CAED,MAAM,iBAAiB,SAAS,KAAK,MAAM,EAAE,QAAQ,EAAE,CAAC;CAExD,MAAM,iBAAiB,YAAY,KAAK,MAAM,EAAE,QAAQ,EAAE,CAAC;AAE3D,QAAO,IAAI,eAAe,OAAO,eAAe,CAAC,KAAK,KAAK,CAAC;;;;;AClB9D,SAAgB,iBACd,gBACA,gBACA,sBACS;AACT,KAAI,eAAe,WAAW,eAAe,OAC3C,QAAO;AAGT,MAAK,IAAI,aAAa,GAAG,aAAa,eAAe,QAAQ,aAC3D,KAEE,KAAK,IAAI,eAAe,cAAe,eAAe,YAAa,GACnE,qBAEA,QAAO;AAIX,QAAO;;AAGT,SAAgB,aACd,QACA,QACA,sBACS;AAET,KAAK,WAAW,UAAa,UAAY,UAAU,WAAW,OAC5D,QAAO;AAIT,KAAI,WAAW,UAAa,WAAW,OACrC,QAAO;CAGT,IAAI,eAAe;AACnB,iBAAgB,KAAK,IAAI,OAAO,YAAY,IAAI,OAAO,YAAY,EAAE;AACrE,iBAAgB,KAAK,IAAI,OAAO,YAAY,IAAI,OAAO,YAAY,EAAE;AACrE,iBAAgB,KAAK,IAAI,OAAO,YAAY,IAAI,OAAO,YAAY,EAAE;AACrE,iBAA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WAAW;QACZ;OACD;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;QACZ;OACD;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;QACZ;OACD;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;QACZ;OACF;MACF;;IAEJ;GACD;IACE,QAAQ;IACR,MAAM;IACN,SAAS;AACP,YAAO;MACL,iBAAiB,CACf;OACE,cAAc;OACd,UAAU;QACR,uBAAuB;SACrB;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;UACZ;SACD;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;UACZ;SACD;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;UACZ;SACD;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;UACZ;SACD;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;UACZ;SACD;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;UACZ;SACF;QACD,uBAAuB;SACrB;UACE,OAAO;UACP,OAAO;UACR;SACD;UACE,OAAO;UACP,OAAO;UACR;SACD;UACE,OAAO;UACP,OAAO;UACR;SACD;UACE,OAAO;UACP,OAAO;UACR;SACD;UACE,OAAO;UACP,OAAO;UACR;SACD;UACE,OAAO;UACP,OAAO;UACR;SACF;QACD,2BAA2B,EAAE;QAC7B,qBAAqB,EAAE;QACvB,oBAAoB;QACrB;OACF,CACF;MACD,cAAc;OACZ;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,UAAU,EACR,kBAAkB;UAChB;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF,EACF;WACD,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF;WACD,IAAI;WACL;UACD;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF,EACF;WACD,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF;WACD,IAAI;WACL;UACD;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF,EACF;WACD,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF;WACD,IAAI;WACL;UACD;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF,EACF;WACD,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF;WACD,IAAI;WACL;UACD;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF,EACF;WACD,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF;WACD,IAAI;WACL;UACD;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD;aACE,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF,EACF;WACD,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACD,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACJ;YACF;WACD,IAAI;WACL;UACF,EACF;SACD,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF;SACD,IAAI;SACL;QACD,kBAAkB;QACnB;OACD;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,aAAa,EACX,UAAU;UACR;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF,EACF;SACD,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF;SACD,IAAI;SACL;QACD,kBAAkB;QACnB;OACD;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,aAAa,EACX,UAAU;UACR;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF,EACF;SACD,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF;SACD,IAAI;SACL;QACD,kBAAkB;QACnB;OACD;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,aAAa,EACX,UAAU;UACR;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF,EACF;SACD,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF;SACD,IAAI;SACL;QACD,kBAAkB;QACnB;OACD;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,aAAa,EACX,UAAU;UACR;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD;WACE,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF,EACF;SACD,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF;SACD,IAAI;SACL;QACD,kBAAkB;QACnB;OACF;MACD,wBAAwB;OACtB;QACE,YAAY;QACZ,UAAU;SACR,QAAQ,EACN,QAAQ,KACT;SACD,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACF;SACD,IAAI;SACL;QACF;OACD;QACE,YAAY;QACZ,UAAU;SACR,SAAS;UACP,QAAQ;UACR,iBAAiB;UAClB;SACD,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD,aAAa;WACX,GAAG;WACH,GAAG,CAAC,KAAK;WACT,GAAG;WACH,GAAG,KAAK;WACT;UACF;SACD,IAAI;SACL;QACF;OACD;QACE,YAAY;QACZ,UAAU;SACR,QAAQ,EACN,QAAQ,KACT;SACD,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;WACJ;UACD,aAAa;WACX,GAAG;WACH,GAAG;WAC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Q,KAAK;AACjD,MAAI,WAAW,IAAI,SAAS,QAAQ,SAAS,MAAM;AAKnD,MAAI,KAAK,YACP,KAAI,aAAa,OAAO,SAAS,KAAK,YAAY;WACzC,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU;AACvD,OAAI,WAAW,KAAK,OAAO;AAC3B,OAAI,WAAW,KAAK,OAAO;;AAG7B,SAAO,IAAI,UAAU;;;;;;;CAQvB,0BAA0B,MAAc;AACtC,SAAO,IAAIC,iDAA0B,KAAK,iBAAiB,KAAK,EAAE,EAChE,MAAM,KAAK,MACZ,CAAC;;;;;CAMJ,MAAM,oBAAoB,eAAuB;AAC/C,SAAO,MAAM,uBAAuB,KAAK,MAAM,cAAc;;;;;CAM/D,MAAM,cAAc,eAAuB;AACzC,SAAO,MAAM,iBAAiB,KAAK,MAAM,cAAc;;CAGzD,MAAM,oBACJ,gBACiC;EACjC,MAAM,EAAE,cAAc,MAAM,KAAK,IAAI,WAAW,iBAAiB;AAEjE,SAAO,QAAQ,IACb,eAAe,KAAK,kBAClB,qBAAqB,QAAQ,MAAM,eAAe,UAAU,CAC7D,CACF;;CAGH,MAAM,mBACJ,eAC+B;AAG/B,UAFqB,MAAM,KAAK,oBAAoB,CAAC,cAAc,CAAC,EAEhD"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_LoginWithAuth0 = require('./LoginWithAuth0-
|
|
2
|
-
const require_NovaClient = require('./NovaClient-
|
|
1
|
+
const require_LoginWithAuth0 = require('./LoginWithAuth0-iXpPiCcz.cjs');
|
|
2
|
+
const require_NovaClient = require('./NovaClient-j40sHBBq.cjs');
|
|
3
3
|
let axios = require("axios");
|
|
4
4
|
|
|
5
5
|
//#region src/lib/errorHandling.ts
|
|
@@ -27,24 +27,28 @@ function makeErrorMessage(err) {
|
|
|
27
27
|
else return `${err.message} from ${err.config.method?.toUpperCase() || "accessing"} ${err.config.url}`;
|
|
28
28
|
} else if (err instanceof Error) return err.message;
|
|
29
29
|
else if (typeof err === "string") return err;
|
|
30
|
-
else if (typeof err === "object") return
|
|
30
|
+
else if (typeof err === "object") return require_LoginWithAuth0.tryStringifyJson(err) || `Unserializable object ${err}`;
|
|
31
31
|
return `${err}`;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
35
35
|
exports.AutoReconnectingWebsocket = require_LoginWithAuth0.AutoReconnectingWebsocket;
|
|
36
36
|
exports.NovaClient = require_NovaClient.NovaClient;
|
|
37
|
-
exports.XYZ_TO_VECTOR =
|
|
37
|
+
exports.XYZ_TO_VECTOR = require_LoginWithAuth0.XYZ_TO_VECTOR;
|
|
38
38
|
exports.availableStorage = require_LoginWithAuth0.availableStorage;
|
|
39
|
-
exports.degreesToRadians =
|
|
39
|
+
exports.degreesToRadians = require_LoginWithAuth0.degreesToRadians;
|
|
40
40
|
exports.delay = delay;
|
|
41
|
-
exports.
|
|
41
|
+
exports.getAuth0Config = require_LoginWithAuth0.getAuth0Config;
|
|
42
|
+
exports.isSameCoordinateSystem = require_LoginWithAuth0.isSameCoordinateSystem;
|
|
42
43
|
exports.loginWithAuth0 = require_LoginWithAuth0.loginWithAuth0;
|
|
43
44
|
exports.makeErrorMessage = makeErrorMessage;
|
|
44
45
|
exports.makeShortErrorMessage = makeShortErrorMessage;
|
|
45
|
-
exports.makeUrlQueryString =
|
|
46
|
+
exports.makeUrlQueryString = require_LoginWithAuth0.makeUrlQueryString;
|
|
47
|
+
exports.parseNovaInstanceUrl = require_LoginWithAuth0.parseNovaInstanceUrl;
|
|
48
|
+
exports.parseUrl = require_LoginWithAuth0.parseUrl;
|
|
46
49
|
exports.poseToWandelscriptString = require_NovaClient.poseToWandelscriptString;
|
|
47
|
-
exports.radiansToDegrees =
|
|
48
|
-
exports.tryParseJson =
|
|
49
|
-
exports.
|
|
50
|
+
exports.radiansToDegrees = require_LoginWithAuth0.radiansToDegrees;
|
|
51
|
+
exports.tryParseJson = require_LoginWithAuth0.tryParseJson;
|
|
52
|
+
exports.tryParseUrl = require_LoginWithAuth0.tryParseUrl;
|
|
53
|
+
exports.tryStringifyJson = require_LoginWithAuth0.tryStringifyJson;
|
|
50
54
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["tryStringifyJson"],"sources":["../src/lib/errorHandling.ts"],"sourcesContent":["import { isAxiosError } from \"axios\"\nimport { tryStringifyJson } from \"./converters\"\n\nexport function delay(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * @deprecated Use makeErrorMessage instead and truncate the error for display as needed, or make a situation-specific localized error message based on a response code\n */\nexport function makeShortErrorMessage(err: unknown) {\n return makeErrorMessage(err)\n}\n\n/**\n * Attempts to make a helpful error message from an unknown thrown error\n * or promise rejection.\n *\n * This function is mainly to aid debugging and good bug reports. For\n * expected errors encountered by end users, it's more ideal to catch\n * the specific error code and provide a localized app-specific error message.\n */\nexport function makeErrorMessage(err: unknown): string {\n if (isAxiosError(err)) {\n if (err.response) {\n return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || \"accessing\"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`\n } else if (err.config) {\n if (err.code === \"ERR_NETWORK\") {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}. This error can happen because of either connection issues or server CORS policy.`\n } else {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}`\n }\n }\n } else if (err instanceof Error) {\n return err.message\n } else if (typeof err === \"string\") {\n return err\n } else if (typeof err === \"object\") {\n return tryStringifyJson(err) || `Unserializable object ${err}`\n }\n\n return `${err}`\n}\n"],"mappings":";;;;;AAGA,SAAgB,MAAM,IAAY;AAChC,QAAO,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;AAM1D,SAAgB,sBAAsB,KAAc;AAClD,QAAO,iBAAiB,IAAI;;;;;;;;;;AAW9B,SAAgB,iBAAiB,KAAsB;AACrD,6BAAiB,IAAI,EACnB;MAAI,IAAI,SACN,QAAO,GAAG,IAAI,UAAU,OAAO,GAAG,IAAI,UAAU,WAAW,QAAQ,IAAI,UAAU,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,UAAU,OAAO,IAAI,IAAI,KAAK,UAAU,IAAI,UAAU,KAAK;WACtL,IAAI,OACb,KAAI,IAAI,SAAS,cACf,QAAO,GAAG,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,OAAO,IAAI;MAEhG,QAAO,GAAG,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,OAAO;YAGvF,eAAe,MACxB,QAAO,IAAI;UACF,OAAO,QAAQ,SACxB,QAAO;UACE,OAAO,QAAQ,SACxB,QAAOA,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["tryStringifyJson"],"sources":["../src/lib/errorHandling.ts"],"sourcesContent":["import { isAxiosError } from \"axios\"\nimport { tryStringifyJson } from \"./converters\"\n\nexport function delay(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * @deprecated Use makeErrorMessage instead and truncate the error for display as needed, or make a situation-specific localized error message based on a response code\n */\nexport function makeShortErrorMessage(err: unknown) {\n return makeErrorMessage(err)\n}\n\n/**\n * Attempts to make a helpful error message from an unknown thrown error\n * or promise rejection.\n *\n * This function is mainly to aid debugging and good bug reports. For\n * expected errors encountered by end users, it's more ideal to catch\n * the specific error code and provide a localized app-specific error message.\n */\nexport function makeErrorMessage(err: unknown): string {\n if (isAxiosError(err)) {\n if (err.response) {\n return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || \"accessing\"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`\n } else if (err.config) {\n if (err.code === \"ERR_NETWORK\") {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}. This error can happen because of either connection issues or server CORS policy.`\n } else {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}`\n }\n }\n } else if (err instanceof Error) {\n return err.message\n } else if (typeof err === \"string\") {\n return err\n } else if (typeof err === \"object\") {\n return tryStringifyJson(err) || `Unserializable object ${err}`\n }\n\n return `${err}`\n}\n"],"mappings":";;;;;AAGA,SAAgB,MAAM,IAAY;AAChC,QAAO,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;AAM1D,SAAgB,sBAAsB,KAAc;AAClD,QAAO,iBAAiB,IAAI;;;;;;;;;;AAW9B,SAAgB,iBAAiB,KAAsB;AACrD,6BAAiB,IAAI,EACnB;MAAI,IAAI,SACN,QAAO,GAAG,IAAI,UAAU,OAAO,GAAG,IAAI,UAAU,WAAW,QAAQ,IAAI,UAAU,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,UAAU,OAAO,IAAI,IAAI,KAAK,UAAU,IAAI,UAAU,KAAK;WACtL,IAAI,OACb,KAAI,IAAI,SAAS,cACf,QAAO,GAAG,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,OAAO,IAAI;MAEhG,QAAO,GAAG,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,OAAO;YAGvF,eAAe,MACxB,QAAO,IAAI;UACF,OAAO,QAAQ,SACxB,QAAO;UACE,OAAO,QAAQ,SACxB,QAAOA,wCAAiB,IAAI,IAAI,yBAAyB;AAG3D,QAAO,GAAG"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-Qcrbm3Kb.cjs";
|
|
2
|
-
import { d as poseToWandelscriptString, n as NovaClientConfig, t as NovaClient } from "./NovaClient-
|
|
2
|
+
import { d as poseToWandelscriptString, n as NovaClientConfig, t as NovaClient } from "./NovaClient-PNinV5c4.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/availableStorage.d.ts
|
|
5
5
|
/**
|
|
@@ -17,6 +17,32 @@ declare class AvailableStorage {
|
|
|
17
17
|
declare const availableStorage: AvailableStorage;
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/lib/converters.d.ts
|
|
20
|
+
type URLParseOptions = {
|
|
21
|
+
/**
|
|
22
|
+
* Ignore any scheme in the input string and force this scheme instead.
|
|
23
|
+
*/
|
|
24
|
+
scheme?: "http" | "https";
|
|
25
|
+
/**
|
|
26
|
+
* If the input string does not include a scheme, use this as the default
|
|
27
|
+
* scheme.
|
|
28
|
+
*/
|
|
29
|
+
defaultScheme?: "http" | "https";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Parse a string as a URL, with options to enforce or default the scheme.
|
|
33
|
+
*/
|
|
34
|
+
declare function parseUrl(url: string, options?: URLParseOptions): URL;
|
|
35
|
+
/**
|
|
36
|
+
* Attempt to parse a string as a URL; return undefined if we can't
|
|
37
|
+
*/
|
|
38
|
+
declare function tryParseUrl(url: string, options?: URLParseOptions): URL | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Permissively parse a NOVA instance URL from a config variable.
|
|
41
|
+
* If scheme is not specified, defaults to https for *.wandelbots.io hosts,
|
|
42
|
+
* and http otherwise.
|
|
43
|
+
* Throws an error if a valid URL could not be determined.
|
|
44
|
+
*/
|
|
45
|
+
declare function parseNovaInstanceUrl(url: string): URL;
|
|
20
46
|
/** Try to parse something as JSON; return undefined if we can't */
|
|
21
47
|
declare function tryParseJson(json: unknown): any;
|
|
22
48
|
/** Try to turn something into JSON; return undefined if we can't */
|
|
@@ -62,12 +88,17 @@ declare function makeShortErrorMessage(err: unknown): string;
|
|
|
62
88
|
declare function makeErrorMessage(err: unknown): string;
|
|
63
89
|
//#endregion
|
|
64
90
|
//#region src/LoginWithAuth0.d.ts
|
|
91
|
+
/** Determine which Auth0 configuration to use based on instance URL */
|
|
92
|
+
declare const getAuth0Config: (instanceUrl: URL) => {
|
|
93
|
+
domain: string;
|
|
94
|
+
clientId: string;
|
|
95
|
+
};
|
|
65
96
|
/**
|
|
66
97
|
* Initializes Auth0 login process using redirect if necessary and retrieves an access token.
|
|
67
98
|
* Returns null when an access token should not be needed to authenticate (i.e. cookie auth
|
|
68
99
|
* when deployed on the instance domain)
|
|
69
100
|
*/
|
|
70
|
-
declare const loginWithAuth0: (instanceUrl:
|
|
101
|
+
declare const loginWithAuth0: (instanceUrl: URL) => Promise<string | null>;
|
|
71
102
|
//#endregion
|
|
72
|
-
export { AutoReconnectingWebsocket, NovaClient, NovaClientConfig, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeShortErrorMessage, makeUrlQueryString, poseToWandelscriptString, radiansToDegrees, tryParseJson, tryStringifyJson };
|
|
103
|
+
export { AutoReconnectingWebsocket, NovaClient, NovaClientConfig, URLParseOptions, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, getAuth0Config, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeShortErrorMessage, makeUrlQueryString, parseNovaInstanceUrl, parseUrl, poseToWandelscriptString, radiansToDegrees, tryParseJson, tryParseUrl, tryStringifyJson };
|
|
73
104
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/lib/availableStorage.ts","../src/lib/converters.ts","../src/lib/errorHandling.ts","../src/LoginWithAuth0.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAIM,gBAAA,CAAgB;EAyCT,SAAA,EAAA,OAAA;2BAtCc,QAAQ;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/lib/availableStorage.ts","../src/lib/converters.ts","../src/lib/errorHandling.ts","../src/LoginWithAuth0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,cFrBkC,EAAA,CAAA,WAA0B,EEsB1D,GFtB0D,EAAA,GEuBtE,OFvBsE,CAAA,MAAA,GAAA,IAAA,CAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-dHe-kceU.mjs";
|
|
2
|
-
import { d as poseToWandelscriptString, n as NovaClientConfig, t as NovaClient } from "./NovaClient-
|
|
2
|
+
import { d as poseToWandelscriptString, n as NovaClientConfig, t as NovaClient } from "./NovaClient-C0GXOu4w.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/availableStorage.d.ts
|
|
5
5
|
/**
|
|
@@ -17,6 +17,32 @@ declare class AvailableStorage {
|
|
|
17
17
|
declare const availableStorage: AvailableStorage;
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/lib/converters.d.ts
|
|
20
|
+
type URLParseOptions = {
|
|
21
|
+
/**
|
|
22
|
+
* Ignore any scheme in the input string and force this scheme instead.
|
|
23
|
+
*/
|
|
24
|
+
scheme?: "http" | "https";
|
|
25
|
+
/**
|
|
26
|
+
* If the input string does not include a scheme, use this as the default
|
|
27
|
+
* scheme.
|
|
28
|
+
*/
|
|
29
|
+
defaultScheme?: "http" | "https";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Parse a string as a URL, with options to enforce or default the scheme.
|
|
33
|
+
*/
|
|
34
|
+
declare function parseUrl(url: string, options?: URLParseOptions): URL;
|
|
35
|
+
/**
|
|
36
|
+
* Attempt to parse a string as a URL; return undefined if we can't
|
|
37
|
+
*/
|
|
38
|
+
declare function tryParseUrl(url: string, options?: URLParseOptions): URL | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Permissively parse a NOVA instance URL from a config variable.
|
|
41
|
+
* If scheme is not specified, defaults to https for *.wandelbots.io hosts,
|
|
42
|
+
* and http otherwise.
|
|
43
|
+
* Throws an error if a valid URL could not be determined.
|
|
44
|
+
*/
|
|
45
|
+
declare function parseNovaInstanceUrl(url: string): URL;
|
|
20
46
|
/** Try to parse something as JSON; return undefined if we can't */
|
|
21
47
|
declare function tryParseJson(json: unknown): any;
|
|
22
48
|
/** Try to turn something into JSON; return undefined if we can't */
|
|
@@ -62,12 +88,17 @@ declare function makeShortErrorMessage(err: unknown): string;
|
|
|
62
88
|
declare function makeErrorMessage(err: unknown): string;
|
|
63
89
|
//#endregion
|
|
64
90
|
//#region src/LoginWithAuth0.d.ts
|
|
91
|
+
/** Determine which Auth0 configuration to use based on instance URL */
|
|
92
|
+
declare const getAuth0Config: (instanceUrl: URL) => {
|
|
93
|
+
domain: string;
|
|
94
|
+
clientId: string;
|
|
95
|
+
};
|
|
65
96
|
/**
|
|
66
97
|
* Initializes Auth0 login process using redirect if necessary and retrieves an access token.
|
|
67
98
|
* Returns null when an access token should not be needed to authenticate (i.e. cookie auth
|
|
68
99
|
* when deployed on the instance domain)
|
|
69
100
|
*/
|
|
70
|
-
declare const loginWithAuth0: (instanceUrl:
|
|
101
|
+
declare const loginWithAuth0: (instanceUrl: URL) => Promise<string | null>;
|
|
71
102
|
//#endregion
|
|
72
|
-
export { AutoReconnectingWebsocket, NovaClient, NovaClientConfig, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeShortErrorMessage, makeUrlQueryString, poseToWandelscriptString, radiansToDegrees, tryParseJson, tryStringifyJson };
|
|
103
|
+
export { AutoReconnectingWebsocket, NovaClient, NovaClientConfig, URLParseOptions, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, getAuth0Config, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeShortErrorMessage, makeUrlQueryString, parseNovaInstanceUrl, parseUrl, poseToWandelscriptString, radiansToDegrees, tryParseJson, tryParseUrl, tryStringifyJson };
|
|
73
104
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/availableStorage.ts","../src/lib/converters.ts","../src/lib/errorHandling.ts","../src/LoginWithAuth0.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAIM,gBAAA,CAAgB;EAyCT,SAAA,EAAA,OAAA;2BAtCc,QAAQ;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/availableStorage.ts","../src/lib/converters.ts","../src/lib/errorHandling.ts","../src/LoginWithAuth0.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAIM,gBAAA,CAAgB;EAyCT,SAAA,EAAA,OAAA;2BAtCc,QAAQ;;;ECPvB,SAAA,CAAA,GAAA,EAAA,MAAe,EAAA,KAAA,EAAA,MAAA,CAAA,EAAA,IAAA,GAAA,SAAA;EAeX,SAAA,CAAA,GAAQ,EAAA,MAAA,CAAA,EAAuB,MAAA,GAAA,IAAA;AAoB/C;AAiBgB,cDPH,gBCOuB,EDPP,gBCOyB;;;KApD1C,eAAA;;;;EDIN,MAAA,CAAA,EAAA,MAAA,GAAA,OAAgB;EAyCT;;;;EC7CD,aAAA,CAAA,EAAA,MAAe,GAAA,OAAA;AAe3B,CAAA;AAoBA;AAiBA;AAWA;AASgB,iBAzDA,QAAA,CAyDgB,GAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAzDe,eAyDf,CAAA,EAzDsC,GAyDtC;AAahC;AAMA;AAKA;AAQgB,iBArEA,WAAA,CAqEsB,GAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAnE3B,eAmE2B,CAAA,EAlEnC,GAkEmC,GAAA,SAAA;AAatC;;;;AClHA;AAOA;AAYgB,iBD8BA,oBAAA,CC9BgB,GAAA,EAAA,MAAA,CAAA,ED8BmB,GC9BnB;;iBDyChB,YAAA;;AEzCH,iBFkDG,gBAAA,CElD+B,IAAA,EAAA,OAAA,CAAA,EAAA,MAAA,GAAA,SAAA;AAc/C;;;;;iBFiDgB,kBAAA,MAAwB;;iBAMxB,gBAAA;;iBAKA,gBAAA;;;;;iBAQA,sBAAA;;;;cAaH;;;;;;;iBClHG,KAAA,cAAgB;;;;AFC1B,iBEMU,qBAAA,CFHW,GAAO,EAAA,OAAA,CAAA,EAAA,MAAA;AAsClC;;;;AC7CA;AAeA;AAoBA;AAiBA;AAWgB,iBCzCA,gBAAA,CDyCY,GAAA,EAAA,OAAA,CAAA,EAAA,MAAA;;;;cEzCf,8BAA+B;;;;AHuB5C;;;;AC7CA;AAegB,cEqBH,cFrBkC,EAAA,CAAA,WAA0B,EEsB1D,GFtB0D,EAAA,GEuBtE,OFvBsE,CAAA,MAAA,GAAA,IAAA,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as availableStorage, r as
|
|
2
|
-
import {
|
|
1
|
+
import { a as isSameCoordinateSystem, c as parseUrl, d as tryParseUrl, f as tryStringifyJson, i as degreesToRadians, l as radiansToDegrees, m as AutoReconnectingWebsocket, n as loginWithAuth0, o as makeUrlQueryString, p as availableStorage, r as XYZ_TO_VECTOR, s as parseNovaInstanceUrl, t as getAuth0Config, u as tryParseJson } from "./LoginWithAuth0-DBe9CXOr.mjs";
|
|
2
|
+
import { o as poseToWandelscriptString, t as NovaClient } from "./NovaClient-C27dk3Ql.mjs";
|
|
3
3
|
import { isAxiosError } from "axios";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/errorHandling.ts
|
|
@@ -32,5 +32,5 @@ function makeErrorMessage(err) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
35
|
-
export { AutoReconnectingWebsocket, NovaClient, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeShortErrorMessage, makeUrlQueryString, poseToWandelscriptString, radiansToDegrees, tryParseJson, tryStringifyJson };
|
|
35
|
+
export { AutoReconnectingWebsocket, NovaClient, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, getAuth0Config, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeShortErrorMessage, makeUrlQueryString, parseNovaInstanceUrl, parseUrl, poseToWandelscriptString, radiansToDegrees, tryParseJson, tryParseUrl, tryStringifyJson };
|
|
36
36
|
//# sourceMappingURL=index.mjs.map
|
package/dist/lib/v1/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_LoginWithAuth0 = require('../../LoginWithAuth0-
|
|
2
|
-
const require_NovaClient = require('../../NovaClient-
|
|
1
|
+
const require_LoginWithAuth0 = require('../../LoginWithAuth0-iXpPiCcz.cjs');
|
|
2
|
+
const require_NovaClient = require('../../NovaClient-j40sHBBq.cjs');
|
|
3
3
|
let axios = require("axios");
|
|
4
4
|
let mobx = require("mobx");
|
|
5
5
|
|
|
@@ -46,7 +46,7 @@ var ProgramStateConnection = class {
|
|
|
46
46
|
(0, mobx.makeAutoObservable)(this, {}, { autoBind: true });
|
|
47
47
|
this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`);
|
|
48
48
|
this.programStateSocket.addEventListener("message", (ev) => {
|
|
49
|
-
const msg =
|
|
49
|
+
const msg = require_LoginWithAuth0.tryParseJson(ev.data);
|
|
50
50
|
if (!msg) {
|
|
51
51
|
console.error("Failed to parse program state message", ev.data);
|
|
52
52
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["lastMotionIds: Set<string>","newTrajectories: GetTrajectoryResponse[]","nova: NovaClient","tryParseJson","AxiosError"],"sources":["../../../src/lib/v1/getLatestTrajectories.ts","../../../src/lib/v1/ProgramStateConnection.ts"],"sourcesContent":["import type { GetTrajectoryResponse } from \"@wandelbots/nova-api/v1\"\nimport type { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\nlet lastMotionIds: Set<string> = new Set()\n\nexport async function getLatestTrajectories(\n apiClient: NovaCellAPIClient,\n sampleTime: number = 50,\n responsesCoordinateSystem?: string,\n): Promise<GetTrajectoryResponse[]> {\n const newTrajectories: GetTrajectoryResponse[] = []\n\n try {\n const motions = await apiClient.motion.listMotions()\n const currentMotionIds = new Set(motions.motions)\n\n const newMotionIds = Array.from(currentMotionIds).filter(\n (id) => !lastMotionIds.has(id),\n )\n\n for (const motionId of newMotionIds) {\n const trajectory = await apiClient.motion.getMotionTrajectory(\n motionId,\n sampleTime,\n responsesCoordinateSystem,\n )\n newTrajectories.push(trajectory)\n }\n\n lastMotionIds = currentMotionIds\n } catch (error) {\n console.error(\"Failed to get latest trajectories:\", error)\n }\n\n return newTrajectories\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { CollectionValue } from \"@wandelbots/nova-api/v1\"\nimport { AxiosError } from \"axios\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport type { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\nexport type ProgramRunnerLogEntry = {\n timestamp: number\n message: string\n level?: \"warn\" | \"error\"\n}\n\nexport enum ProgramState {\n NotStarted = \"not started\",\n Running = \"running\",\n Stopped = \"stopped\",\n Failed = \"failed\",\n Completed = \"completed\",\n}\n\nexport type CurrentProgram = {\n id?: string\n wandelscript?: string\n state?: ProgramState\n}\n\ntype ProgramStateMessage = {\n type: string\n runner: {\n id: string\n state: ProgramState\n start_time?: number | null\n execution_time?: number | null\n }\n}\n\n/**\n * Interface for running Wandelscript programs on the Nova instance and\n * tracking their progress and output\n */\nexport class ProgramStateConnection {\n currentProgram: CurrentProgram = {}\n logs: ProgramRunnerLogEntry[] = []\n\n executionState = \"idle\" as \"idle\" | \"starting\" | \"executing\" | \"stopping\"\n currentlyExecutingProgramRunnerId = null as string | null\n\n programStateSocket: AutoReconnectingWebsocket\n\n constructor(readonly nova: NovaClient) {\n makeAutoObservable(this, {}, { autoBind: true })\n\n this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)\n\n this.programStateSocket.addEventListener(\"message\", (ev) => {\n const msg = tryParseJson(ev.data)\n\n if (!msg) {\n console.error(\"Failed to parse program state message\", ev.data)\n return\n }\n if (msg.type === \"update\") {\n this.handleProgramStateMessage(msg)\n }\n })\n }\n\n /** Handle a program state update from the backend */\n async handleProgramStateMessage(msg: ProgramStateMessage) {\n const { runner } = msg\n\n // Ignoring other programs for now\n // TODO - show if execution state is busy from another source\n if (runner.id !== this.currentlyExecutingProgramRunnerId) return\n\n if (runner.state === ProgramState.Failed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n // TODO - wandelengine should send print statements in real time over\n // websocket as well, rather than at the end\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.logError(\n `Program runner ${runner.id} failed with error: ${runnerState.error}\\n${runnerState.traceback}`,\n )\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.currentProgram.state = ProgramState.Failed\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Stopped) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n\n this.currentProgram.state = ProgramState.Stopped\n this.log(`Program runner ${runner.id} stopped`)\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Completed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.log(\n `Program runner ${runner.id} finished successfully in ${runner.execution_time?.toFixed(2)} seconds`,\n )\n\n this.currentProgram.state = ProgramState.Completed\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Running) {\n this.currentProgram.state = ProgramState.Running\n this.log(`Program runner ${runner.id} now running`)\n } else if (runner.state !== ProgramState.NotStarted) {\n console.error(runner)\n this.logError(\n `Program runner ${runner.id} entered unexpected state: ${runner.state}`,\n )\n this.currentProgram.state = ProgramState.NotStarted\n this.gotoIdleState()\n }\n }\n\n /** Call when a program is no longer executing */\n gotoIdleState() {\n runInAction(() => {\n this.executionState = \"idle\"\n })\n this.currentlyExecutingProgramRunnerId = null\n }\n\n async executeProgram(\n wandelscript: string,\n initial_state?: { [key: string]: CollectionValue },\n activeRobot?: MotionStreamConnection,\n ) {\n this.currentProgram = {\n wandelscript: wandelscript,\n state: ProgramState.NotStarted,\n }\n\n const { currentProgram: openProgram } = this\n if (!openProgram) return\n runInAction(() => {\n this.executionState = \"starting\"\n })\n\n // Jogging can cause program execution to fail for some time after\n // So we need to explicitly stop jogging before running a program\n if (activeRobot) {\n try {\n await this.nova.api.motionGroupJogging.stopJogging(\n activeRobot.motionGroupId,\n )\n } catch (err) {\n console.error(err)\n }\n }\n\n // WOS-1539: Wandelengine parser currently breaks if there are empty lines with indentation\n const trimmedCode = openProgram.wandelscript!.replaceAll(/^\\s*$/gm, \"\")\n\n try {\n const programRunnerRef = await this.nova.api.program.createProgramRunner(\n {\n code: trimmedCode,\n initial_state: initial_state,\n // @ts-expect-error legacy code - check if param still used\n default_robot: activeRobot?.wandelscriptIdentifier,\n },\n {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n )\n\n this.log(`Created program runner ${programRunnerRef.id}\"`)\n runInAction(() => {\n this.executionState = \"executing\"\n })\n this.currentlyExecutingProgramRunnerId = programRunnerRef.id\n } catch (error) {\n if (error instanceof AxiosError && error.response && error.request) {\n this.logError(\n `${error.response.status} ${error.response.statusText} from ${error.response.config.url} ${JSON.stringify(error.response.data)}`,\n )\n } else {\n this.logError(JSON.stringify(error))\n }\n runInAction(() => {\n this.executionState = \"idle\"\n })\n }\n }\n\n async stopProgram() {\n if (!this.currentlyExecutingProgramRunnerId) return\n runInAction(() => {\n this.executionState = \"stopping\"\n })\n\n try {\n await this.nova.api.program.stopProgramRunner(\n this.currentlyExecutingProgramRunnerId,\n )\n } catch (err) {\n // Reactivate the stop button so user can try again\n runInAction(() => {\n this.executionState = \"executing\"\n })\n throw err\n }\n }\n\n reset() {\n this.currentProgram = {}\n }\n\n log(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n })\n }\n\n logError(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n level: \"error\",\n })\n }\n}\n"],"mappings":";;;;;;AAGA,IAAIA,gCAA6B,IAAI,KAAK;AAE1C,eAAsB,sBACpB,WACA,aAAqB,IACrB,2BACkC;CAClC,MAAMC,kBAA2C,EAAE;AAEnD,KAAI;EACF,MAAM,UAAU,MAAM,UAAU,OAAO,aAAa;EACpD,MAAM,mBAAmB,IAAI,IAAI,QAAQ,QAAQ;EAEjD,MAAM,eAAe,MAAM,KAAK,iBAAiB,CAAC,QAC/C,OAAO,CAAC,cAAc,IAAI,GAAG,CAC/B;AAED,OAAK,MAAM,YAAY,cAAc;GACnC,MAAM,aAAa,MAAM,UAAU,OAAO,oBACxC,UACA,YACA,0BACD;AACD,mBAAgB,KAAK,WAAW;;AAGlC,kBAAgB;UACT,OAAO;AACd,UAAQ,MAAM,sCAAsC,MAAM;;AAG5D,QAAO;;;;;ACnBT,IAAY,wDAAL;AACL;AACA;AACA;AACA;AACA;;;;;;;AAuBF,IAAa,yBAAb,MAAoC;CASlC,YAAY,AAASC,MAAkB;EAAlB;wBARY,EAAE;cACH,EAAE;wBAEjB;2CACmB;AAKlC,+BAAmB,MAAM,EAAE,EAAE,EAAE,UAAU,MAAM,CAAC;AAEhD,OAAK,qBAAqB,KAAK,0BAA0B,kBAAkB;AAE3E,OAAK,mBAAmB,iBAAiB,YAAY,OAAO;GAC1D,MAAM,MAAMC,gCAAa,GAAG,KAAK;AAEjC,OAAI,CAAC,KAAK;AACR,YAAQ,MAAM,yCAAyC,GAAG,KAAK;AAC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K,kCAAmC;AAC7C,8BAAkB;AAChB,QAAK,iBAAiB;IACtB;AAEF,MAAI;AACF,SAAM,KAAK,KAAK,IAAI,QAAQ,kBAC1B,KAAK,kCACN;WACM,KAAK;AAEZ,+BAAkB;AAChB,SAAK,iBAAiB;KACtB;AACF,SAAM;;;CAIV,QAAQ;AACN,OAAK,iBAAiB,EAAE;;CAG1B,IAAI,SAAiB;AACnB,UAAQ,IAAI,QAAQ;AACpB,OAAK,KAAK,KAAK;GACb,WAAW,KAAK,KAAK;GACrB;GACD,CAAC;;CAGJ,SAAS,SAAiB;AACxB,UAAQ,IAAI,QAAQ;AACpB,OAAK,KAAK,KAAK;GACb,WAAW,KAAK,KAAK;GACrB;GACA,OAAO;GACR,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["lastMotionIds: Set<string>","newTrajectories: GetTrajectoryResponse[]","nova: NovaClient","tryParseJson","AxiosError"],"sources":["../../../src/lib/v1/getLatestTrajectories.ts","../../../src/lib/v1/ProgramStateConnection.ts"],"sourcesContent":["import type { GetTrajectoryResponse } from \"@wandelbots/nova-api/v1\"\nimport type { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\nlet lastMotionIds: Set<string> = new Set()\n\nexport async function getLatestTrajectories(\n apiClient: NovaCellAPIClient,\n sampleTime: number = 50,\n responsesCoordinateSystem?: string,\n): Promise<GetTrajectoryResponse[]> {\n const newTrajectories: GetTrajectoryResponse[] = []\n\n try {\n const motions = await apiClient.motion.listMotions()\n const currentMotionIds = new Set(motions.motions)\n\n const newMotionIds = Array.from(currentMotionIds).filter(\n (id) => !lastMotionIds.has(id),\n )\n\n for (const motionId of newMotionIds) {\n const trajectory = await apiClient.motion.getMotionTrajectory(\n motionId,\n sampleTime,\n responsesCoordinateSystem,\n )\n newTrajectories.push(trajectory)\n }\n\n lastMotionIds = currentMotionIds\n } catch (error) {\n console.error(\"Failed to get latest trajectories:\", error)\n }\n\n return newTrajectories\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { CollectionValue } from \"@wandelbots/nova-api/v1\"\nimport { AxiosError } from \"axios\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport type { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\nexport type ProgramRunnerLogEntry = {\n timestamp: number\n message: string\n level?: \"warn\" | \"error\"\n}\n\nexport enum ProgramState {\n NotStarted = \"not started\",\n Running = \"running\",\n Stopped = \"stopped\",\n Failed = \"failed\",\n Completed = \"completed\",\n}\n\nexport type CurrentProgram = {\n id?: string\n wandelscript?: string\n state?: ProgramState\n}\n\ntype ProgramStateMessage = {\n type: string\n runner: {\n id: string\n state: ProgramState\n start_time?: number | null\n execution_time?: number | null\n }\n}\n\n/**\n * Interface for running Wandelscript programs on the Nova instance and\n * tracking their progress and output\n */\nexport class ProgramStateConnection {\n currentProgram: CurrentProgram = {}\n logs: ProgramRunnerLogEntry[] = []\n\n executionState = \"idle\" as \"idle\" | \"starting\" | \"executing\" | \"stopping\"\n currentlyExecutingProgramRunnerId = null as string | null\n\n programStateSocket: AutoReconnectingWebsocket\n\n constructor(readonly nova: NovaClient) {\n makeAutoObservable(this, {}, { autoBind: true })\n\n this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)\n\n this.programStateSocket.addEventListener(\"message\", (ev) => {\n const msg = tryParseJson(ev.data)\n\n if (!msg) {\n console.error(\"Failed to parse program state message\", ev.data)\n return\n }\n if (msg.type === \"update\") {\n this.handleProgramStateMessage(msg)\n }\n })\n }\n\n /** Handle a program state update from the backend */\n async handleProgramStateMessage(msg: ProgramStateMessage) {\n const { runner } = msg\n\n // Ignoring other programs for now\n // TODO - show if execution state is busy from another source\n if (runner.id !== this.currentlyExecutingProgramRunnerId) return\n\n if (runner.state === ProgramState.Failed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n // TODO - wandelengine should send print statements in real time over\n // websocket as well, rather than at the end\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.logError(\n `Program runner ${runner.id} failed with error: ${runnerState.error}\\n${runnerState.traceback}`,\n )\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.currentProgram.state = ProgramState.Failed\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Stopped) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n\n this.currentProgram.state = ProgramState.Stopped\n this.log(`Program runner ${runner.id} stopped`)\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Completed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.log(\n `Program runner ${runner.id} finished successfully in ${runner.execution_time?.toFixed(2)} seconds`,\n )\n\n this.currentProgram.state = ProgramState.Completed\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Running) {\n this.currentProgram.state = ProgramState.Running\n this.log(`Program runner ${runner.id} now running`)\n } else if (runner.state !== ProgramState.NotStarted) {\n console.error(runner)\n this.logError(\n `Program runner ${runner.id} entered unexpected state: ${runner.state}`,\n )\n this.currentProgram.state = ProgramState.NotStarted\n this.gotoIdleState()\n }\n }\n\n /** Call when a program is no longer executing */\n gotoIdleState() {\n runInAction(() => {\n this.executionState = \"idle\"\n })\n this.currentlyExecutingProgramRunnerId = null\n }\n\n async executeProgram(\n wandelscript: string,\n initial_state?: { [key: string]: CollectionValue },\n activeRobot?: MotionStreamConnection,\n ) {\n this.currentProgram = {\n wandelscript: wandelscript,\n state: ProgramState.NotStarted,\n }\n\n const { currentProgram: openProgram } = this\n if (!openProgram) return\n runInAction(() => {\n this.executionState = \"starting\"\n })\n\n // Jogging can cause program execution to fail for some time after\n // So we need to explicitly stop jogging before running a program\n if (activeRobot) {\n try {\n await this.nova.api.motionGroupJogging.stopJogging(\n activeRobot.motionGroupId,\n )\n } catch (err) {\n console.error(err)\n }\n }\n\n // WOS-1539: Wandelengine parser currently breaks if there are empty lines with indentation\n const trimmedCode = openProgram.wandelscript!.replaceAll(/^\\s*$/gm, \"\")\n\n try {\n const programRunnerRef = await this.nova.api.program.createProgramRunner(\n {\n code: trimmedCode,\n initial_state: initial_state,\n // @ts-expect-error legacy code - check if param still used\n default_robot: activeRobot?.wandelscriptIdentifier,\n },\n {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n )\n\n this.log(`Created program runner ${programRunnerRef.id}\"`)\n runInAction(() => {\n this.executionState = \"executing\"\n })\n this.currentlyExecutingProgramRunnerId = programRunnerRef.id\n } catch (error) {\n if (error instanceof AxiosError && error.response && error.request) {\n this.logError(\n `${error.response.status} ${error.response.statusText} from ${error.response.config.url} ${JSON.stringify(error.response.data)}`,\n )\n } else {\n this.logError(JSON.stringify(error))\n }\n runInAction(() => {\n this.executionState = \"idle\"\n })\n }\n }\n\n async stopProgram() {\n if (!this.currentlyExecutingProgramRunnerId) return\n runInAction(() => {\n this.executionState = \"stopping\"\n })\n\n try {\n await this.nova.api.program.stopProgramRunner(\n this.currentlyExecutingProgramRunnerId,\n )\n } catch (err) {\n // Reactivate the stop button so user can try again\n runInAction(() => {\n this.executionState = \"executing\"\n })\n throw err\n }\n }\n\n reset() {\n this.currentProgram = {}\n }\n\n log(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n })\n }\n\n logError(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n level: \"error\",\n })\n }\n}\n"],"mappings":";;;;;;AAGA,IAAIA,gCAA6B,IAAI,K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