@wandelbots/nova-js 3.9.0-pr.280.5d405fb → 3.9.0-pr.280.641b7e2

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.
Files changed (55) hide show
  1. package/README.md +3 -0
  2. package/dist/{AutoReconnectingWebsocket-DEs8wlLZ.d.cts → AutoReconnectingWebsocket-DNOF9mpz.d.cts} +2 -1
  3. package/dist/AutoReconnectingWebsocket-DNOF9mpz.d.cts.map +1 -0
  4. package/dist/{AutoReconnectingWebsocket-DEs8wlLZ.d.mts → AutoReconnectingWebsocket-DNOF9mpz.d.mts} +2 -1
  5. package/dist/AutoReconnectingWebsocket-DNOF9mpz.d.mts.map +1 -0
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.cts +2 -2
  8. package/dist/index.d.mts +2 -2
  9. package/dist/index.mjs +1 -1
  10. package/dist/lib/deprecated/v1/index.cjs +4 -1
  11. package/dist/lib/deprecated/v1/index.cjs.map +1 -1
  12. package/dist/lib/deprecated/v1/index.d.cts +7 -2
  13. package/dist/lib/deprecated/v1/index.d.cts.map +1 -1
  14. package/dist/lib/deprecated/v1/index.d.mts +7 -2
  15. package/dist/lib/deprecated/v1/index.d.mts.map +1 -1
  16. package/dist/lib/deprecated/v1/index.mjs +4 -1
  17. package/dist/lib/deprecated/v1/index.mjs.map +1 -1
  18. package/dist/lib/v2/index.cjs +37 -25
  19. package/dist/lib/v2/index.cjs.map +1 -1
  20. package/dist/lib/v2/index.d.cts +37 -28
  21. package/dist/lib/v2/index.d.cts.map +1 -1
  22. package/dist/lib/v2/index.d.mts +37 -28
  23. package/dist/lib/v2/index.d.mts.map +1 -1
  24. package/dist/lib/v2/index.mjs +37 -24
  25. package/dist/lib/v2/index.mjs.map +1 -1
  26. package/dist/{wandelscriptUtils-Cz-yQ2eJ.d.mts → wandelscriptUtils-1A9uFPV_.d.cts} +13 -3
  27. package/dist/wandelscriptUtils-1A9uFPV_.d.cts.map +1 -0
  28. package/dist/{wandelscriptUtils-CsQAUu_9.mjs → wandelscriptUtils-C7hQePlo.mjs} +12 -5
  29. package/dist/wandelscriptUtils-C7hQePlo.mjs.map +1 -0
  30. package/dist/{wandelscriptUtils-BvZ8hcul.cjs → wandelscriptUtils-P0WYSZww.cjs} +12 -6
  31. package/dist/wandelscriptUtils-P0WYSZww.cjs.map +1 -0
  32. package/dist/{wandelscriptUtils-_Si3ueEd.d.cts → wandelscriptUtils-pySXnBlX.d.mts} +13 -3
  33. package/dist/wandelscriptUtils-pySXnBlX.d.mts.map +1 -0
  34. package/package.json +2 -3
  35. package/src/lib/deprecated/v1/ConnectedMotionGroup.ts +2 -0
  36. package/src/lib/deprecated/v1/JoggerConnection.ts +2 -0
  37. package/src/lib/deprecated/v1/MotionStreamConnection.ts +1 -0
  38. package/src/lib/deprecated/v1/NovaCellAPIClient.ts +3 -0
  39. package/src/lib/deprecated/v1/NovaClient.ts +8 -8
  40. package/src/lib/deprecated/v1/ProgramStateConnection.ts +4 -0
  41. package/src/lib/deprecated/v1/getLatestTrajectories.ts +1 -0
  42. package/src/lib/deprecated/v1/mock/MockNovaInstance.ts +1 -0
  43. package/src/lib/deprecated/v1/motionStateUpdate.ts +2 -0
  44. package/src/lib/deprecated/v1/wandelscriptUtils.ts +1 -0
  45. package/src/lib/deprecated/v2/NovaCellAPIClient.ts +3 -0
  46. package/src/lib/deprecated/v2/NovaClient.ts +9 -9
  47. package/src/lib/deprecated/v2/wandelscriptUtils.ts +1 -0
  48. package/src/lib/v2/Nova.ts +3 -4
  49. package/src/lib/v2/NovaAPIClient.ts +81 -93
  50. package/dist/AutoReconnectingWebsocket-DEs8wlLZ.d.cts.map +0 -1
  51. package/dist/AutoReconnectingWebsocket-DEs8wlLZ.d.mts.map +0 -1
  52. package/dist/wandelscriptUtils-BvZ8hcul.cjs.map +0 -1
  53. package/dist/wandelscriptUtils-CsQAUu_9.mjs.map +0 -1
  54. package/dist/wandelscriptUtils-Cz-yQ2eJ.d.mts.map +0 -1
  55. package/dist/wandelscriptUtils-_Si3ueEd.d.cts.map +0 -1
@@ -1,14 +1,13 @@
1
1
  import { m as AutoReconnectingWebsocket, n as loginWithAuth0, p as availableStorage, s as parseNovaInstanceUrl } from "../../LoginWithAuth0-DeirP_w9.mjs";
2
2
  import axios, { AxiosError, isAxiosError } from "axios";
3
- import urlJoin from "url-join";
4
3
  import * as pathToRegexp from "path-to-regexp";
5
- import * as novaApiV2 from "@wandelbots/nova-api/v2";
6
4
  import { ApplicationApi, BUSInputsOutputsApi, CellApi, ControllerApi, ControllerInputsOutputsApi, JoggingApi, KinematicsApi, LicenseApi, MotionGroupApi, MotionGroupModelsApi, NOVACloudApi, ProgramApi, RobotConfigurationsApi, SessionApi, StoreCollisionComponentsApi, StoreCollisionSetupsApi, StoreObjectApi, SystemApi, TrajectoryCachingApi, TrajectoryExecutionApi, TrajectoryPlanningApi, VersionApi, VirtualControllerApi, VirtualControllerBehaviorApi, VirtualControllerInputsOutputsApi } from "@wandelbots/nova-api/v2";
7
5
  export * from "@wandelbots/nova-api/v2";
8
6
  //#region src/lib/deprecated/v2/NovaCellAPIClient.ts
9
7
  /**
10
8
  * API client providing type-safe access to all the Nova API REST endpoints
11
9
  * associated with a specific cell id.
10
+ * @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
12
11
  */
