@wandelbots/nova-js 3.5.2-pr.feat-addTestForQueryUsingApiCAll.228.a9bede0 → 3.5.2-pr.feat-addTestForQueryUsingApiCAll.228.2a0f01e
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/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;;;ECPvB,SAAA,CAAA,GAAA,EAAA,MAAe,EAAA,KAAA,EAAA,MAAA,CAAA,EAAA,IAAA,GAAA,SAAA;EAeX,SAAA,CAAA,GAAQ,EAAA,MAAA,
|
|
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/lib/v2/index.cjs
CHANGED
|
@@ -611,7 +611,7 @@ var MockNovaInstance = class {
|
|
|
611
611
|
];
|
|
612
612
|
const method = config.method?.toUpperCase() || "GET";
|
|
613
613
|
if (!config.url) throw new Error("No url sent with request");
|
|
614
|
-
const path = config.url;
|
|
614
|
+
const path = config.url.split("?")[0];
|
|
615
615
|
for (const handler of apiHandlers) {
|
|
616
616
|
const match = path_to_regexp.match(handler.path)(path);
|
|
617
617
|
if (method === handler.method && match) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["SystemApi","CellApi","MotionGroupApi","MotionGroupModelsApi","ControllerApi","ControllerInputsOutputsApi","TrajectoryPlanningApi","TrajectoryExecutionApi","TrajectoryCachingApi","ApplicationApi","JoggingApi","KinematicsApi","BUSInputsOutputsApi","VirtualControllerApi","VirtualControllerBehaviorApi","VirtualControllerInputsOutputsApi","StoreObjectApi","StoreCollisionComponentsApi","StoreCollisionSetupsApi","pathToRegexp","AxiosError","availableStorage","parseNovaInstanceUrl","config","loginWithAuth0","AutoReconnectingWebsocket"],"sources":["../../../src/lib/v2/NovaCellAPIClient.ts","../../../src/lib/v2/mock/getCurrentRobotControllerState.ts","../../../src/lib/v2/mock/getMotionGroupDescription.ts","../../../src/lib/v2/mock/getMotionGroupKinematicModel.ts","../../../src/lib/v2/mock/getRobotController.ts","../../../src/lib/v2/mock/listCoordinateSystems.ts","../../../src/lib/v2/mock/listRobotControllers.ts","../../../src/lib/v2/mock/MockNovaInstance.ts","../../../src/lib/v2/NovaClient.ts","../../../src/lib/v2/wandelscriptUtils.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: legacy code */\n/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type {\n BaseAPI,\n Configuration as BaseConfiguration,\n} from \"@wandelbots/nova-api/v2\"\nimport {\n ApplicationApi,\n BUSInputsOutputsApi,\n CellApi,\n ControllerApi,\n ControllerInputsOutputsApi,\n JoggingApi,\n KinematicsApi,\n MotionGroupApi,\n MotionGroupModelsApi,\n StoreCollisionComponentsApi,\n StoreCollisionSetupsApi,\n StoreObjectApi,\n SystemApi,\n TrajectoryCachingApi,\n TrajectoryExecutionApi,\n TrajectoryPlanningApi,\n VirtualControllerApi,\n VirtualControllerBehaviorApi,\n VirtualControllerInputsOutputsApi,\n} from \"@wandelbots/nova-api/v2\"\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 motionGroup = this.withCellId(MotionGroupApi)\n readonly motionGroupModels =\n this.withUnwrappedResponsesOnly(MotionGroupModelsApi)\n\n readonly controller = this.withCellId(ControllerApi)\n\n readonly controllerIOs = this.withCellId(ControllerInputsOutputsApi)\n\n readonly trajectoryPlanning = this.withCellId(TrajectoryPlanningApi)\n readonly trajectoryExecution = this.withCellId(TrajectoryExecutionApi)\n readonly trajectoryCaching = this.withCellId(TrajectoryCachingApi)\n\n readonly application = this.withCellId(ApplicationApi)\n readonly applicationGlobal = this.withUnwrappedResponsesOnly(ApplicationApi)\n\n readonly jogging = this.withCellId(JoggingApi)\n\n readonly kinematics = this.withCellId(KinematicsApi)\n\n readonly busInputsOutputs = this.withCellId(BUSInputsOutputsApi)\n\n readonly virtualController = this.withCellId(VirtualControllerApi)\n readonly virtualControllerBehavior = this.withCellId(\n VirtualControllerBehaviorApi,\n )\n readonly virtualControllerIOs = this.withCellId(\n VirtualControllerInputsOutputsApi,\n )\n\n readonly storeObject = this.withCellId(StoreObjectApi)\n readonly storeCollisionComponents = this.withCellId(\n StoreCollisionComponentsApi,\n )\n readonly storeCollisionSetups = this.withCellId(StoreCollisionSetupsApi)\n}\n","export const getCurrentRobotControllerState = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/state\",\n handle() {\n return {\n mode: \"MODE_CONTROL\",\n last_error: [],\n timestamp: \"2025-10-16T09:19:26.634534092Z\",\n sequence_number: 1054764,\n controller: \"mock-ur5e\",\n operation_mode: \"OPERATION_MODE_AUTO\",\n safety_state: \"SAFETY_STATE_NORMAL\",\n velocity_override: 100,\n motion_groups: [\n {\n timestamp: \"2025-10-16T09:19:26.634534092Z\",\n sequence_number: 1054764,\n motion_group: \"0@mock-ur5e\",\n controller: \"mock-ur5e\",\n joint_position: [\n 1.487959623336792, -1.8501918315887451, 1.8003005981445312,\n 6.034560203552246, 1.4921919107437134, 1.593459963798523,\n ],\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n joint_torque: [],\n joint_current: [0, 0, 0, 0, 0, 0],\n flange_pose: {\n position: [\n 107.6452433732927, -409.0402987746852, 524.2402132330305,\n ],\n orientation: [\n 0.9874434028353319, -0.986571714997442, 1.3336589451098142,\n ],\n },\n tcp: \"Flange\",\n tcp_pose: {\n position: [\n 107.6452433732927, -409.0402987746852, 524.2402132330305,\n ],\n orientation: [\n 0.9874434028353319, -0.986571714997442, 1.3336589451098142,\n ],\n },\n payload: \"\",\n coordinate_system: \"\",\n standstill: true,\n },\n ],\n }\n },\n}\n","export const getMotionGroupDescription = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description\",\n handle() {\n return {\n motion_group_model: \"UniversalRobots_UR5e\",\n mounting: {\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n },\n tcps: {\n Flange: {\n name: \"Default-Flange\",\n pose: {\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n },\n },\n },\n payloads: {\n \"FPay-0\": {\n name: \"FPay-0\",\n payload: 0,\n center_of_mass: [0, 0, 0],\n moment_of_inertia: [0, 0, 0],\n },\n },\n cycle_time: 8,\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n d: 162.25,\n },\n {\n a: -425,\n },\n {\n a: -392.2,\n },\n {\n alpha: 1.5707963267948966,\n d: 133.3,\n },\n {\n alpha: -1.5707963267948966,\n d: 99.7,\n },\n {\n d: 99.6,\n },\n ],\n operation_limits: {\n auto_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n elbow: {\n velocity: 5000,\n },\n flange: {\n velocity: 5000,\n },\n },\n manual_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n manual_t1_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n manual_t2_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n },\n serial_number: \"WBVirtualRobot\",\n }\n },\n}\n","export const getMotionGroupKinematicModel = {\n method: \"GET\",\n path: \"/motion-group-models/:motionGroupModel/kinematic\",\n handle() {\n return {\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 162.25,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: -425.0,\n d: 0.0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: -392.2,\n d: 0.0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 133.3,\n reverse_rotation_direction: false,\n },\n {\n alpha: -1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 99.7,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: 0.0,\n d: 99.6,\n reverse_rotation_direction: false,\n },\n ],\n inverse_solver: \"Universalrobots\",\n }\n },\n}\n","import type { RobotController } from \"@wandelbots/nova-api/v2\"\n\nexport const getRobotController = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId\",\n handle() {\n return {\n configuration: {\n initial_joint_position: \"[0,-1.571,-1.571,-1.571,1.571,-1.571,0]\",\n kind: \"VirtualController\",\n manufacturer: \"universalrobots\",\n type: \"universalrobots-ur5e\",\n },\n name: \"mock-ur5\",\n } satisfies RobotController\n },\n}\n","export const listCoordinateSystems = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/coordinate-systems\",\n handle() {\n return [\n {\n coordinate_system: \"\",\n name: \"world\",\n reference_coordinate_system: \"\",\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n orientation_type: \"ROTATION_VECTOR\",\n },\n {\n coordinate_system: \"CS-0\",\n name: \"Default-CS\",\n reference_coordinate_system: \"\",\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n orientation_type: \"ROTATION_VECTOR\",\n },\n ]\n },\n}\n","export const listRobotControllers = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers\",\n handle() {\n return [\"mock-ur5e\"]\n },\n}\n","import type { MotionGroupState } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosResponse, InternalAxiosRequestConfig } from \"axios\"\nimport { AxiosError } from \"axios\"\nimport * as pathToRegexp from \"path-to-regexp\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { getCurrentRobotControllerState } from \"./getCurrentRobotControllerState\"\nimport { getMotionGroupDescription } from \"./getMotionGroupDescription\"\nimport { getMotionGroupKinematicModel } from \"./getMotionGroupKinematicModel\"\nimport { getRobotController } from \"./getRobotController\"\nimport { listCoordinateSystems } from \"./listCoordinateSystems\"\nimport { listRobotControllers } from \"./listRobotControllers\"\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 listRobotControllers,\n getRobotController,\n getMotionGroupDescription,\n getCurrentRobotControllerState,\n listCoordinateSystems,\n getMotionGroupKinematicModel,\n ]\n\n const method = config.method?.toUpperCase() || \"GET\"\n if (!config.url) {\n throw new Error(\"No url sent with request\")\n }\n const path = config.url\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\n // Please note: Only very basic websocket mocking is done here, needs to be extended as needed\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(\"/execution/jogging\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify({\n result: {\n message: \"string\",\n kind: \"INITIALIZE_RECEIVED\",\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 motion_group: \"0@universalrobots-ur5e\",\n controller: \"universalrobots-ur5e\",\n timestamp: new Date().toISOString(),\n sequence_number: 1,\n joint_position: [\n 1.1699999570846558, -1.5700000524520874, 1.3600000143051147,\n 1.0299999713897705, 1.2899999618530273, 1.2799999713897705,\n ],\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n standstill: false,\n flange_pose: {\n position: [1.3300010259703043, -409.2680714682808, 531.0203477065281],\n orientation: [\n 1.7564919306270736, -1.7542521568325058, 0.7326972590614671,\n ],\n },\n tcp_pose: {\n position: [1.3300010259703043, -409.2680714682808, 531.0203477065281],\n orientation: [\n 1.7564919306270736, -1.7542521568325058, 0.7326972590614671,\n ],\n },\n } satisfies MotionGroupState,\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { Configuration as BaseConfiguration } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosRequestConfig } from \"axios\"\nimport axios, { isAxiosError } from \"axios\"\nimport urlJoin from \"url-join\"\nimport { loginWithAuth0 } from \"../../LoginWithAuth0\"\nimport { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { availableStorage } from \"../availableStorage\"\nimport { parseNovaInstanceUrl } from \"../converters\"\nimport { MockNovaInstance } from \"./mock/MockNovaInstance\"\nimport { NovaCellAPIClient } from \"./NovaCellAPIClient\"\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 *\n * Client for connecting to a Nova instance and controlling robots.\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.instanceUrl.href, \"/api/v2\"),\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/v2\"),\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\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/v2/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","import type { Pose } from \"@wandelbots/nova-api/v2\"\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 = [\n pose.position?.[0] ?? 0,\n pose.position?.[1] ?? 0,\n pose.position?.[2] ?? 0,\n ]\n\n const orientation = [\n pose.orientation?.[0] ?? 0,\n pose.orientation?.[1] ?? 0,\n pose.orientation?.[2] ?? 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"],"mappings":";;;;;;;;;;;;;;AAoDA,IAAa,oBAAb,MAA+B;CAC7B,YACE,AAAS,QACT,AAAS,MAIT;EALS;EACA;gBAkFO,KAAK,2BAA2BA,kCAAU;cAC5C,KAAK,2BAA2BC,gCAAQ;qBAEjC,KAAK,WAAWC,uCAAe;2BAEpD,KAAK,2BAA2BC,6CAAqB;oBAEjC,KAAK,WAAWC,sCAAc;uBAE3B,KAAK,WAAWC,mDAA2B;4BAEtC,KAAK,WAAWC,8CAAsB;6BACrC,KAAK,WAAWC,+CAAuB;2BACzC,KAAK,WAAWC,6CAAqB;qBAE3C,KAAK,WAAWC,uCAAe;2BACzB,KAAK,2BAA2BA,uCAAe;iBAEz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P,GAAG;KACJ;IACD,EACE,GAAG,MACJ;IACF;GACD,kBAAkB;IAChB,aAAa;KACX,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACD,OAAO,EACL,UAAU,KACX;KACD,QAAQ,EACN,UAAU,KACX;KACF;IACD,eAAe;KACb,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACD,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACD,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACF;GACD,eAAe;GAChB;;CAEJ;;;;AClTD,MAAa,+BAA+B;CAC1C,QAAQ;CACR,MAAM;CACN,SAAS;AACP,SAAO;GACL,eAAe;IACb;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;KAC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AA0B,KAAK,iBAAiB,KAAK,EAAE,EAChE,MAAM,KAAK,MACZ,CAAC;;;;;;;;;;ACjNN,SAAgB,yBACd,MACA;CACA,MAAM,WAAW;EACf,KAAK,WAAW,MAAM;EACtB,KAAK,WAAW,MAAM;EACtB,KAAK,WAAW,MAAM;EACvB;CAED,MAAM,cAAc;EAClB,KAAK,cAAc,MAAM;EACzB,KAAK,cAAc,MAAM;EACzB,KAAK,cAAc,MAAM;EAC1B;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"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["SystemApi","CellApi","MotionGroupApi","MotionGroupModelsApi","ControllerApi","ControllerInputsOutputsApi","TrajectoryPlanningApi","TrajectoryExecutionApi","TrajectoryCachingApi","ApplicationApi","JoggingApi","KinematicsApi","BUSInputsOutputsApi","VirtualControllerApi","VirtualControllerBehaviorApi","VirtualControllerInputsOutputsApi","StoreObjectApi","StoreCollisionComponentsApi","StoreCollisionSetupsApi","pathToRegexp","AxiosError","availableStorage","parseNovaInstanceUrl","config","loginWithAuth0","AutoReconnectingWebsocket"],"sources":["../../../src/lib/v2/NovaCellAPIClient.ts","../../../src/lib/v2/mock/getCurrentRobotControllerState.ts","../../../src/lib/v2/mock/getMotionGroupDescription.ts","../../../src/lib/v2/mock/getMotionGroupKinematicModel.ts","../../../src/lib/v2/mock/getRobotController.ts","../../../src/lib/v2/mock/listCoordinateSystems.ts","../../../src/lib/v2/mock/listRobotControllers.ts","../../../src/lib/v2/mock/MockNovaInstance.ts","../../../src/lib/v2/NovaClient.ts","../../../src/lib/v2/wandelscriptUtils.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: legacy code */\n/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type {\n BaseAPI,\n Configuration as BaseConfiguration,\n} from \"@wandelbots/nova-api/v2\"\nimport {\n ApplicationApi,\n BUSInputsOutputsApi,\n CellApi,\n ControllerApi,\n ControllerInputsOutputsApi,\n JoggingApi,\n KinematicsApi,\n MotionGroupApi,\n MotionGroupModelsApi,\n StoreCollisionComponentsApi,\n StoreCollisionSetupsApi,\n StoreObjectApi,\n SystemApi,\n TrajectoryCachingApi,\n TrajectoryExecutionApi,\n TrajectoryPlanningApi,\n VirtualControllerApi,\n VirtualControllerBehaviorApi,\n VirtualControllerInputsOutputsApi,\n} from \"@wandelbots/nova-api/v2\"\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 motionGroup = this.withCellId(MotionGroupApi)\n readonly motionGroupModels =\n this.withUnwrappedResponsesOnly(MotionGroupModelsApi)\n\n readonly controller = this.withCellId(ControllerApi)\n\n readonly controllerIOs = this.withCellId(ControllerInputsOutputsApi)\n\n readonly trajectoryPlanning = this.withCellId(TrajectoryPlanningApi)\n readonly trajectoryExecution = this.withCellId(TrajectoryExecutionApi)\n readonly trajectoryCaching = this.withCellId(TrajectoryCachingApi)\n\n readonly application = this.withCellId(ApplicationApi)\n readonly applicationGlobal = this.withUnwrappedResponsesOnly(ApplicationApi)\n\n readonly jogging = this.withCellId(JoggingApi)\n\n readonly kinematics = this.withCellId(KinematicsApi)\n\n readonly busInputsOutputs = this.withCellId(BUSInputsOutputsApi)\n\n readonly virtualController = this.withCellId(VirtualControllerApi)\n readonly virtualControllerBehavior = this.withCellId(\n VirtualControllerBehaviorApi,\n )\n readonly virtualControllerIOs = this.withCellId(\n VirtualControllerInputsOutputsApi,\n )\n\n readonly storeObject = this.withCellId(StoreObjectApi)\n readonly storeCollisionComponents = this.withCellId(\n StoreCollisionComponentsApi,\n )\n readonly storeCollisionSetups = this.withCellId(StoreCollisionSetupsApi)\n}\n","export const getCurrentRobotControllerState = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/state\",\n handle() {\n return {\n mode: \"MODE_CONTROL\",\n last_error: [],\n timestamp: \"2025-10-16T09:19:26.634534092Z\",\n sequence_number: 1054764,\n controller: \"mock-ur5e\",\n operation_mode: \"OPERATION_MODE_AUTO\",\n safety_state: \"SAFETY_STATE_NORMAL\",\n velocity_override: 100,\n motion_groups: [\n {\n timestamp: \"2025-10-16T09:19:26.634534092Z\",\n sequence_number: 1054764,\n motion_group: \"0@mock-ur5e\",\n controller: \"mock-ur5e\",\n joint_position: [\n 1.487959623336792, -1.8501918315887451, 1.8003005981445312,\n 6.034560203552246, 1.4921919107437134, 1.593459963798523,\n ],\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n joint_torque: [],\n joint_current: [0, 0, 0, 0, 0, 0],\n flange_pose: {\n position: [\n 107.6452433732927, -409.0402987746852, 524.2402132330305,\n ],\n orientation: [\n 0.9874434028353319, -0.986571714997442, 1.3336589451098142,\n ],\n },\n tcp: \"Flange\",\n tcp_pose: {\n position: [\n 107.6452433732927, -409.0402987746852, 524.2402132330305,\n ],\n orientation: [\n 0.9874434028353319, -0.986571714997442, 1.3336589451098142,\n ],\n },\n payload: \"\",\n coordinate_system: \"\",\n standstill: true,\n },\n ],\n }\n },\n}\n","export const getMotionGroupDescription = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description\",\n handle() {\n return {\n motion_group_model: \"UniversalRobots_UR5e\",\n mounting: {\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n },\n tcps: {\n Flange: {\n name: \"Default-Flange\",\n pose: {\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n },\n },\n },\n payloads: {\n \"FPay-0\": {\n name: \"FPay-0\",\n payload: 0,\n center_of_mass: [0, 0, 0],\n moment_of_inertia: [0, 0, 0],\n },\n },\n cycle_time: 8,\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n d: 162.25,\n },\n {\n a: -425,\n },\n {\n a: -392.2,\n },\n {\n alpha: 1.5707963267948966,\n d: 133.3,\n },\n {\n alpha: -1.5707963267948966,\n d: 99.7,\n },\n {\n d: 99.6,\n },\n ],\n operation_limits: {\n auto_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n elbow: {\n velocity: 5000,\n },\n flange: {\n velocity: 5000,\n },\n },\n manual_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n manual_t1_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n manual_t2_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n },\n serial_number: \"WBVirtualRobot\",\n }\n },\n}\n","export const getMotionGroupKinematicModel = {\n method: \"GET\",\n path: \"/motion-group-models/:motionGroupModel/kinematic\",\n handle() {\n return {\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 162.25,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: -425.0,\n d: 0.0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: -392.2,\n d: 0.0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 133.3,\n reverse_rotation_direction: false,\n },\n {\n alpha: -1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 99.7,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: 0.0,\n d: 99.6,\n reverse_rotation_direction: false,\n },\n ],\n inverse_solver: \"Universalrobots\",\n }\n },\n}\n","import type { RobotController } from \"@wandelbots/nova-api/v2\"\n\nexport const getRobotController = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId\",\n handle() {\n return {\n configuration: {\n initial_joint_position: \"[0,-1.571,-1.571,-1.571,1.571,-1.571,0]\",\n kind: \"VirtualController\",\n manufacturer: \"universalrobots\",\n type: \"universalrobots-ur5e\",\n },\n name: \"mock-ur5\",\n } satisfies RobotController\n },\n}\n","export const listCoordinateSystems = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/coordinate-systems\",\n handle() {\n return [\n {\n coordinate_system: \"\",\n name: \"world\",\n reference_coordinate_system: \"\",\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n orientation_type: \"ROTATION_VECTOR\",\n },\n {\n coordinate_system: \"CS-0\",\n name: \"Default-CS\",\n reference_coordinate_system: \"\",\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n orientation_type: \"ROTATION_VECTOR\",\n },\n ]\n },\n}\n","export const listRobotControllers = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers\",\n handle() {\n return [\"mock-ur5e\"]\n },\n}\n","import type { MotionGroupState } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosResponse, InternalAxiosRequestConfig } from \"axios\"\nimport { AxiosError } from \"axios\"\nimport * as pathToRegexp from \"path-to-regexp\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { getCurrentRobotControllerState } from \"./getCurrentRobotControllerState\"\nimport { getMotionGroupDescription } from \"./getMotionGroupDescription\"\nimport { getMotionGroupKinematicModel } from \"./getMotionGroupKinematicModel\"\nimport { getRobotController } from \"./getRobotController\"\nimport { listCoordinateSystems } from \"./listCoordinateSystems\"\nimport { listRobotControllers } from \"./listRobotControllers\"\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 listRobotControllers,\n getRobotController,\n getMotionGroupDescription,\n getCurrentRobotControllerState,\n listCoordinateSystems,\n getMotionGroupKinematicModel,\n ]\n\n const method = config.method?.toUpperCase() || \"GET\"\n if (!config.url) {\n throw new Error(\"No url sent with request\")\n }\n const path = config.url.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\n // Please note: Only very basic websocket mocking is done here, needs to be extended as needed\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(\"/execution/jogging\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify({\n result: {\n message: \"string\",\n kind: \"INITIALIZE_RECEIVED\",\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 motion_group: \"0@universalrobots-ur5e\",\n controller: \"universalrobots-ur5e\",\n timestamp: new Date().toISOString(),\n sequence_number: 1,\n joint_position: [\n 1.1699999570846558, -1.5700000524520874, 1.3600000143051147,\n 1.0299999713897705, 1.2899999618530273, 1.2799999713897705,\n ],\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n standstill: false,\n flange_pose: {\n position: [1.3300010259703043, -409.2680714682808, 531.0203477065281],\n orientation: [\n 1.7564919306270736, -1.7542521568325058, 0.7326972590614671,\n ],\n },\n tcp_pose: {\n position: [1.3300010259703043, -409.2680714682808, 531.0203477065281],\n orientation: [\n 1.7564919306270736, -1.7542521568325058, 0.7326972590614671,\n ],\n },\n } satisfies MotionGroupState,\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { Configuration as BaseConfiguration } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosRequestConfig } from \"axios\"\nimport axios, { isAxiosError } from \"axios\"\nimport urlJoin from \"url-join\"\nimport { loginWithAuth0 } from \"../../LoginWithAuth0\"\nimport { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { availableStorage } from \"../availableStorage\"\nimport { parseNovaInstanceUrl } from \"../converters\"\nimport { MockNovaInstance } from \"./mock/MockNovaInstance\"\nimport { NovaCellAPIClient } from \"./NovaCellAPIClient\"\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 *\n * Client for connecting to a Nova instance and controlling robots.\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.instanceUrl.href, \"/api/v2\"),\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/v2\"),\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\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/v2/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","import type { Pose } from \"@wandelbots/nova-api/v2\"\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 = [\n pose.position?.[0] ?? 0,\n pose.position?.[1] ?? 0,\n pose.position?.[2] ?? 0,\n ]\n\n const orientation = [\n pose.orientation?.[0] ?? 0,\n pose.orientation?.[1] ?? 0,\n pose.orientation?.[2] ?? 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"],"mappings":";;;;;;;;;;;;;;AAoDA,IAAa,oBAAb,MAA+B;CAC7B,YACE,AAAS,QACT,AAAS,MAIT;EALS;EACA;gBAkFO,KAAK,2BAA2BA,kCAAU;cAC5C,KAAK,2BAA2BC,gCAAQ;qBAEjC,KAAK,WAAWC,uCAAe;2BAEpD,KAAK,2BAA2BC,6CAAqB;oBAEjC,KAAK,WAAWC,sCAAc;uBAE3B,KAAK,WAAWC,mDAA2B;4BAEtC,KAAK,WAAWC,8CAAsB;6BACrC,KAAK,WAAWC,+CAAuB;2BACzC,KAAK,WAAWC,6CAAqB;qBAE3C,KAAK,WAAWC,uCAAe;2BACzB,KAAK,2BAA2BA,uCAAe;iBAEzD,KAAK,WAAWC,mCAAW;oBAExB,KAAK,WAAWC,sCAAc;0BAExB,KAAK,WAAWC,4CAAoB;2BAEnC,KAAK,WAAWC,6CAAqB;mCAC7B,KAAK,WACxCC,qDACD;8BAC+B,KAAK,WACnCC,0DACD;qBAEsB,KAAK,WAAWC,uCAAe;kCAClB,KAAK,WACvCC,oDACD;8BAC+B,KAAK,WAAWC,gDAAwB;;;;;;;CA3GxE,AAAQ,WACN,gBAKA;EACA,MAAM,YAAY,IAAI,eACpB;GACE,GAAG,KAAK;GACR,aAAa,SAAiB;AAC5B,WAAO,SAAS;;GAEnB,EACD,KAAK,KAAK,YAAY,IACtB,KAAK,KAAK,iBAAiB,cAAM,QAAQ,CAC1C;AAID,OAAK,MAAM,OAAO,QAAQ,QAAQ,QAAQ,eAAe,UAAU,CAAE,CACnE,KAAI,QAAQ,iBAAiB,OAAO,UAAU,SAAS,YAAY;GACjE,MAAM,mBAAmB,UAAU;AACnC,aAAU,QAAQ,GAAG,SA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KACX;KACD,QAAQ,EACN,UAAU,KACX;KACF;IACD,eAAe;KACb,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACD,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACD,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACF;GACD,eAAe;GAChB;;CAEJ;;;;AClTD,MAAa,+BAA+B;CAC1C,QAAQ;CACR,MAAM;CACN,SAAS;AACP,SAAO;GACL,eAAe;IACb;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;KAC7B;IACD;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;KAC7B;IACD;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;KAC7B;IACD;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;KAC7B;IACD;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;KAC7B;IACD;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;KAC7B;IACF;GACD,gBAAgB;GACjB;;CAEJ;;;;AClDD,MAAa,qBAAqB;CAChC,QAAQ;CACR,MAAM;CACN,SAAS;AACP,SAAO;GACL,eAAe;IACb,wBAAwB;IACxB,MAAM;IACN,cAAc;IACd,MAAM;IACP;GACD,MAAM;GACP;;CAEJ;;;;AChBD,MAAa,wBAAwB;CACnC,QAAQ;CACR,MAAM;CACN,SAAS;AACP,SAAO,CACL;GACE,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ase() || "GET";
|
|
612
612
|
if (!config.url) throw new Error("No url sent with request");
|
|
613
|
-
const path = config.url;
|
|
613
|
+
const path = config.url.split("?")[0];
|
|
614
614
|
for (const handler of apiHandlers) {
|
|
615
615
|
const match = pathToRegexp.match(handler.path)(path);
|
|
616
616
|
if (method === handler.method && match) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["config"],"sources":["../../../src/lib/v2/NovaCellAPIClient.ts","../../../src/lib/v2/mock/getCurrentRobotControllerState.ts","../../../src/lib/v2/mock/getMotionGroupDescription.ts","../../../src/lib/v2/mock/getMotionGroupKinematicModel.ts","../../../src/lib/v2/mock/getRobotController.ts","../../../src/lib/v2/mock/listCoordinateSystems.ts","../../../src/lib/v2/mock/listRobotControllers.ts","../../../src/lib/v2/mock/MockNovaInstance.ts","../../../src/lib/v2/NovaClient.ts","../../../src/lib/v2/wandelscriptUtils.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: legacy code */\n/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type {\n BaseAPI,\n Configuration as BaseConfiguration,\n} from \"@wandelbots/nova-api/v2\"\nimport {\n ApplicationApi,\n BUSInputsOutputsApi,\n CellApi,\n ControllerApi,\n ControllerInputsOutputsApi,\n JoggingApi,\n KinematicsApi,\n MotionGroupApi,\n MotionGroupModelsApi,\n StoreCollisionComponentsApi,\n StoreCollisionSetupsApi,\n StoreObjectApi,\n SystemApi,\n TrajectoryCachingApi,\n TrajectoryExecutionApi,\n TrajectoryPlanningApi,\n VirtualControllerApi,\n VirtualControllerBehaviorApi,\n VirtualControllerInputsOutputsApi,\n} from \"@wandelbots/nova-api/v2\"\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 motionGroup = this.withCellId(MotionGroupApi)\n readonly motionGroupModels =\n this.withUnwrappedResponsesOnly(MotionGroupModelsApi)\n\n readonly controller = this.withCellId(ControllerApi)\n\n readonly controllerIOs = this.withCellId(ControllerInputsOutputsApi)\n\n readonly trajectoryPlanning = this.withCellId(TrajectoryPlanningApi)\n readonly trajectoryExecution = this.withCellId(TrajectoryExecutionApi)\n readonly trajectoryCaching = this.withCellId(TrajectoryCachingApi)\n\n readonly application = this.withCellId(ApplicationApi)\n readonly applicationGlobal = this.withUnwrappedResponsesOnly(ApplicationApi)\n\n readonly jogging = this.withCellId(JoggingApi)\n\n readonly kinematics = this.withCellId(KinematicsApi)\n\n readonly busInputsOutputs = this.withCellId(BUSInputsOutputsApi)\n\n readonly virtualController = this.withCellId(VirtualControllerApi)\n readonly virtualControllerBehavior = this.withCellId(\n VirtualControllerBehaviorApi,\n )\n readonly virtualControllerIOs = this.withCellId(\n VirtualControllerInputsOutputsApi,\n )\n\n readonly storeObject = this.withCellId(StoreObjectApi)\n readonly storeCollisionComponents = this.withCellId(\n StoreCollisionComponentsApi,\n )\n readonly storeCollisionSetups = this.withCellId(StoreCollisionSetupsApi)\n}\n","export const getCurrentRobotControllerState = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/state\",\n handle() {\n return {\n mode: \"MODE_CONTROL\",\n last_error: [],\n timestamp: \"2025-10-16T09:19:26.634534092Z\",\n sequence_number: 1054764,\n controller: \"mock-ur5e\",\n operation_mode: \"OPERATION_MODE_AUTO\",\n safety_state: \"SAFETY_STATE_NORMAL\",\n velocity_override: 100,\n motion_groups: [\n {\n timestamp: \"2025-10-16T09:19:26.634534092Z\",\n sequence_number: 1054764,\n motion_group: \"0@mock-ur5e\",\n controller: \"mock-ur5e\",\n joint_position: [\n 1.487959623336792, -1.8501918315887451, 1.8003005981445312,\n 6.034560203552246, 1.4921919107437134, 1.593459963798523,\n ],\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n joint_torque: [],\n joint_current: [0, 0, 0, 0, 0, 0],\n flange_pose: {\n position: [\n 107.6452433732927, -409.0402987746852, 524.2402132330305,\n ],\n orientation: [\n 0.9874434028353319, -0.986571714997442, 1.3336589451098142,\n ],\n },\n tcp: \"Flange\",\n tcp_pose: {\n position: [\n 107.6452433732927, -409.0402987746852, 524.2402132330305,\n ],\n orientation: [\n 0.9874434028353319, -0.986571714997442, 1.3336589451098142,\n ],\n },\n payload: \"\",\n coordinate_system: \"\",\n standstill: true,\n },\n ],\n }\n },\n}\n","export const getMotionGroupDescription = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description\",\n handle() {\n return {\n motion_group_model: \"UniversalRobots_UR5e\",\n mounting: {\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n },\n tcps: {\n Flange: {\n name: \"Default-Flange\",\n pose: {\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n },\n },\n },\n payloads: {\n \"FPay-0\": {\n name: \"FPay-0\",\n payload: 0,\n center_of_mass: [0, 0, 0],\n moment_of_inertia: [0, 0, 0],\n },\n },\n cycle_time: 8,\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n d: 162.25,\n },\n {\n a: -425,\n },\n {\n a: -392.2,\n },\n {\n alpha: 1.5707963267948966,\n d: 133.3,\n },\n {\n alpha: -1.5707963267948966,\n d: 99.7,\n },\n {\n d: 99.6,\n },\n ],\n operation_limits: {\n auto_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n elbow: {\n velocity: 5000,\n },\n flange: {\n velocity: 5000,\n },\n },\n manual_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n manual_t1_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n manual_t2_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n },\n serial_number: \"WBVirtualRobot\",\n }\n },\n}\n","export const getMotionGroupKinematicModel = {\n method: \"GET\",\n path: \"/motion-group-models/:motionGroupModel/kinematic\",\n handle() {\n return {\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 162.25,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: -425.0,\n d: 0.0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: -392.2,\n d: 0.0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 133.3,\n reverse_rotation_direction: false,\n },\n {\n alpha: -1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 99.7,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: 0.0,\n d: 99.6,\n reverse_rotation_direction: false,\n },\n ],\n inverse_solver: \"Universalrobots\",\n }\n },\n}\n","import type { RobotController } from \"@wandelbots/nova-api/v2\"\n\nexport const getRobotController = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId\",\n handle() {\n return {\n configuration: {\n initial_joint_position: \"[0,-1.571,-1.571,-1.571,1.571,-1.571,0]\",\n kind: \"VirtualController\",\n manufacturer: \"universalrobots\",\n type: \"universalrobots-ur5e\",\n },\n name: \"mock-ur5\",\n } satisfies RobotController\n },\n}\n","export const listCoordinateSystems = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/coordinate-systems\",\n handle() {\n return [\n {\n coordinate_system: \"\",\n name: \"world\",\n reference_coordinate_system: \"\",\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n orientation_type: \"ROTATION_VECTOR\",\n },\n {\n coordinate_system: \"CS-0\",\n name: \"Default-CS\",\n reference_coordinate_system: \"\",\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n orientation_type: \"ROTATION_VECTOR\",\n },\n ]\n },\n}\n","export const listRobotControllers = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers\",\n handle() {\n return [\"mock-ur5e\"]\n },\n}\n","import type { MotionGroupState } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosResponse, InternalAxiosRequestConfig } from \"axios\"\nimport { AxiosError } from \"axios\"\nimport * as pathToRegexp from \"path-to-regexp\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { getCurrentRobotControllerState } from \"./getCurrentRobotControllerState\"\nimport { getMotionGroupDescription } from \"./getMotionGroupDescription\"\nimport { getMotionGroupKinematicModel } from \"./getMotionGroupKinematicModel\"\nimport { getRobotController } from \"./getRobotController\"\nimport { listCoordinateSystems } from \"./listCoordinateSystems\"\nimport { listRobotControllers } from \"./listRobotControllers\"\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 listRobotControllers,\n getRobotController,\n getMotionGroupDescription,\n getCurrentRobotControllerState,\n listCoordinateSystems,\n getMotionGroupKinematicModel,\n ]\n\n const method = config.method?.toUpperCase() || \"GET\"\n if (!config.url) {\n throw new Error(\"No url sent with request\")\n }\n const path = config.url\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\n // Please note: Only very basic websocket mocking is done here, needs to be extended as needed\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(\"/execution/jogging\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify({\n result: {\n message: \"string\",\n kind: \"INITIALIZE_RECEIVED\",\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 motion_group: \"0@universalrobots-ur5e\",\n controller: \"universalrobots-ur5e\",\n timestamp: new Date().toISOString(),\n sequence_number: 1,\n joint_position: [\n 1.1699999570846558, -1.5700000524520874, 1.3600000143051147,\n 1.0299999713897705, 1.2899999618530273, 1.2799999713897705,\n ],\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n standstill: false,\n flange_pose: {\n position: [1.3300010259703043, -409.2680714682808, 531.0203477065281],\n orientation: [\n 1.7564919306270736, -1.7542521568325058, 0.7326972590614671,\n ],\n },\n tcp_pose: {\n position: [1.3300010259703043, -409.2680714682808, 531.0203477065281],\n orientation: [\n 1.7564919306270736, -1.7542521568325058, 0.7326972590614671,\n ],\n },\n } satisfies MotionGroupState,\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { Configuration as BaseConfiguration } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosRequestConfig } from \"axios\"\nimport axios, { isAxiosError } from \"axios\"\nimport urlJoin from \"url-join\"\nimport { loginWithAuth0 } from \"../../LoginWithAuth0\"\nimport { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { availableStorage } from \"../availableStorage\"\nimport { parseNovaInstanceUrl } from \"../converters\"\nimport { MockNovaInstance } from \"./mock/MockNovaInstance\"\nimport { NovaCellAPIClient } from \"./NovaCellAPIClient\"\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 *\n * Client for connecting to a Nova instance and controlling robots.\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.instanceUrl.href, \"/api/v2\"),\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/v2\"),\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\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/v2/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","import type { Pose } from \"@wandelbots/nova-api/v2\"\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 = [\n pose.position?.[0] ?? 0,\n pose.position?.[1] ?? 0,\n pose.position?.[2] ?? 0,\n ]\n\n const orientation = [\n pose.orientation?.[0] ?? 0,\n pose.orientation?.[1] ?? 0,\n pose.orientation?.[2] ?? 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"],"mappings":";;;;;;;;;;;;;AAoDA,IAAa,oBAAb,MAA+B;CAC7B,YACE,AAAS,QACT,AAAS,MAIT;EALS;EACA;gBAkFO,KAAK,2BAA2B,UAAU;cAC5C,KAAK,2BAA2B,QAAQ;qBAEjC,KAAK,WAAW,eAAe;2BAEpD,KAAK,2BAA2B,qBAAqB;oBAEjC,KAAK,WAAW,cAAc;uBAE3B,KAAK,WAAW,2BAA2B;4BAEtC,KAAK,WAAW,sBAAsB;6BACrC,KAAK,WAAW,uBAAuB;2BACzC,KAAK,WAAW,qBAAqB;qBAE3C,KAAK,WAAW,eAAe;2BACzB,KAAK,2BAA2B,eAA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G;KACJ;IACD,EACE,GAAG,MACJ;IACF;GACD,kBAAkB;IAChB,aAAa;KACX,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACD,OAAO,EACL,UAAU,KACX;KACD,QAAQ,EACN,UAAU,KACX;KACF;IACD,eAAe;KACb,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACD,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACD,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACF;GACD,eAAe;GAChB;;CAEJ;;;;AClTD,MAAa,+BAA+B;CAC1C,QAAQ;CACR,MAAM;CACN,SAAS;AACP,SAAO;GACL,eAAe;IACb;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;KAC7B;IAC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A0B,KAAK,iBAAiB,KAAK,EAAE,EAChE,MAAM,KAAK,MACZ,CAAC;;;;;;;;;;ACjNN,SAAgB,yBACd,MACA;CACA,MAAM,WAAW;EACf,KAAK,WAAW,MAAM;EACtB,KAAK,WAAW,MAAM;EACtB,KAAK,WAAW,MAAM;EACvB;CAED,MAAM,cAAc;EAClB,KAAK,cAAc,MAAM;EACzB,KAAK,cAAc,MAAM;EACzB,KAAK,cAAc,MAAM;EAC1B;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"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["config"],"sources":["../../../src/lib/v2/NovaCellAPIClient.ts","../../../src/lib/v2/mock/getCurrentRobotControllerState.ts","../../../src/lib/v2/mock/getMotionGroupDescription.ts","../../../src/lib/v2/mock/getMotionGroupKinematicModel.ts","../../../src/lib/v2/mock/getRobotController.ts","../../../src/lib/v2/mock/listCoordinateSystems.ts","../../../src/lib/v2/mock/listRobotControllers.ts","../../../src/lib/v2/mock/MockNovaInstance.ts","../../../src/lib/v2/NovaClient.ts","../../../src/lib/v2/wandelscriptUtils.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: legacy code */\n/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type {\n BaseAPI,\n Configuration as BaseConfiguration,\n} from \"@wandelbots/nova-api/v2\"\nimport {\n ApplicationApi,\n BUSInputsOutputsApi,\n CellApi,\n ControllerApi,\n ControllerInputsOutputsApi,\n JoggingApi,\n KinematicsApi,\n MotionGroupApi,\n MotionGroupModelsApi,\n StoreCollisionComponentsApi,\n StoreCollisionSetupsApi,\n StoreObjectApi,\n SystemApi,\n TrajectoryCachingApi,\n TrajectoryExecutionApi,\n TrajectoryPlanningApi,\n VirtualControllerApi,\n VirtualControllerBehaviorApi,\n VirtualControllerInputsOutputsApi,\n} from \"@wandelbots/nova-api/v2\"\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 motionGroup = this.withCellId(MotionGroupApi)\n readonly motionGroupModels =\n this.withUnwrappedResponsesOnly(MotionGroupModelsApi)\n\n readonly controller = this.withCellId(ControllerApi)\n\n readonly controllerIOs = this.withCellId(ControllerInputsOutputsApi)\n\n readonly trajectoryPlanning = this.withCellId(TrajectoryPlanningApi)\n readonly trajectoryExecution = this.withCellId(TrajectoryExecutionApi)\n readonly trajectoryCaching = this.withCellId(TrajectoryCachingApi)\n\n readonly application = this.withCellId(ApplicationApi)\n readonly applicationGlobal = this.withUnwrappedResponsesOnly(ApplicationApi)\n\n readonly jogging = this.withCellId(JoggingApi)\n\n readonly kinematics = this.withCellId(KinematicsApi)\n\n readonly busInputsOutputs = this.withCellId(BUSInputsOutputsApi)\n\n readonly virtualController = this.withCellId(VirtualControllerApi)\n readonly virtualControllerBehavior = this.withCellId(\n VirtualControllerBehaviorApi,\n )\n readonly virtualControllerIOs = this.withCellId(\n VirtualControllerInputsOutputsApi,\n )\n\n readonly storeObject = this.withCellId(StoreObjectApi)\n readonly storeCollisionComponents = this.withCellId(\n StoreCollisionComponentsApi,\n )\n readonly storeCollisionSetups = this.withCellId(StoreCollisionSetupsApi)\n}\n","export const getCurrentRobotControllerState = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/state\",\n handle() {\n return {\n mode: \"MODE_CONTROL\",\n last_error: [],\n timestamp: \"2025-10-16T09:19:26.634534092Z\",\n sequence_number: 1054764,\n controller: \"mock-ur5e\",\n operation_mode: \"OPERATION_MODE_AUTO\",\n safety_state: \"SAFETY_STATE_NORMAL\",\n velocity_override: 100,\n motion_groups: [\n {\n timestamp: \"2025-10-16T09:19:26.634534092Z\",\n sequence_number: 1054764,\n motion_group: \"0@mock-ur5e\",\n controller: \"mock-ur5e\",\n joint_position: [\n 1.487959623336792, -1.8501918315887451, 1.8003005981445312,\n 6.034560203552246, 1.4921919107437134, 1.593459963798523,\n ],\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n joint_torque: [],\n joint_current: [0, 0, 0, 0, 0, 0],\n flange_pose: {\n position: [\n 107.6452433732927, -409.0402987746852, 524.2402132330305,\n ],\n orientation: [\n 0.9874434028353319, -0.986571714997442, 1.3336589451098142,\n ],\n },\n tcp: \"Flange\",\n tcp_pose: {\n position: [\n 107.6452433732927, -409.0402987746852, 524.2402132330305,\n ],\n orientation: [\n 0.9874434028353319, -0.986571714997442, 1.3336589451098142,\n ],\n },\n payload: \"\",\n coordinate_system: \"\",\n standstill: true,\n },\n ],\n }\n },\n}\n","export const getMotionGroupDescription = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description\",\n handle() {\n return {\n motion_group_model: \"UniversalRobots_UR5e\",\n mounting: {\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n },\n tcps: {\n Flange: {\n name: \"Default-Flange\",\n pose: {\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n },\n },\n },\n payloads: {\n \"FPay-0\": {\n name: \"FPay-0\",\n payload: 0,\n center_of_mass: [0, 0, 0],\n moment_of_inertia: [0, 0, 0],\n },\n },\n cycle_time: 8,\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n d: 162.25,\n },\n {\n a: -425,\n },\n {\n a: -392.2,\n },\n {\n alpha: 1.5707963267948966,\n d: 133.3,\n },\n {\n alpha: -1.5707963267948966,\n d: 99.7,\n },\n {\n d: 99.6,\n },\n ],\n operation_limits: {\n auto_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n elbow: {\n velocity: 5000,\n },\n flange: {\n velocity: 5000,\n },\n },\n manual_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n manual_t1_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n manual_t2_limits: {\n joints: [\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 150,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n {\n position: {\n lower_limit: -6.283185307179586,\n upper_limit: 6.283185307179586,\n },\n velocity: 3.34159255027771,\n acceleration: 40,\n torque: 28,\n },\n ],\n tcp: {\n velocity: 5000,\n },\n },\n },\n serial_number: \"WBVirtualRobot\",\n }\n },\n}\n","export const getMotionGroupKinematicModel = {\n method: \"GET\",\n path: \"/motion-group-models/:motionGroupModel/kinematic\",\n handle() {\n return {\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 162.25,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: -425.0,\n d: 0.0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: -392.2,\n d: 0.0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 133.3,\n reverse_rotation_direction: false,\n },\n {\n alpha: -1.5707963267948966,\n theta: 0.0,\n a: 0.0,\n d: 99.7,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0.0,\n theta: 0.0,\n a: 0.0,\n d: 99.6,\n reverse_rotation_direction: false,\n },\n ],\n inverse_solver: \"Universalrobots\",\n }\n },\n}\n","import type { RobotController } from \"@wandelbots/nova-api/v2\"\n\nexport const getRobotController = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId\",\n handle() {\n return {\n configuration: {\n initial_joint_position: \"[0,-1.571,-1.571,-1.571,1.571,-1.571,0]\",\n kind: \"VirtualController\",\n manufacturer: \"universalrobots\",\n type: \"universalrobots-ur5e\",\n },\n name: \"mock-ur5\",\n } satisfies RobotController\n },\n}\n","export const listCoordinateSystems = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId/coordinate-systems\",\n handle() {\n return [\n {\n coordinate_system: \"\",\n name: \"world\",\n reference_coordinate_system: \"\",\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n orientation_type: \"ROTATION_VECTOR\",\n },\n {\n coordinate_system: \"CS-0\",\n name: \"Default-CS\",\n reference_coordinate_system: \"\",\n position: [0, 0, 0],\n orientation: [0, 0, 0],\n orientation_type: \"ROTATION_VECTOR\",\n },\n ]\n },\n}\n","export const listRobotControllers = {\n method: \"GET\",\n path: \"/cells/:cellId/controllers\",\n handle() {\n return [\"mock-ur5e\"]\n },\n}\n","import type { MotionGroupState } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosResponse, InternalAxiosRequestConfig } from \"axios\"\nimport { AxiosError } from \"axios\"\nimport * as pathToRegexp from \"path-to-regexp\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { getCurrentRobotControllerState } from \"./getCurrentRobotControllerState\"\nimport { getMotionGroupDescription } from \"./getMotionGroupDescription\"\nimport { getMotionGroupKinematicModel } from \"./getMotionGroupKinematicModel\"\nimport { getRobotController } from \"./getRobotController\"\nimport { listCoordinateSystems } from \"./listCoordinateSystems\"\nimport { listRobotControllers } from \"./listRobotControllers\"\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 listRobotControllers,\n getRobotController,\n getMotionGroupDescription,\n getCurrentRobotControllerState,\n listCoordinateSystems,\n getMotionGroupKinematicModel,\n ]\n\n const method = config.method?.toUpperCase() || \"GET\"\n if (!config.url) {\n throw new Error(\"No url sent with request\")\n }\n const path = config.url.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\n // Please note: Only very basic websocket mocking is done here, needs to be extended as needed\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(\"/execution/jogging\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify({\n result: {\n message: \"string\",\n kind: \"INITIALIZE_RECEIVED\",\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 motion_group: \"0@universalrobots-ur5e\",\n controller: \"universalrobots-ur5e\",\n timestamp: new Date().toISOString(),\n sequence_number: 1,\n joint_position: [\n 1.1699999570846558, -1.5700000524520874, 1.3600000143051147,\n 1.0299999713897705, 1.2899999618530273, 1.2799999713897705,\n ],\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n standstill: false,\n flange_pose: {\n position: [1.3300010259703043, -409.2680714682808, 531.0203477065281],\n orientation: [\n 1.7564919306270736, -1.7542521568325058, 0.7326972590614671,\n ],\n },\n tcp_pose: {\n position: [1.3300010259703043, -409.2680714682808, 531.0203477065281],\n orientation: [\n 1.7564919306270736, -1.7542521568325058, 0.7326972590614671,\n ],\n },\n } satisfies MotionGroupState,\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { Configuration as BaseConfiguration } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosRequestConfig } from \"axios\"\nimport axios, { isAxiosError } from \"axios\"\nimport urlJoin from \"url-join\"\nimport { loginWithAuth0 } from \"../../LoginWithAuth0\"\nimport { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { availableStorage } from \"../availableStorage\"\nimport { parseNovaInstanceUrl } from \"../converters\"\nimport { MockNovaInstance } from \"./mock/MockNovaInstance\"\nimport { NovaCellAPIClient } from \"./NovaCellAPIClient\"\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 *\n * Client for connecting to a Nova instance and controlling robots.\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.instanceUrl.href, \"/api/v2\"),\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/v2\"),\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\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/v2/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","import type { Pose } from \"@wandelbots/nova-api/v2\"\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 = [\n pose.position?.[0] ?? 0,\n pose.position?.[1] ?? 0,\n pose.position?.[2] ?? 0,\n ]\n\n const orientation = [\n pose.orientation?.[0] ?? 0,\n pose.orientation?.[1] ?? 0,\n pose.orientation?.[2] ?? 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"],"mappings":";;;;;;;;;;;;;AAoDA,IAAa,oBAAb,MAA+B;CAC7B,YACE,AAAS,QACT,AAAS,MAIT;EALS;EACA;gBAkFO,KAAK,2BAA2B,UAAU;cAC5C,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UAAU;IACR,MAAM;IACN,SAAS;IACT,gBAAgB;KAAC;KAAG;KAAG;KAAE;IACzB,mBAAmB;KAAC;KAAG;KAAG;KAAE;IAC7B,EACF;GACD,YAAY;GACZ,eAAe;IACb;KACE,OAAO;KACP,GAAG;KACJ;IACD,EACE,GAAG,MACJ;IACD,EACE,GAAG,QACJ;IACD;KACE,OAAO;KACP,GAAG;KACJ;IACD;KACE,OAAO;KACP,GAAG;KACJ;IACD,EACE,GAAG,MACJ;IACF;GACD,kBAAkB;IAChB,aAAa;KACX,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACD,OAAO,EACL,UAAU,KACX;KACD,QAAQ,EACN,UAAU,KACX;KACF;IACD,eAAe;KACb,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACD,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACF;KACD,KAAK,EACH,UAAU,KACX;KACF;IACD,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QACb,aAAa;QACd;OACD,UAAU;OACV,cAAc;OACd,QAAQ;OACT;MACD;OACE,UAAU;QACR,aAAa;QAC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AAK;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,IAAI,0BAA0B,KAAK,iBAAiB,KAAK,EAAE,EAChE,MAAM,KAAK,MACZ,CAAC;;;;;;;;;;ACjNN,SAAgB,yBACd,MACA;CACA,MAAM,WAAW;EACf,KAAK,WAAW,MAAM;EACtB,KAAK,WAAW,MAAM;EACtB,KAAK,WAAW,MAAM;EACvB;CAED,MAAM,cAAc;EAClB,KAAK,cAAc,MAAM;EACzB,KAAK,cAAc,MAAM;EACzB,KAAK,cAAc,MAAM;EAC1B;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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/nova-js",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "v3.5.2-pr.feat-addTestForQueryUsingApiCAll.228.
|
|
4
|
+
"version": "v3.5.2-pr.feat-addTestForQueryUsingApiCAll.228.2a0f01e",
|
|
5
5
|
"description": "Official JS client for the Wandelbots API",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"packageManager": "pnpm@10.19.0",
|
|
@@ -32,7 +32,7 @@ export class MockNovaInstance {
|
|
|
32
32
|
if (!config.url) {
|
|
33
33
|
throw new Error("No url sent with request")
|
|
34
34
|
}
|
|
35
|
-
const path = config.url
|
|
35
|
+
const path = config.url.split('?')[0]
|
|
36
36
|
|
|
37
37
|
for (const handler of apiHandlers) {
|
|
38
38
|
const match = pathToRegexp.match(handler.path)(path)
|