13
12
  var NovaCellAPIClient = class {
14
13
  constructor(cellId, opts) {
@@ -692,8 +691,8 @@ const defaultMotionState = { result: {
692
691
  //#endregion
693
692
  //#region src/lib/deprecated/v2/NovaClient.ts
694
693
  /**
695
- *
696
694
  * Client for connecting to a Nova instance and controlling robots.
695
+ * @deprecated Use `Nova` from `@wandelbots/nova-js/v2` instead.
697
696
  */
698
697
  var NovaClient = class {
699
698
  constructor(config) {
@@ -708,7 +707,7 @@ var NovaClient = class {
708
707
  if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
709
708
  this.instanceUrl = parseNovaInstanceUrl(this.config.instanceUrl);
710
709
  const axiosInstance = axios.create({
711
- baseURL: urlJoin(this.instanceUrl.href, "/api/v2"),
710
+ baseURL: new URL("/api/v2", this.instanceUrl).href,
712
711
  headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
713
712
  });
714
713
  axiosInstance.interceptors.request.use(async (request) => {
@@ -738,7 +737,7 @@ var NovaClient = class {
738
737
  });
739
738
  this.api = new NovaCellAPIClient(cellId, {
740
739
  ...config,
741
- basePath: urlJoin(this.instanceUrl.href, "/api/v2"),
740
+ basePath: new URL("/api/v2", this.instanceUrl).href,
742
741
  isJsonMime: (mime) => {
743
742
  return mime === "application/json";
744
743
  },
@@ -768,7 +767,7 @@ var NovaClient = class {
768
767
  }
769
768
  }
770
769
  makeWebsocketURL(path) {
771
- const url = new URL(urlJoin(this.instanceUrl.href, `/api/v2/cells/${this.config.cellId}`, path));
770
+ const url = new URL(new URL(`/api/v2/cells/${this.config.cellId}/${path.replace(/^\/+/, "")}`, this.instanceUrl).href);
772
771
  url.protocol = url.protocol.replace("http", "ws");
773
772
  url.protocol = url.protocol.replace("https", "wss");
774
773
  if (this.accessToken) url.searchParams.append("token", this.accessToken);
@@ -792,6 +791,7 @@ var NovaClient = class {
792
791
  /**
793
792
  * Convert a Pose object representing a motion group position
794
793
  * into a string which represents that pose in Wandelscript.
794
+ * @deprecated Wandelscript usage is deprecated; switching to Python is recommended.
795
795
  */
796
796
  function poseToWandelscriptString(pose) {
797
797
  const position = [
@@ -810,10 +810,7 @@ function poseToWandelscriptString(pose) {
810
810
  }
811
811
  //#endregion
812
812
  //#region src/lib/v2/NovaAPIClient.ts
813
- function isApiClass(name, value) {
814
- return name.endsWith("Api") && typeof value === "function" && !name.includes("Factory") && !name.includes("Fp") && !name.includes("ParamCreator");
815
- }
816
- function wrapApi(ApiConstructor, opts) {
813
+ function unwrap(ApiConstructor, opts) {
817
814
  const apiClient = new ApiConstructor({
818
815
  ...opts,
819
816
  isJsonMime: (mime) => mime === "application/json"
@@ -826,20 +823,36 @@ function wrapApi(ApiConstructor, opts) {
826
823
  }
827
824
  /**
828
825
  * API client providing type-safe access to all the endpoints of a NOVA
829
- * instance. API sections are auto-discovered from @wandelbots/nova-api/v2
830
- * at runtime, so new sections added upstream are exposed automatically.
826
+ * instance.
831
827
  */
832
- const NovaAPIClient = class NovaAPIClient {
828
+ var NovaAPIClient = class {
833
829
  constructor(opts) {
834
830
  this.opts = opts;
835
- for (const [name, value] of Object.entries(novaApiV2)) if (isApiClass(name, value)) {
836
- const stripped = name.slice(0, -3);
837
- let i = 0;
838
- while (i < stripped.length && stripped[i] === stripped[i].toUpperCase() && stripped[i] !== stripped[i].toLowerCase()) i++;
839
- const boundary = i > 1 ? i - 1 : i;
840
- const propName = stripped.slice(0, boundary).toLowerCase() + stripped.slice(boundary);
841
- this[propName] = wrapApi(value, opts);
842
- }
831
+ this.application = unwrap(ApplicationApi, opts);
832
+ this.busIOs = unwrap(BUSInputsOutputsApi, opts);
833
+ this.cell = unwrap(CellApi, opts);
834
+ this.controller = unwrap(ControllerApi, opts);
835
+ this.controllerIOs = unwrap(ControllerInputsOutputsApi, opts);
836
+ this.jogging = unwrap(JoggingApi, opts);
837
+ this.kinematics = unwrap(KinematicsApi, opts);
838
+ this.license = unwrap(LicenseApi, opts);
839
+ this.motionGroup = unwrap(MotionGroupApi, opts);
840
+ this.motionGroupModels = unwrap(MotionGroupModelsApi, opts);
841
+ this.novaCloud = unwrap(NOVACloudApi, opts);
842
+ this.program = unwrap(ProgramApi, opts);
843
+ this.robotConfigurations = unwrap(RobotConfigurationsApi, opts);
844
+ this.session = unwrap(SessionApi, opts);
845
+ this.storeCollisionComponents = unwrap(StoreCollisionComponentsApi, opts);
846
+ this.storeCollisionSetups = unwrap(StoreCollisionSetupsApi, opts);
847
+ this.storeObject = unwrap(StoreObjectApi, opts);
848
+ this.system = unwrap(SystemApi, opts);
849
+ this.trajectoryCaching = unwrap(TrajectoryCachingApi, opts);
850
+ this.trajectoryExecution = unwrap(TrajectoryExecutionApi, opts);
851
+ this.trajectoryPlanning = unwrap(TrajectoryPlanningApi, opts);
852
+ this.version = unwrap(VersionApi, opts);
853
+ this.virtualController = unwrap(VirtualControllerApi, opts);
854
+ this.virtualControllerBehavior = unwrap(VirtualControllerBehaviorApi, opts);
855
+ this.virtualControllerIOs = unwrap(VirtualControllerInputsOutputsApi, opts);
843
856
  }
844
857
  };
845
858
  //#endregion
@@ -857,7 +870,7 @@ var Nova = class {
857
870
  if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
858
871
  this.instanceUrl = parseNovaInstanceUrl(this.config.instanceUrl);
859
872
  const axiosInstance = axios.create({
860
- baseURL: urlJoin(this.instanceUrl.href, "/api/v2"),
873
+ baseURL: new URL("/api/v2", this.instanceUrl).href,
861
874
  headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
862
875
  });
863
876
  axiosInstance.interceptors.request.use(async (request) => {
@@ -887,7 +900,7 @@ var Nova = class {
887
900
  });
888
901
  this.api = new NovaAPIClient({
889
902
  ...config,
890
- basePath: urlJoin(this.instanceUrl.href, "/api/v2"),
903
+ basePath: new URL("/api/v2", this.instanceUrl).href,
891
904
  isJsonMime: (mime) => {
892
905
  return mime === "application/json";
893
906
  },
@@ -918,7 +931,7 @@ var Nova = class {
918
931
  }
919
932
  }
920
933
  makeWebsocketURL(path) {
921
- const url = new URL(urlJoin(this.instanceUrl.href, `/api/v2`, path));
934
+ const url = new URL(`/api/v2/${path.replace(/^\/+/, "")}`, this.instanceUrl);
922
935
  url.protocol = url.protocol.replace("http", "ws");
923
936
  url.protocol = url.protocol.replace("https", "wss");
924
937
  if (this.accessToken) url.searchParams.append("token", this.accessToken);
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/lib/deprecated/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/deprecated/v2/NovaClient.ts","../../../src/lib/deprecated/v2/wandelscriptUtils.ts","../../../src/lib/v2/NovaAPIClient.ts","../../../src/lib/v2/Nova.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 LicenseApi,\n MotionGroupApi,\n MotionGroupModelsApi,\n NOVACloudApi,\n ProgramApi,\n RobotConfigurationsApi,\n SessionApi,\n StoreCollisionComponentsApi,\n StoreCollisionSetupsApi,\n StoreObjectApi,\n SystemApi,\n TrajectoryCachingApi,\n TrajectoryExecutionApi,\n TrajectoryPlanningApi,\n VersionApi,\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 readonly program = this.withCellId(ProgramApi)\n\n readonly license = this.withUnwrappedResponsesOnly(LicenseApi)\n readonly novaCloud = this.withUnwrappedResponsesOnly(NOVACloudApi)\n readonly robotConfigurations = this.withUnwrappedResponsesOnly(\n RobotConfigurationsApi,\n )\n readonly version = this.withUnwrappedResponsesOnly(VersionApi)\n readonly session = this.withUnwrappedResponsesOnly(SessionApi)\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 description_revision: 0,\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 \"../../v2/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","import type {\n BaseAPI,\n Configuration as BaseConfiguration,\n} from \"@wandelbots/nova-api/v2\"\nimport * as novaApiV2 from \"@wandelbots/nova-api/v2\"\nimport type { AxiosInstance } from \"axios\"\nimport axios from \"axios\"\n\n// biome-ignore lint/suspicious/noExplicitAny: metamagic\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\ntype WithUnwrappedAxiosResponse<T> = {\n [P in keyof T]: UnwrapAxiosResponseReturn<T[P]>\n}\n\n/**\n * Filters nova-api/v2 exports to just the API class constructors,\n * excluding helper factories and param creators.\n */\ntype ApiConstructors = {\n [K in keyof typeof novaApiV2 as K extends `${string}Api`\n ? K extends\n | `${string}Factory${string}`\n | `${string}Fp${string}`\n | `${string}ParamCreator${string}`\n ? never\n : K\n : never]: (typeof novaApiV2)[K]\n}\n\n/**\n * Lowercases leading uppercase characters to produce a camelCase property name.\n * e.g. \"BUSInputsOutputs\" -> \"busInputsOutputs\", \"NOVACloud\" -> \"novaCloud\",\n * \"Application\" -> \"application\"\n */\ntype CamelCase<S extends string> =\n S extends `${Uppercase<infer A>}${Uppercase<infer B>}${infer Rest}`\n ? Rest extends `${Lowercase<string>}${string}`\n ? `${Lowercase<A>}${CamelCase<`${Uppercase<B>}${Rest}`>}`\n : `${Lowercase<A>}${CamelCase<`${Uppercase<B>}${Rest}`>}`\n : Uncapitalize<S>\n\n/**\n * Maps API class names to property names by stripping \"Api\" and converting\n * the leading acronym to lowercase camelCase.\n */\ntype ApiProperties = {\n readonly [K in keyof ApiConstructors as K extends `${infer P}Api`\n ? CamelCase<P>\n : never]: ApiConstructors[K] extends new (\n // biome-ignore lint/suspicious/noExplicitAny: needed for contravariant parameter matching\n ...args: any[]\n ) => infer I\n ? WithUnwrappedAxiosResponse<I>\n : never\n}\n\ntype NovaAPIClientOpts = BaseConfiguration & {\n axiosInstance?: AxiosInstance\n mock?: boolean\n}\n\nfunction isApiClass(\n name: string,\n value: unknown,\n): value is new (\n config: BaseConfiguration,\n basePath: string,\n axios: AxiosInstance,\n) => BaseAPI {\n return (\n name.endsWith(\"Api\") &&\n typeof value === \"function\" &&\n !name.includes(\"Factory\") &&\n !name.includes(\"Fp\") &&\n !name.includes(\"ParamCreator\")\n )\n}\n\nfunction wrapApi<T extends BaseAPI>(\n ApiConstructor: new (\n config: BaseConfiguration,\n basePath: string,\n axios: AxiosInstance,\n ) => T,\n opts: NovaAPIClientOpts,\n): WithUnwrappedAxiosResponse<T> {\n const apiClient = new ApiConstructor(\n {\n ...opts,\n isJsonMime: (mime: string) => mime === \"application/json\",\n },\n opts.basePath ?? \"\",\n opts.axiosInstance ?? axios.create(),\n ) as Record<string | symbol, unknown>\n\n for (const key of Reflect.ownKeys(\n Reflect.getPrototypeOf(apiClient) as object,\n )) {\n if (key !== \"constructor\" && typeof apiClient[key] === \"function\") {\n const originalFunction = apiClient[key] as (\n ...args: unknown[]\n ) => Promise<{ data: unknown }>\n apiClient[key] = (...args: unknown[]) =>\n originalFunction.apply(apiClient, args).then((res) => res.data)\n }\n }\n\n return apiClient as WithUnwrappedAxiosResponse<T>\n}\n\n/**\n * API client providing type-safe access to all the endpoints of a NOVA\n * instance. API sections are auto-discovered from @wandelbots/nova-api/v2\n * at runtime, so new sections added upstream are exposed automatically.\n */\nexport const NovaAPIClient = class NovaAPIClient {\n readonly opts: NovaAPIClientOpts\n\n constructor(opts: NovaAPIClientOpts) {\n this.opts = opts\n\n for (const [name, value] of Object.entries(novaApiV2)) {\n if (isApiClass(name, value)) {\n const stripped = name.slice(0, -3)\n // Lowercase leading acronym run: \"BUSInputsOutputs\" -> \"busInputsOutputs\"\n let i = 0\n while (\n i < stripped.length &&\n stripped[i] === stripped[i].toUpperCase() &&\n stripped[i] !== stripped[i].toLowerCase()\n ) {\n i++\n }\n // If multiple uppercase chars, keep the last one uppercase (it starts the next word)\n const boundary = i > 1 ? i - 1 : i\n const propName =\n stripped.slice(0, boundary).toLowerCase() + stripped.slice(boundary)\n // biome-ignore lint/suspicious/noExplicitAny: dynamically assigning discovered API properties\n ;(this as any)[propName] = wrapApi(value, opts)\n }\n }\n }\n} as {\n new (\n opts: NovaAPIClientOpts,\n ): ApiProperties & {\n readonly cellId: string\n readonly opts: NovaAPIClientOpts\n }\n}\n\nexport type NovaAPIClient = InstanceType<typeof NovaAPIClient>\n","import 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 { NovaAPIClient } from \"./NovaAPIClient\"\nimport { MockNovaInstance } from \"./mock/MockNovaInstance\"\n\nexport type NovaConfig = {\n /**\n * Url of the deployed NOVA instance to connect to\n * e.g. https://saeattii.instance.wandelbots.io\n */\n instanceUrl: string\n\n /**\n * Access token for Bearer authentication.\n * If running on a NOVA instance, this can be automatically retrieved from\n * the current session when omitted.\n */\n accessToken?: string\n} & Omit<BaseConfiguration, \"isJsonMime\" | \"basePath\">\n\n/**\n *\n * Client for connecting to a NOVA instance and controlling robots.\n */\nexport class Nova {\n readonly api: NovaAPIClient\n readonly config: NovaConfig\n readonly mock?: MockNovaInstance\n readonly instanceUrl: URL\n authPromise: Promise<string | null> | null = null\n accessToken: string | null = null\n\n constructor(config: NovaConfig) {\n this.config = config\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 NovaAPIClient({\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 if (!this.mock) {\n throw new Error(\"Mock adapter used without a mock instance\")\n }\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(urlJoin(this.instanceUrl.href, `/api/v2`, path))\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"],"mappings":";;;;;;;;;;;;AA0DA,IAAa,oBAAb,MAA+B;CAC7B,YACE,QACA,MAIA;EALS,KAAA,SAAA;EACA,KAAA,OAAA;gBAkFO,KAAK,2BAA2B,SAAS;cAC3C,KAAK,2BAA2B,OAAO;qBAEhC,KAAK,WAAW,cAAc;2BAEnD,KAAK,2BAA2B,oBAAoB;oBAEhC,KAAK,WAAW,aAAa;uBAE1B,KAAK,WAAW,0BAA0B;4BAErC,KAAK,WAAW,qBAAqB;6BACpC,KAAK,WAAW,sBAAsB;2BACxC,KAAK,WAAW,oBAAoB;qBAE1C,KAAK,WAAW,cAAc;2BACxB,KAAK,2BAA2B,cAAc;iBAExD,KAAK,WAAW,UAAU;oBAEvB,KAAK,WAAW,aAAa;0BAEvB,KAAK,WAAW,mBAAmB;2BAElC,KAAK,WAAW,oBAAoB;mCAC5B,KAAK,WACxC,4BACF;8BACgC,KAAK,WACnC,iCACF;qBAEuB,KAAK,WAAW,cAAc;kCACjB,KAAK,WACvC,2BACF;8BACgC,KAAK,WAAW,uBAAuB;iBAEpD,KAAK,WAAW,UAAU;iBAE1B,KAAK,2BAA2B,UAAU;mBACxC,KAAK,2BAA2B,YAAY;6BAClC,KAAK,2BAClC,sBACF;iBACmB,KAAK,2BAA2B,UAAU;iBAC1C,KAAK,2BAA2B,UAAU;CA5H1D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A;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;KACF;KACA,KAAK,EACH,UAAU,IACZ;KACA,OAAO,EACL,UAAU,IACZ;KACA,QAAQ,EACN,UAAU,IACZ;IACF;IACA,eAAe;KACb,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;KACF;KACA,KAAK,EACH,UAAU,IACZ;IACF;IACA,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;KACF;KACA,KAAK,EACH,UAAU,IACZ;IACF;IACA,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;KACF;KACA,KAAK,EACH,UAAU,IACZ;IACF;GACF;GACA,eAAe;EACjB;CACF;AACF;;;AClTA,MAAa,+BAA+B;CAC1C,QAAQ;CACR,MAAM;CACN,SAAS;EACP,OAAO;GACL,eAAe;IACb;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;IAC9B;IACA;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;IAC9B;IACA;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;IAC9B;IACA;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;IAC9B;IACA;KACE,OAAO;KACP,OAAO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O,SAAS,KAAK,WAAW;OAC5C,IAAI,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU;GACvD,IAAI,WAAW,KAAK,OAAO;GAC3B,IAAI,WAAW,KAAK,OAAO;EAC7B;EAEA,OAAO,IAAI,SAAS;CACtB;;;;;;CAOA,0BAA0B,MAAc;EACtC,OAAO,IAAI,0BAA0B,KAAK,iBAAiB,IAAI,GAAG,EAChE,MAAM,KAAK,KACb,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/lib/deprecated/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/deprecated/v2/NovaClient.ts","../../../src/lib/deprecated/v2/wandelscriptUtils.ts","../../../src/lib/v2/NovaAPIClient.ts","../../../src/lib/v2/Nova.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 LicenseApi,\n MotionGroupApi,\n MotionGroupModelsApi,\n NOVACloudApi,\n ProgramApi,\n RobotConfigurationsApi,\n SessionApi,\n StoreCollisionComponentsApi,\n StoreCollisionSetupsApi,\n StoreObjectApi,\n SystemApi,\n TrajectoryCachingApi,\n TrajectoryExecutionApi,\n TrajectoryPlanningApi,\n VersionApi,\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\n/** @deprecated Use `NovaAPIClient` instead. */\nexport type WithCellId<T> = {\n [P in keyof T]: UnwrapAxiosResponseReturn<OmitFirstArg<T[P]>>\n}\n\n/** @deprecated Use `NovaAPIClient` instead. */\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 * @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.\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 readonly program = this.withCellId(ProgramApi)\n\n readonly license = this.withUnwrappedResponsesOnly(LicenseApi)\n readonly novaCloud = this.withUnwrappedResponsesOnly(NOVACloudApi)\n readonly robotConfigurations = this.withUnwrappedResponsesOnly(\n RobotConfigurationsApi,\n )\n readonly version = this.withUnwrappedResponsesOnly(VersionApi)\n readonly session = this.withUnwrappedResponsesOnly(SessionApi)\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 description_revision: 0,\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 { loginWithAuth0 } from \"../../../LoginWithAuth0\"\nimport { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { availableStorage } from \"../../availableStorage\"\nimport { parseNovaInstanceUrl } from \"../../converters\"\n\nimport { MockNovaInstance } from \"../../v2/mock/MockNovaInstance\"\nimport { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\n/** @deprecated Use `NovaClientConfig` from `Nova` instead. */\nexport type NovaClientConfig = {\n /**\n * Url of the deployed Nova instance to connect to\n * e.g. https://saeattii.instance.wandelbots.io\n */\n instanceUrl: string | \"https://mock.example.com\"\n\n /**\n * Identifier of the cell on the Nova instance to connect this client to.\n * If omitted, the default identifier \"cell\" is used.\n **/\n cellId?: string\n\n /**\n * Username for basic auth to the Nova instance.\n * @deprecated use accessToken instead\n */\n username?: string\n\n /**\n * Password for basic auth to the Nova instance.\n * @deprecated use accessToken instead\n */\n password?: string\n\n /**\n * Access token for Bearer authentication.\n */\n accessToken?: string\n} & Omit<BaseConfiguration, \"isJsonMime\" | \"basePath\">\n\ntype NovaClientConfigWithDefaults = NovaClientConfig & { cellId: string }\n\n/**\n * Client for connecting to a Nova instance and controlling robots.\n * @deprecated Use `Nova` from `@wandelbots/nova-js/v2` instead.\n */\nexport class NovaClient {\n readonly api: NovaCellAPIClient\n readonly config: NovaClientConfigWithDefaults\n readonly mock?: MockNovaInstance\n readonly instanceUrl: URL\n authPromise: Promise<string | null> | null = null\n accessToken: string | null = null\n\n constructor(config: NovaClientConfig) {\n const cellId = config.cellId ?? \"cell\"\n this.config = {\n cellId,\n ...config,\n }\n this.accessToken =\n config.accessToken ||\n availableStorage.getString(\"wbjs.access_token\") ||\n null\n\n if (this.config.instanceUrl === \"https://mock.example.com\") {\n this.mock = new MockNovaInstance()\n }\n this.instanceUrl = parseNovaInstanceUrl(this.config.instanceUrl)\n\n // Set up Axios instance with interceptor for token fetching\n const axiosInstance = axios.create({\n baseURL: new URL(\"/api/v2\", this.instanceUrl).href,\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: new URL(\"/api/v2\", this.instanceUrl).href,\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 new URL(\n `/api/v2/cells/${this.config.cellId}/${path.replace(/^\\/+/, \"\")}`,\n this.instanceUrl,\n ).href,\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 * @deprecated Wandelscript usage is deprecated; switching to Python is recommended.\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","import 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 LicenseApi,\n MotionGroupApi,\n MotionGroupModelsApi,\n NOVACloudApi,\n ProgramApi,\n RobotConfigurationsApi,\n SessionApi,\n StoreCollisionComponentsApi,\n StoreCollisionSetupsApi,\n StoreObjectApi,\n SystemApi,\n TrajectoryCachingApi,\n TrajectoryExecutionApi,\n TrajectoryPlanningApi,\n VersionApi,\n VirtualControllerApi,\n VirtualControllerBehaviorApi,\n VirtualControllerInputsOutputsApi,\n} from \"@wandelbots/nova-api/v2\"\nimport type { AxiosInstance } from \"axios\"\nimport axios from \"axios\"\n\n// biome-ignore lint/suspicious/noExplicitAny: metamagic\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\ntype WithUnwrappedAxiosResponse<T> = {\n [P in keyof T]: UnwrapAxiosResponseReturn<T[P]>\n}\n\ntype NovaAPIClientOpts = BaseConfiguration & {\n axiosInstance?: AxiosInstance\n mock?: boolean\n}\n\nfunction unwrap<T extends BaseAPI>(\n ApiConstructor: new (\n config: BaseConfiguration,\n basePath: string,\n axios: AxiosInstance,\n ) => T,\n opts: NovaAPIClientOpts,\n): WithUnwrappedAxiosResponse<T> {\n const apiClient = new ApiConstructor(\n {\n ...opts,\n isJsonMime: (mime: string) => mime === \"application/json\",\n },\n opts.basePath ?? \"\",\n opts.axiosInstance ?? axios.create(),\n ) as Record<string | symbol, unknown>\n\n for (const key of Reflect.ownKeys(\n Reflect.getPrototypeOf(apiClient) as object,\n )) {\n if (key !== \"constructor\" && typeof apiClient[key] === \"function\") {\n const originalFunction = apiClient[key] as (\n ...args: unknown[]\n ) => Promise<{ data: unknown }>\n apiClient[key] = (...args: unknown[]) =>\n originalFunction.apply(apiClient, args).then((res) => res.data)\n }\n }\n\n return apiClient as WithUnwrappedAxiosResponse<T>\n}\n\n/**\n * API client providing type-safe access to all the endpoints of a NOVA\n * instance.\n */\nexport class NovaAPIClient {\n readonly opts: NovaAPIClientOpts\n\n readonly application: WithUnwrappedAxiosResponse<ApplicationApi>\n readonly busIOs: WithUnwrappedAxiosResponse<BUSInputsOutputsApi>\n readonly cell: WithUnwrappedAxiosResponse<CellApi>\n readonly controller: WithUnwrappedAxiosResponse<ControllerApi>\n readonly controllerIOs: WithUnwrappedAxiosResponse<ControllerInputsOutputsApi>\n readonly jogging: WithUnwrappedAxiosResponse<JoggingApi>\n readonly kinematics: WithUnwrappedAxiosResponse<KinematicsApi>\n readonly license: WithUnwrappedAxiosResponse<LicenseApi>\n readonly motionGroup: WithUnwrappedAxiosResponse<MotionGroupApi>\n readonly motionGroupModels: WithUnwrappedAxiosResponse<MotionGroupModelsApi>\n readonly novaCloud: WithUnwrappedAxiosResponse<NOVACloudApi>\n readonly program: WithUnwrappedAxiosResponse<ProgramApi>\n readonly robotConfigurations: WithUnwrappedAxiosResponse<RobotConfigurationsApi>\n readonly session: WithUnwrappedAxiosResponse<SessionApi>\n readonly storeCollisionComponents: WithUnwrappedAxiosResponse<StoreCollisionComponentsApi>\n readonly storeCollisionSetups: WithUnwrappedAxiosResponse<StoreCollisionSetupsApi>\n readonly storeObject: WithUnwrappedAxiosResponse<StoreObjectApi>\n readonly system: WithUnwrappedAxiosResponse<SystemApi>\n readonly trajectoryCaching: WithUnwrappedAxiosResponse<TrajectoryCachingApi>\n readonly trajectoryExecution: WithUnwrappedAxiosResponse<TrajectoryExecutionApi>\n readonly trajectoryPlanning: WithUnwrappedAxiosResponse<TrajectoryPlanningApi>\n readonly version: WithUnwrappedAxiosResponse<VersionApi>\n readonly virtualController: WithUnwrappedAxiosResponse<VirtualControllerApi>\n readonly virtualControllerBehavior: WithUnwrappedAxiosResponse<VirtualControllerBehaviorApi>\n readonly virtualControllerIOs: WithUnwrappedAxiosResponse<VirtualControllerInputsOutputsApi>\n\n constructor(opts: NovaAPIClientOpts) {\n this.opts = opts\n\n this.application = unwrap(ApplicationApi, opts)\n this.busIOs = unwrap(BUSInputsOutputsApi, opts)\n this.cell = unwrap(CellApi, opts)\n this.controller = unwrap(ControllerApi, opts)\n this.controllerIOs = unwrap(ControllerInputsOutputsApi, opts)\n this.jogging = unwrap(JoggingApi, opts)\n this.kinematics = unwrap(KinematicsApi, opts)\n this.license = unwrap(LicenseApi, opts)\n this.motionGroup = unwrap(MotionGroupApi, opts)\n this.motionGroupModels = unwrap(MotionGroupModelsApi, opts)\n this.novaCloud = unwrap(NOVACloudApi, opts)\n this.program = unwrap(ProgramApi, opts)\n this.robotConfigurations = unwrap(RobotConfigurationsApi, opts)\n this.session = unwrap(SessionApi, opts)\n this.storeCollisionComponents = unwrap(StoreCollisionComponentsApi, opts)\n this.storeCollisionSetups = unwrap(StoreCollisionSetupsApi, opts)\n this.storeObject = unwrap(StoreObjectApi, opts)\n this.system = unwrap(SystemApi, opts)\n this.trajectoryCaching = unwrap(TrajectoryCachingApi, opts)\n this.trajectoryExecution = unwrap(TrajectoryExecutionApi, opts)\n this.trajectoryPlanning = unwrap(TrajectoryPlanningApi, opts)\n this.version = unwrap(VersionApi, opts)\n this.virtualController = unwrap(VirtualControllerApi, opts)\n this.virtualControllerBehavior = unwrap(VirtualControllerBehaviorApi, opts)\n this.virtualControllerIOs = unwrap(VirtualControllerInputsOutputsApi, opts)\n }\n}\n","import type { Configuration as BaseConfiguration } from \"@wandelbots/nova-api/v2\"\nimport type { AxiosRequestConfig } from \"axios\"\nimport axios, { isAxiosError } from \"axios\"\nimport { loginWithAuth0 } from \"../../LoginWithAuth0\"\nimport { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { availableStorage } from \"../availableStorage\"\nimport { parseNovaInstanceUrl } from \"../converters\"\nimport { NovaAPIClient } from \"./NovaAPIClient\"\nimport { MockNovaInstance } from \"./mock/MockNovaInstance\"\n\nexport type NovaConfig = {\n /**\n * Url of the deployed NOVA instance to connect to\n * e.g. https://saeattii.instance.wandelbots.io\n */\n instanceUrl: string\n\n /**\n * Access token for Bearer authentication.\n * If running on a NOVA instance, this can be automatically retrieved from\n * the current session when omitted.\n */\n accessToken?: string\n} & Omit<BaseConfiguration, \"isJsonMime\" | \"basePath\">\n\n/**\n *\n * Client for connecting to a NOVA instance and controlling robots.\n */\nexport class Nova {\n readonly api: NovaAPIClient\n readonly config: NovaConfig\n readonly mock?: MockNovaInstance\n readonly instanceUrl: URL\n authPromise: Promise<string | null> | null = null\n accessToken: string | null = null\n\n constructor(config: NovaConfig) {\n this.config = config\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: new URL(\"/api/v2\", this.instanceUrl).href,\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 NovaAPIClient({\n ...config,\n basePath: new URL(\"/api/v2\", this.instanceUrl).href,\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\n if (!this.mock) {\n throw new Error(\"Mock adapter used without a mock instance\")\n }\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(`/api/v2/${path.replace(/^\\/+/, \"\")}`, this.instanceUrl)\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"],"mappings":";;;;;;;;;;;AA6DA,IAAa,oBAAb,MAA+B;CAC7B,YACE,QACA,MAIA;EALS,KAAA,SAAA;EACA,KAAA,OAAA;gBAkFO,KAAK,2BAA2B,SAAS;cAC3C,KAAK,2BAA2B,OAAO;qBAEhC,KAAK,WAAW,cAAc;2BAEnD,KAAK,2BAA2B,oBAAoB;oBAEhC,KAAK,WAAW,aAAa;uBAE1B,KAAK,WAAW,0BAA0B;4BAErC,KAAK,WAAW,qBAAqB;6BACpC,KAAK,WAAW,sBAAsB;2BACxC,KAAK,WAAW,oBAAoB;qBAE1C,KAAK,WAAW,cAAc;2BACxB,KAAK,2BAA2B,cAAc;iBAExD,KAAK,WAAW,UAAU;oBAEvB,KAAK,WAAW,aAAa;0BAEvB,KAAK,WAAW,mBAAmB;2BAElC,KAAK,WAAW,oBAAoB;mCAC5B,KAAK,WACxC,4BACF;8BACgC,KAAK,WACnC,iCACF;qBAEuB,KAAK,WAAW,cAAc;kCACjB,KAAK,WACvC,2BACF;8BACgC,KAAK,WAAW,uBAAuB;iBAEpD,KAAK,WAAW,UAAU;iBAE1B,KAAK,2BAA2B,UAAU;mBACxC,KAAK,2BAA2B,YAAY;6BAClC,KAAK,2BAClC,sBACF;iBACmB,KAAK,2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Aa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;KACF;KACA,KAAK,EACH,UAAU,IACZ;KACA,OAAO,EACL,UAAU,IACZ;KACA,QAAQ,EACN,UAAU,IACZ;IACF;IACA,eAAe;KACb,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;KACF;KACA,KAAK,EACH,UAAU,IACZ;IACF;IACA,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;KACF;KACA,KAAK,EACH,UAAU,IACZ;IACF;IACA,kBAAkB;KAChB,QAAQ;MACN;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;MACA;OACE,UAAU;QACR,aAAa;QACb,aAAa;OACf;OACA,UAAU;OACV,cAAc;OACd,QAAQ;MACV;KACF;KACA,KAAK,EACH,UAAU,IACZ;IACF;GACF;GACA,eAAe;EACjB;CACF;AACF;;;AClTA,MAAa,+BAA+B;CAC1C,QAAQ;CACR,MAAM;CACN,SAAS;EACP,OAAO;GACL,eAAe;IACb;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;IAC9B;IACA;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;IAC9B;IACA;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GAAG;KACH,4BAA4B;IAC9B;IACA;KACE,OAAO;KACP,OAAO;KACP,GAAG;KACH,GA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Ae,KAAK,gBAAgB,aAAa;GAEnD,KAAK,cAAc;GACnB;EACF;EAGA,KAAK,cAAc,eAAe,KAAK,WAAW;EAClD,IAAI;GACF,KAAK,cAAc,MAAM,KAAK;GAC9B,IAAI,KAAK,aAEP,iBAAiB,UAAU,qBAAqB,KAAK,WAAW;QAEhE,iBAAiB,OAAO,mBAAmB;EAE/C,UAAU;GACR,KAAK,cAAc;EACrB;CACF;CAEA,iBAAiB,MAAsB;EACrC,MAAM,MAAM,IAAI,IAAI,WAAW,KAAK,QAAQ,QAAQ,EAAE,KAAK,KAAK,WAAW;EAC3E,IAAI,WAAW,IAAI,SAAS,QAAQ,QAAQ,IAAI;EAChD,IAAI,WAAW,IAAI,SAAS,QAAQ,SAAS,KAAK;EAKlD,IAAI,KAAK,aACP,IAAI,aAAa,OAAO,SAAS,KAAK,WAAW;OAC5C,IAAI,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU;GACvD,IAAI,WAAW,KAAK,OAAO;GAC3B,IAAI,WAAW,KAAK,OAAO;EAC7B;EAEA,OAAO,IAAI,SAAS;CACtB;;;;;;CAOA,0BAA0B,MAAc;EACtC,OAAO,IAAI,0BAA0B,KAAK,iBAAiB,IAAI,GAAG,EAChE,MAAM,KAAK,KACb,CAAC;CACH;AACF"}
@@ -1,14 +1,16 @@
1
- import { r as MockNovaInstance, t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-DEs8wlLZ.mjs";
1
+ import { r as MockNovaInstance, t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-DNOF9mpz.cjs";
2
2
  import { AxiosInstance } from "axios";
3
- import * as THREE from "three";
4
3
  import { ApplicationApi, CellApi, Configuration, ControllerApi, ControllerIOsApi, ControllerInstance, CoordinateSystemsApi, DeviceConfigurationApi, Joints, LibraryProgramApi, LibraryProgramMetadataApi, LibraryRecipeApi, LibraryRecipeMetadataApi, MotionApi, MotionGroupApi, MotionGroupInfosApi, MotionGroupJoggingApi, MotionGroupKinematicApi, MotionGroupPhysical, MotionGroupSpecification, MotionGroupStateResponse, Mounting, Pose, ProgramApi, ProgramValuesApi, RobotControllerState, RobotTcp, SafetySetup, StoreCollisionComponentsApi, StoreCollisionScenesApi, StoreObjectApi, SystemApi, TcpPose, VirtualRobotApi, VirtualRobotBehaviorApi, VirtualRobotModeApi, VirtualRobotSetupApi } from "@wandelbots/nova-api/v1";
4
+ import * as THREE from "three";
5
5
 
6
6
  //#region src/lib/deprecated/v1/ConnectedMotionGroup.d.ts
7
+ /** @deprecated */
7
8
  type MotionGroupOption = {
8
9
  selectionId: string;
9
10
  } & MotionGroupPhysical;
10
11
  /**
11
12
  * Store representing the current state of a connected motion group.
13
+ * @deprecated
12
14
  */
13
15
  declare class ConnectedMotionGroup {
14
16
  readonly nova: NovaClient;
@@ -80,6 +82,7 @@ declare class ConnectedMotionGroup {
80
82
  //#region src/lib/deprecated/v1/MotionStreamConnection.d.ts
81
83
  /**
82
84
  * Store representing the current state of a connected motion group.
85
+ * @deprecated
83
86
  */
84
87
  declare class MotionStreamConnection {
85
88
  readonly nova: NovaClient;
@@ -101,6 +104,7 @@ declare class MotionStreamConnection {
101
104
  }
102
105
  //#endregion
103
106
  //#region src/lib/deprecated/v1/JoggerConnection.d.ts
107
+ /** @deprecated */
104
108
  type JoggerConnectionOpts = {
105
109
  /**
106
110
  * When an error message is received from the jogging websocket, it
@@ -109,6 +113,7 @@ type JoggerConnectionOpts = {
109
113
  */
110
114
  onError?: (err: unknown) => void;
111
115
  };
116
+ /** @deprecated */
112
117
  declare class JoggerConnection {
113
118
  readonly motionStream: MotionStreamConnection;
114
119
  readonly opts: JoggerConnectionOpts;
@@ -219,11 +224,14 @@ type OmitFirstArg<F> = F extends ((x: any, ...args: infer P) => infer R) ? (...a
219
224
  type UnwrapAxiosResponseReturn<T> = T extends ((...a: any) => any) ? (...a: Parameters<T>) => Promise<Awaited<ReturnType<T>> extends {
220
225
  data: infer D;
221
226
  } ? D : never> : never;
227
+ /** @deprecated Use `NovaAPIClient` instead. */
222
228
  type WithCellId<T> = { [P in keyof T]: UnwrapAxiosResponseReturn<OmitFirstArg<T[P]>> };
229
+ /** @deprecated Use `NovaAPIClient` instead. */
223
230
  type WithUnwrappedAxiosResponse<T> = { [P in keyof T]: UnwrapAxiosResponseReturn<T[P]> };
224
231
  /**
225
232
  * API client providing type-safe access to all the Nova API REST endpoints
226
233
  * associated with a specific cell id.
234
+ * @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
227
235
  */
228
236
  declare class NovaCellAPIClient {
229
237
  readonly cellId: string;
@@ -274,6 +282,7 @@ declare class NovaCellAPIClient {
274
282
  }
275
283
  //#endregion
276
284
  //#region src/lib/deprecated/v1/NovaClient.d.ts
285
+ /** @deprecated Use `NovaConfig` from `@wandelbots/nova-js/v2` instead. */
277
286
  type NovaClientConfig = {
278
287
  /**
279
288
  * Url of the deployed Nova instance to connect to
@@ -339,8 +348,9 @@ declare class NovaClient {
339
348
  /**
340
349
  * Convert a Pose object representing a motion group position
341
350
  * into a string which represents that pose in Wandelscript.
351
+ * @deprecated
342
352
  */
343
353
  declare function poseToWandelscriptString(pose: Pick<Pose, "position" | "orientation">): string;
344
354
  //#endregion
345
355
  export { WithCellId as a, JoggerConnectionOpts as c, MotionGroupOption as d, NovaCellAPIClient as i, MotionStreamConnection as l, NovaClient as n, WithUnwrappedAxiosResponse as o, NovaClientConfig as r, JoggerConnection as s, poseToWandelscriptString as t, ConnectedMotionGroup as u };
346
- //# sourceMappingURL=wandelscriptUtils-Cz-yQ2eJ.d.mts.map
356
+ //# sourceMappingURL=wandelscriptUtils-1A9uFPV_.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wandelscriptUtils-1A9uFPV_.d.cts","names":[],"sources":["../src/lib/deprecated/v1/ConnectedMotionGroup.ts","../src/lib/deprecated/v1/MotionStreamConnection.ts","../src/lib/deprecated/v1/JoggerConnection.ts","../src/lib/deprecated/v1/NovaCellAPIClient.ts","../src/lib/deprecated/v1/N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sBAAA;EJ3DvB;;;EIkElB,aAAA,CAAc,aAAA,WAAqB,OAAA,CAAA,gBAAA;EAInC,mBAAA,CACJ,cAAA,aACC,OAAA,CAAQ,oBAAA;EAUL,kBAAA,CACJ,aAAA,WACC,OAAA,CAAQ,oBAAA;AAAA;;;;;;;;iBCvPG,wBAAA,CACd,IAAA,EAAM,IAAI,CAAC,IAAA"}
@@ -1,6 +1,5 @@
1
1
  import { a as isSameCoordinateSystem, m as AutoReconnectingWebsocket, n as loginWithAuth0, p as availableStorage, s as parseNovaInstanceUrl, u as tryParseJson } from "./LoginWithAuth0-DeirP_w9.mjs";
2
2
  import axios, { AxiosError, isAxiosError } from "axios";
3
- import urlJoin from "url-join";
4
3
  import { makeAutoObservable, runInAction } from "mobx";
5
4
  import * as THREE from "three";
6
5
  import { Vector3 } from "three";
@@ -8,11 +7,13 @@ import { Vector3 as Vector3$1 } from "three/src/math/Vector3.js";
8
7
  import { ApplicationApi, CellApi, ControllerApi, ControllerIOsApi, CoordinateSystemsApi, DeviceConfigurationApi, LibraryProgramApi, LibraryProgramMetadataApi, LibraryRecipeApi, LibraryRecipeMetadataApi, MotionApi, MotionGroupApi, MotionGroupInfosApi, MotionGroupJoggingApi, MotionGroupKinematicApi, ProgramApi, ProgramValuesApi, StoreCollisionComponentsApi, StoreCollisionScenesApi, StoreObjectApi, SystemApi, VirtualRobotApi, VirtualRobotBehaviorApi, VirtualRobotModeApi, VirtualRobotSetupApi } from "@wandelbots/nova-api/v1";
9
8
  import * as pathToRegexp from "path-to-regexp";
10
9
  //#region src/lib/deprecated/v1/motionStateUpdate.ts
10
+ /** @deprecated */
11
11
  function jointValuesEqual(oldJointValues, newJointValues, changeDeltaThreshold) {
12
12
  if (newJointValues.length !== oldJointValues.length) return true;
13
13
  for (let jointIndex = 0; jointIndex < newJointValues.length; jointIndex++) if (Math.abs(newJointValues[jointIndex] - oldJointValues[jointIndex]) > changeDeltaThreshold) return false;
14
14
  return true;
15
15
  }
16
+ /** @deprecated */
16
17
  function tcpPoseEqual(oldTcp, newTcp, changeDeltaThreshold) {
17
18
  if (oldTcp === void 0 && newTcp || oldTcp && newTcp === void 0) return false;
18
19
  if (oldTcp === void 0 || newTcp === void 0) return true;
@@ -31,6 +32,7 @@ function tcpPoseEqual(oldTcp, newTcp, changeDeltaThreshold) {
31
32
  const MOTION_DELTA_THRESHOLD$1 = 1e-4;
32
33
  /**
33
34
  * Store representing the current state of a connected motion group.
35
+ * @deprecated
34
36
  */
35
37
  var ConnectedMotionGroup = class ConnectedMotionGroup {
36
38
  static async connect(nova, motionGroupId, controllers) {
@@ -233,6 +235,7 @@ var ConnectedMotionGroup = class ConnectedMotionGroup {
233
235
  };
234
236
  //#endregion
235
237
  //#region src/lib/deprecated/v1/JoggerConnection.ts
238
+ /** @deprecated */
236
239
  var JoggerConnection = class JoggerConnection {
237
240
  static async open(nova, motionGroupId, opts = {}) {
238
241
  return new JoggerConnection(await nova.connectMotionStream(motionGroupId), opts);
@@ -479,6 +482,7 @@ function unwrapRotationVector(newRotationVectorApi, currentRotationVectorApi) {
479
482
  }
480
483
  /**
481
484
  * Store representing the current state of a connected motion group.
485
+ * @deprecated
482
486
  */
483
487
  var MotionStreamConnection = class MotionStreamConnection {
484
488
  static async open(nova, motionGroupId) {
@@ -546,6 +550,7 @@ var MotionStreamConnection = class MotionStreamConnection {
546
550
  /**
547
551
  * API client providing type-safe access to all the Nova API REST endpoints
548
552
  * associated with a specific cell id.
553
+ * @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
549
554
  */
550
555
  var NovaCellAPIClient = class {
551
556
  constructor(cellId, opts) {
@@ -621,6 +626,7 @@ var NovaCellAPIClient = class {
621
626
  //#region src/lib/deprecated/v1/mock/MockNovaInstance.ts
622
627
  /**
623
628
  * Ultra-simplified mock Nova server for testing stuff
629
+ * @deprecated
624
630
  */
625
631
  var MockNovaInstance = class {
626
632
  constructor() {
@@ -1872,7 +1878,7 @@ var NovaClient = class {
1872
1878
  if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
1873
1879
  this.instanceUrl = parseNovaInstanceUrl(this.config.instanceUrl);
1874
1880
  const axiosInstance = axios.create({
1875
- baseURL: urlJoin(this.config.instanceUrl, "/api/v1"),
1881
+ baseURL: new URL("/api/v1", this.config.instanceUrl).href,
1876
1882
  headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
1877
1883
  });
1878
1884
  axiosInstance.interceptors.request.use(async (request) => {
@@ -1902,7 +1908,7 @@ var NovaClient = class {
1902
1908
  });
1903
1909
  this.api = new NovaCellAPIClient(cellId, {
1904
1910
  ...config,
1905
- basePath: urlJoin(this.instanceUrl.href, "/api/v1"),
1911
+ basePath: new URL("/api/v1", this.instanceUrl).href,
1906
1912
  isJsonMime: (mime) => {
1907
1913
  return mime === "application/json";
1908
1914
  },
@@ -1932,7 +1938,7 @@ var NovaClient = class {
1932
1938
  }
1933
1939
  }
1934
1940
  makeWebsocketURL(path) {
1935
- const url = new URL(urlJoin(this.instanceUrl.href, `/api/v1/cells/${this.config.cellId}`, path));
1941
+ const url = new URL(new URL(`/api/v1/cells/${this.config.cellId}/${path.replace(/^\/+/, "")}`, this.instanceUrl).href);
1936
1942
  url.protocol = url.protocol.replace("http", "ws");
1937
1943
  url.protocol = url.protocol.replace("https", "wss");
1938
1944
  if (this.accessToken) url.searchParams.append("token", this.accessToken);
@@ -1975,6 +1981,7 @@ var NovaClient = class {
1975
1981
  /**
1976
1982
  * Convert a Pose object representing a motion group position
1977
1983
  * into a string which represents that pose in Wandelscript.
1984
+ * @deprecated
1978
1985
  */
1979
1986
  function poseToWandelscriptString(pose) {
1980
1987
  const position = [
@@ -1994,4 +2001,4 @@ function poseToWandelscriptString(pose) {
1994
2001
  //#endregion
1995
2002
  export { JoggerConnection as a, MotionStreamConnection as i, NovaClient as n, ConnectedMotionGroup as o, NovaCellAPIClient as r, poseToWandelscriptString as t };
1996
2003
 
1997
- //# sourceMappingURL=wandelscriptUtils-CsQAUu_9.mjs.map
2004
+ //# sourceMappingURL=wandelscriptUtils-C7hQePlo.mjs.map