@wandelbots/nova-js 3.9.0-pr.280.2b62f3c → 3.9.0-pr.280.432dc39

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 (56) hide show
  1. package/README.md +11 -12
  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 +38 -25
  19. package/dist/lib/v2/index.cjs.map +1 -1
  20. package/dist/lib/v2/index.d.cts +45 -39
  21. package/dist/lib/v2/index.d.cts.map +1 -1
  22. package/dist/lib/v2/index.d.mts +45 -39
  23. package/dist/lib/v2/index.d.mts.map +1 -1
  24. package/dist/lib/v2/index.mjs +38 -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 +10 -9
  49. package/src/lib/v2/NovaAPIClient.ts +83 -96
  50. package/src/lib/v2/index.ts +1 -1
  51. package/dist/AutoReconnectingWebsocket-DEs8wlLZ.d.cts.map +0 -1
  52. package/dist/AutoReconnectingWebsocket-DEs8wlLZ.d.mts.map +0 -1
  53. package/dist/wandelscriptUtils-BvZ8hcul.cjs.map +0 -1
  54. package/dist/wandelscriptUtils-CsQAUu_9.mjs.map +0 -1
  55. package/dist/wandelscriptUtils-Cz-yQ2eJ.d.mts.map +0 -1
  56. package/dist/wandelscriptUtils-_Si3ueEd.d.cts.map +0 -1
package/README.md CHANGED
@@ -15,15 +15,17 @@ If you develop a React application we also provide a set of [React components](h
15
15
 
16
16
  ## Basic usage
17
17
 
18
- The core of this package is the `NovaClient`, which represents a connection to a configured robot cell on a given NOVA instance:
18
+ The core of this package is the `Nova` client, which represents a connection to a given NOVA instance:
19
19
 
20
20
  ```ts
21
- import { NovaClient } from "@wandelbots/nova-js/v2"
21
+ import { Nova } from "@wandelbots/nova-js/v2"
22
22
 
23
- const nova = new NovaClient({
23
+ const nova = new Nova({
24
24
  instanceUrl: "https://example.instance.wandelbots.io",
25
- cellId: "cell",
25
+
26
26
  // Access token is given in the developer portal UI when you create an instance
27
+ // This can be omitted when the frontend is hosted by the instance itself
28
+ // (i.e. when running as a NOVA app)
27
29
  accessToken: "...",
28
30
  })
29
31
  ```
@@ -35,7 +37,7 @@ You can make calls to the REST API via `nova.api`, which contains a bunch of nam
35
37
  For example, to list the controllers configured in your cell:
36
38
 
37
39
  ```ts
38
- const controllerIds = await nova.api.controller.listRobotControllers()
40
+ const controllerIds = await nova.api.controller.listRobotControllers("cell")
39
41
  // -> e.g. ["ur5e", ...]
40
42
  ```
41
43
 
@@ -43,12 +45,11 @@ Documentation for the various API endpoints is available on your Nova instance a
43
45
 
44
46
  ## Opening websockets
45
47
 
46
- `NovaClient` has various convenience features for websocket handling in general. Use `openReconnectingWebsocket` to get a persistent socket for a given Nova streaming endpoint that will handle unexpected closes with exponential backoff:
47
-
48
+ `Nova` has various convenience features for websocket handling in general. Use `openReconnectingWebsocket` to get a persistent socket for a given Nova streaming endpoint that will handle unexpected closes with exponential backoff:
48
49
  ```ts
49
- const programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)
50
+ const joggingWebsocket = nova.openReconnectingWebsocket(`/cells/cell/controllers/ur5e/execution/jogging`)
50
51
 
51
- this.programStateSocket.addEventListener("message", (ev) => {
52
+ this.joggingWebsocket.addEventListener("message", (ev) => {
52
53
  console.log(ev.data)
53
54
  })
54
55
  ```
@@ -56,11 +57,9 @@ this.programStateSocket.addEventListener("message", (ev) => {
56
57
  Websockets on a given NOVA client are deduplicated by path, so if you call `openReconnectingWebsocket` twice with the same path you'll get the same object. The exception is if you called `dispose`, which you may do to permanently clean up a reconnecting websocket and free its resources:
57
58
 
58
59
  ```ts
59
- programStateSocket.dispose()
60
+ joggingWebsocket.dispose()
60
61
  ```
61
62
 
62
- The reconnecting websocket interface is fairly low-level and you won't get type safety on the messages. So when available, you'll likely want to use one of the following endpoint-specific abstractions instead which are built on top!
63
-
64
63
  ## Contributing
65
64
 
66
65
  If you would like to contribute a change to this repository, see [CONTRIBUTING.md](CONTRIBUTING.md).
@@ -4,6 +4,7 @@ import { AxiosResponse, InternalAxiosRequestConfig } from "axios";
4
4
  //#region src/lib/deprecated/v1/mock/MockNovaInstance.d.ts
5
5
  /**
6
6
  * Ultra-simplified mock Nova server for testing stuff
7
+ * @deprecated
7
8
  */
8
9
  declare class MockNovaInstance$1 {
9
10
  readonly connections: AutoReconnectingWebsocket[];
@@ -65,4 +66,4 @@ declare class AutoReconnectingWebsocket extends ReconnectingWebSocket {
65
66
  }
66
67
  //#endregion
67
68
  export { MockNovaInstance as n, MockNovaInstance$1 as r, AutoReconnectingWebsocket as t };
68
- //# sourceMappingURL=AutoReconnectingWebsocket-DEs8wlLZ.d.cts.map
69
+ //# sourceMappingURL=AutoReconnectingWebsocket-DNOF9mpz.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoReconnectingWebsocket-DNOF9mpz.d.cts","names":[],"sources":["../src/lib/deprecated/v1/mock/MockNovaInstance.ts","../src/lib/v2/mock/MockNovaInstance.ts","../src/lib/AutoReconnectingWebsocket.ts"],"mappings":";;;;;;AAgBA;;cAAa,kBAAA;EAAA,SACF,WAAA,EAAa,yBAAA;EAEhB,gBAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAAQ,aAAA;EAg8BX,yBAAA,CAA0B,MAAA,EAAQ,yBAAA;EAkOlC,sBAAA,CAAuB,MAAA,EAAQ,yBAAA,EAA2B,OAAA;AAAA;;;;;AAvqC5D;cCDa,gBAAA;EAAA,SACF,WAAA,EAAa,yBAAA;EAEhB,gBAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAAQ,aAAA;EAyCX,yBAAA,CAA0B,MAAA,EAAQ,yBAAA;EA+BlC,sBAAA,CAAuB,MAAA,EAAQ,yBAAA,EAA2B,OAAA;AAAA;;;cCxF/C,yBAAA,SAAkC,qBAAA;EAAA,SAOlC,IAAA;IACP,IAAA,GAAO,kBAAA,GAAsB,gBAAA;IAC7B,SAAA;EAAA;EARJ,oBAAA,GAAuB,YAAA;EACvB,SAAA;EACA,QAAA;cAGE,SAAA,UACS,IAAA;IACP,IAAA,GAAO,kBAAA,GAAsB,gBAAA;IAC7B,SAAA;EAAA;EA4CJ,SAAA,CAAU,SAAA;EAMV,QAAA,CAAS,IAAA;EF5CH;;;;EEwDN,OAAA,CAAA;EF04BA;;;EE/3BM,MAAA,CAAA,GAAM,OAAA;EFimCmB;;;EEnlCzB,MAAA,CAAA,GAAM,OAAA;EFmlC6D;;;;ACxqC3E;ECqGQ,YAAA,CAAA,GAAY,OAAA,CAAA,YAAA;;;;;EA4BZ,WAAA,CAAA,GAAW,OAAA,CAAA,YAAA;AAAA"}
@@ -4,6 +4,7 @@ import { AxiosResponse, InternalAxiosRequestConfig } from "axios";
4
4
  //#region src/lib/deprecated/v1/mock/MockNovaInstance.d.ts
5
5
  /**
6
6
  * Ultra-simplified mock Nova server for testing stuff
7
+ * @deprecated
7
8
  */
8
9
  declare class MockNovaInstance$1 {
9
10
  readonly connections: AutoReconnectingWebsocket[];
@@ -65,4 +66,4 @@ declare class AutoReconnectingWebsocket extends ReconnectingWebSocket {
65
66
  }
66
67
  //#endregion
67
68
  export { MockNovaInstance as n, MockNovaInstance$1 as r, AutoReconnectingWebsocket as t };
68
- //# sourceMappingURL=AutoReconnectingWebsocket-DEs8wlLZ.d.mts.map
69
+ //# sourceMappingURL=AutoReconnectingWebsocket-DNOF9mpz.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoReconnectingWebsocket-DNOF9mpz.d.mts","names":[],"sources":["../src/lib/deprecated/v1/mock/MockNovaInstance.ts","../src/lib/v2/mock/MockNovaInstance.ts","../src/lib/AutoReconnectingWebsocket.ts"],"mappings":";;;;;;AAgBA;;cAAa,kBAAA;EAAA,SACF,WAAA,EAAa,yBAAA;EAEhB,gBAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAAQ,aAAA;EAg8BX,yBAAA,CAA0B,MAAA,EAAQ,yBAAA;EAkOlC,sBAAA,CAAuB,MAAA,EAAQ,yBAAA,EAA2B,OAAA;AAAA;;;;;AAvqC5D;cCDa,gBAAA;EAAA,SACF,WAAA,EAAa,yBAAA;EAEhB,gBAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAAQ,aAAA;EAyCX,yBAAA,CAA0B,MAAA,EAAQ,yBAAA;EA+BlC,sBAAA,CAAuB,MAAA,EAAQ,yBAAA,EAA2B,OAAA;AAAA;;;cCxF/C,yBAAA,SAAkC,qBAAA;EAAA,SAOlC,IAAA;IACP,IAAA,GAAO,kBAAA,GAAsB,gBAAA;IAC7B,SAAA;EAAA;EARJ,oBAAA,GAAuB,YAAA;EACvB,SAAA;EACA,QAAA;cAGE,SAAA,UACS,IAAA;IACP,IAAA,GAAO,kBAAA,GAAsB,gBAAA;IAC7B,SAAA;EAAA;EA4CJ,SAAA,CAAU,SAAA;EAMV,QAAA,CAAS,IAAA;EF5CH;;;;EEwDN,OAAA,CAAA;EF04BA;;;EE/3BM,MAAA,CAAA,GAAM,OAAA;EFimCmB;;;EEnlCzB,MAAA,CAAA,GAAM,OAAA;EFmlC6D;;;;ACxqC3E;ECqGQ,YAAA,CAAA,GAAY,OAAA,CAAA,YAAA;;;;;EA4BZ,WAAA,CAAA,GAAW,OAAA,CAAA,YAAA;AAAA"}
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_LoginWithAuth0 = require("./LoginWithAuth0-oZFpwe7m.cjs");
3
- const require_wandelscriptUtils = require("./wandelscriptUtils-BvZ8hcul.cjs");
3
+ const require_wandelscriptUtils = require("./wandelscriptUtils-P0WYSZww.cjs");
4
4
  let axios = require("axios");
5
5
  //#region src/lib/errorHandling.ts
6
6
  function delay(ms) {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-DEs8wlLZ.cjs";
2
- import { n as NovaClient, r as NovaClientConfig, t as poseToWandelscriptString } from "./wandelscriptUtils-_Si3ueEd.cjs";
1
+ import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-DNOF9mpz.cjs";
2
+ import { n as NovaClient, r as NovaClientConfig, t as poseToWandelscriptString } from "./wandelscriptUtils-1A9uFPV_.cjs";
3
3
 
4
4
  //#region src/lib/availableStorage.d.ts
5
5
  /**
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-DEs8wlLZ.mjs";
2
- import { n as NovaClient, r as NovaClientConfig, t as poseToWandelscriptString } from "./wandelscriptUtils-Cz-yQ2eJ.mjs";
1
+ import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-DNOF9mpz.mjs";
2
+ import { n as NovaClient, r as NovaClientConfig, t as poseToWandelscriptString } from "./wandelscriptUtils-pySXnBlX.mjs";
3
3
 
4
4
  //#region src/lib/availableStorage.d.ts
5
5
  /**
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as isSameCoordinateSystem, c as parseUrl, d as tryParseUrl, f as tryStringifyJson, i as degreesToRadians, l as radiansToDegrees, m as AutoReconnectingWebsocket, n as loginWithAuth0, o as makeUrlQueryString, p as availableStorage, r as XYZ_TO_VECTOR, s as parseNovaInstanceUrl, t as getAuth0Config, u as tryParseJson } from "./LoginWithAuth0-DeirP_w9.mjs";
2
- import { n as NovaClient, t as poseToWandelscriptString } from "./wandelscriptUtils-CsQAUu_9.mjs";
2
+ import { n as NovaClient, t as poseToWandelscriptString } from "./wandelscriptUtils-C7hQePlo.mjs";
3
3
  import { isAxiosError } from "axios";
4
4
  //#region src/lib/errorHandling.ts
5
5
  function delay(ms) {
@@ -1,10 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_LoginWithAuth0 = require("../../../LoginWithAuth0-oZFpwe7m.cjs");
3
- const require_wandelscriptUtils = require("../../../wandelscriptUtils-BvZ8hcul.cjs");
3
+ const require_wandelscriptUtils = require("../../../wandelscriptUtils-P0WYSZww.cjs");
4
4
  let axios = require("axios");
5
5
  let mobx = require("mobx");
6
6
  //#region src/lib/deprecated/v1/getLatestTrajectories.ts
7
7
  let lastMotionIds = /* @__PURE__ */ new Set();
8
+ /** @deprecated */
8
9
  async function getLatestTrajectories(apiClient, sampleTime = 50, responsesCoordinateSystem) {
9
10
  const newTrajectories = [];
10
11
  try {
@@ -23,6 +24,7 @@ async function getLatestTrajectories(apiClient, sampleTime = 50, responsesCoordi
23
24
  }
24
25
  //#endregion
25
26
  //#region src/lib/deprecated/v1/ProgramStateConnection.ts
27
+ /** @deprecated */
26
28
  let ProgramState = /* @__PURE__ */ function(ProgramState) {
27
29
  ProgramState["NotStarted"] = "not started";
28
30
  ProgramState["Running"] = "running";
@@ -34,6 +36,7 @@ let ProgramState = /* @__PURE__ */ function(ProgramState) {
34
36
  /**
35
37
  * Interface for running Wandelscript programs on the Nova instance and
36
38
  * tracking their progress and output
39
+ * @deprecated
37
40
  */
38
41
  var ProgramStateConnection = class {
39
42
  constructor(nova) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["tryParseJson","AxiosError"],"sources":["../../../../src/lib/deprecated/v1/getLatestTrajectories.ts","../../../../src/lib/deprecated/v1/ProgramStateConnection.ts"],"sourcesContent":["import type { GetTrajectoryResponse } from \"@wandelbots/nova-api/v1\"\nimport type { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\nlet lastMotionIds: Set<string> = new Set()\n\nexport async function getLatestTrajectories(\n apiClient: NovaCellAPIClient,\n sampleTime: number = 50,\n responsesCoordinateSystem?: string,\n): Promise<GetTrajectoryResponse[]> {\n const newTrajectories: GetTrajectoryResponse[] = []\n\n try {\n const motions = await apiClient.motion.listMotions()\n const currentMotionIds = new Set(motions.motions)\n\n const newMotionIds = Array.from(currentMotionIds).filter(\n (id) => !lastMotionIds.has(id),\n )\n\n for (const motionId of newMotionIds) {\n const trajectory = await apiClient.motion.getMotionTrajectory(\n motionId,\n sampleTime,\n responsesCoordinateSystem,\n )\n newTrajectories.push(trajectory)\n }\n\n lastMotionIds = currentMotionIds\n } catch (error) {\n console.error(\"Failed to get latest trajectories:\", error)\n }\n\n return newTrajectories\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { CollectionValue } from \"@wandelbots/nova-api/v1\"\nimport { AxiosError } from \"axios\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\nexport type ProgramRunnerLogEntry = {\n timestamp: number\n message: string\n level?: \"warn\" | \"error\"\n}\n\nexport enum ProgramState {\n NotStarted = \"not started\",\n Running = \"running\",\n Stopped = \"stopped\",\n Failed = \"failed\",\n Completed = \"completed\",\n}\n\nexport type CurrentProgram = {\n id?: string\n wandelscript?: string\n state?: ProgramState\n}\n\ntype ProgramStateMessage = {\n type: string\n runner: {\n id: string\n state: ProgramState\n start_time?: number | null\n execution_time?: number | null\n }\n}\n\n/**\n * Interface for running Wandelscript programs on the Nova instance and\n * tracking their progress and output\n */\nexport class ProgramStateConnection {\n currentProgram: CurrentProgram = {}\n logs: ProgramRunnerLogEntry[] = []\n\n executionState = \"idle\" as \"idle\" | \"starting\" | \"executing\" | \"stopping\"\n currentlyExecutingProgramRunnerId = null as string | null\n\n programStateSocket: AutoReconnectingWebsocket\n\n constructor(readonly nova: NovaClient) {\n makeAutoObservable(this, {}, { autoBind: true })\n\n this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)\n\n this.programStateSocket.addEventListener(\"message\", (ev) => {\n const msg = tryParseJson(ev.data)\n\n if (!msg) {\n console.error(\"Failed to parse program state message\", ev.data)\n return\n }\n if (msg.type === \"update\") {\n this.handleProgramStateMessage(msg)\n }\n })\n }\n\n /** Handle a program state update from the backend */\n async handleProgramStateMessage(msg: ProgramStateMessage) {\n const { runner } = msg\n\n // Ignoring other programs for now\n // TODO - show if execution state is busy from another source\n if (runner.id !== this.currentlyExecutingProgramRunnerId) return\n\n if (runner.state === ProgramState.Failed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n // TODO - wandelengine should send print statements in real time over\n // websocket as well, rather than at the end\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.logError(\n `Program runner ${runner.id} failed with error: ${runnerState.error}\\n${runnerState.traceback}`,\n )\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.currentProgram.state = ProgramState.Failed\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Stopped) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n\n this.currentProgram.state = ProgramState.Stopped\n this.log(`Program runner ${runner.id} stopped`)\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Completed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.log(\n `Program runner ${runner.id} finished successfully in ${runner.execution_time?.toFixed(2)} seconds`,\n )\n\n this.currentProgram.state = ProgramState.Completed\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Running) {\n this.currentProgram.state = ProgramState.Running\n this.log(`Program runner ${runner.id} now running`)\n } else if (runner.state !== ProgramState.NotStarted) {\n console.error(runner)\n this.logError(\n `Program runner ${runner.id} entered unexpected state: ${runner.state}`,\n )\n this.currentProgram.state = ProgramState.NotStarted\n this.gotoIdleState()\n }\n }\n\n /** Call when a program is no longer executing */\n gotoIdleState() {\n runInAction(() => {\n this.executionState = \"idle\"\n })\n this.currentlyExecutingProgramRunnerId = null\n }\n\n async executeProgram(\n wandelscript: string,\n initial_state?: { [key: string]: CollectionValue },\n activeRobot?: MotionStreamConnection,\n ) {\n this.currentProgram = {\n wandelscript: wandelscript,\n state: ProgramState.NotStarted,\n }\n\n const { currentProgram: openProgram } = this\n if (!openProgram) return\n runInAction(() => {\n this.executionState = \"starting\"\n })\n\n // Jogging can cause program execution to fail for some time after\n // So we need to explicitly stop jogging before running a program\n if (activeRobot) {\n try {\n await this.nova.api.motionGroupJogging.stopJogging(\n activeRobot.motionGroupId,\n )\n } catch (err) {\n console.error(err)\n }\n }\n\n // WOS-1539: Wandelengine parser currently breaks if there are empty lines with indentation\n const trimmedCode = openProgram.wandelscript!.replaceAll(/^\\s*$/gm, \"\")\n\n try {\n const programRunnerRef = await this.nova.api.program.createProgramRunner(\n {\n code: trimmedCode,\n initial_state: initial_state,\n // @ts-expect-error legacy code - check if param still used\n default_robot: activeRobot?.wandelscriptIdentifier,\n },\n {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n )\n\n this.log(`Created program runner ${programRunnerRef.id}\"`)\n runInAction(() => {\n this.executionState = \"executing\"\n })\n this.currentlyExecutingProgramRunnerId = programRunnerRef.id\n } catch (error) {\n if (error instanceof AxiosError && error.response && error.request) {\n this.logError(\n `${error.response.status} ${error.response.statusText} from ${error.response.config.url} ${JSON.stringify(error.response.data)}`,\n )\n } else {\n this.logError(JSON.stringify(error))\n }\n runInAction(() => {\n this.executionState = \"idle\"\n })\n }\n }\n\n async stopProgram() {\n if (!this.currentlyExecutingProgramRunnerId) return\n runInAction(() => {\n this.executionState = \"stopping\"\n })\n\n try {\n await this.nova.api.program.stopProgramRunner(\n this.currentlyExecutingProgramRunnerId,\n )\n } catch (err) {\n // Reactivate the stop button so user can try again\n runInAction(() => {\n this.executionState = \"executing\"\n })\n throw err\n }\n }\n\n reset() {\n this.currentProgram = {}\n }\n\n log(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n })\n }\n\n logError(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n level: \"error\",\n })\n }\n}\n"],"mappings":";;;;;;AAGA,IAAI,gCAA6B,IAAI,IAAI;AAEzC,eAAsB,sBACpB,WACA,aAAqB,IACrB,2BACkC;CAClC,MAAM,kBAA2C,CAAC;CAElD,IAAI;EACF,MAAM,UAAU,MAAM,UAAU,OAAO,YAAY;EACnD,MAAM,mBAAmB,IAAI,IAAI,QAAQ,OAAO;EAEhD,MAAM,eAAe,MAAM,KAAK,gBAAgB,EAAE,QAC/C,OAAO,CAAC,cAAc,IAAI,EAAE,CAC/B;EAEA,KAAK,MAAM,YAAY,cAAc;GACnC,MAAM,aAAa,MAAM,UAAU,OAAO,oBACxC,UACA,YACA,yBACF;GACA,gBAAgB,KAAK,UAAU;EACjC;EAEA,gBAAgB;CAClB,SAAS,OAAO;EACd,QAAQ,MAAM,sCAAsC,KAAK;CAC3D;CAEA,OAAO;AACT;;;ACpBA,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,gBAAA;CACA,aAAA,aAAA;CACA,aAAA,aAAA;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IAAI,QAAQ,oBACnD;IACE,MAAM;IACS;IAEf,eAAe,aAAa;GAC9B,GACA,EACE,SAAS,EACP,gBAAgB,mBAClB,EACF,CACF;GAEA,KAAK,IAAI,0BAA0B,iBAAiB,GAAG,EAAE;GACzD,CAAA,GAAA,KAAA,mBAAkB;IAChB,KAAK,iBAAiB;GACxB,CAAC;GACD,KAAK,oCAAoC,iBAAiB;EAC5D,SAAS,OAAO;GACd,IAAI,iBAAiBC,MAAAA,cAAc,MAAM,YAAY,MAAM,SACzD,KAAK,SACH,GAAG,MAAM,SAAS,OAAO,GAAG,MAAM,SAAS,WAAW,QAAQ,MAAM,SAAS,OAAO,IAAI,GAAG,KAAK,UAAU,MAAM,SAAS,IAAI,GAC/H;QAEA,KAAK,SAAS,KAAK,UAAU,KAAK,CAAC;GAErC,CAAA,GAAA,KAAA,mBAAkB;IAChB,KAAK,iBAAiB;GACxB,CAAC;EACH;CACF;CAEA,MAAM,cAAc;EAClB,IAAI,CAAC,KAAK,mCAAmC;EAC7C,CAAA,GAAA,KAAA,mBAAkB;GAChB,KAAK,iBAAiB;EACxB,CAAC;EAED,IAAI;GACF,MAAM,KAAK,KAAK,IAAI,QAAQ,kBAC1B,KAAK,iCACP;EACF,SAAS,KAAK;GAEZ,CAAA,GAAA,KAAA,mBAAkB;IAChB,KAAK,iBAAiB;GACxB,CAAC;GACD,MAAM;EACR;CACF;CAEA,QAAQ;EACN,KAAK,iBAAiB,CAAC;CACzB;CAEA,IAAI,SAAiB;EACnB,QAAQ,IAAI,OAAO;EACnB,KAAK,KAAK,KAAK;GACb,WAAW,KAAK,IAAI;GACpB;EACF,CAAC;CACH;CAEA,SAAS,SAAiB;EACxB,QAAQ,IAAI,OAAO;EACnB,KAAK,KAAK,KAAK;GACb,WAAW,KAAK,IAAI;GACpB;GACA,OAAO;EACT,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["tryParseJson","AxiosError"],"sources":["../../../../src/lib/deprecated/v1/getLatestTrajectories.ts","../../../../src/lib/deprecated/v1/ProgramStateConnection.ts"],"sourcesContent":["import type { GetTrajectoryResponse } from \"@wandelbots/nova-api/v1\"\nimport type { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\nlet lastMotionIds: Set<string> = new Set()\n\n/** @deprecated */\nexport async function getLatestTrajectories(\n apiClient: NovaCellAPIClient,\n sampleTime: number = 50,\n responsesCoordinateSystem?: string,\n): Promise<GetTrajectoryResponse[]> {\n const newTrajectories: GetTrajectoryResponse[] = []\n\n try {\n const motions = await apiClient.motion.listMotions()\n const currentMotionIds = new Set(motions.motions)\n\n const newMotionIds = Array.from(currentMotionIds).filter(\n (id) => !lastMotionIds.has(id),\n )\n\n for (const motionId of newMotionIds) {\n const trajectory = await apiClient.motion.getMotionTrajectory(\n motionId,\n sampleTime,\n responsesCoordinateSystem,\n )\n newTrajectories.push(trajectory)\n }\n\n lastMotionIds = currentMotionIds\n } catch (error) {\n console.error(\"Failed to get latest trajectories:\", error)\n }\n\n return newTrajectories\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { CollectionValue } from \"@wandelbots/nova-api/v1\"\nimport { AxiosError } from \"axios\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\n/** @deprecated */\nexport type ProgramRunnerLogEntry = {\n timestamp: number\n message: string\n level?: \"warn\" | \"error\"\n}\n\n/** @deprecated */\nexport enum ProgramState {\n NotStarted = \"not started\",\n Running = \"running\",\n Stopped = \"stopped\",\n Failed = \"failed\",\n Completed = \"completed\",\n}\n\n/** @deprecated */\nexport type CurrentProgram = {\n id?: string\n wandelscript?: string\n state?: ProgramState\n}\n\ntype ProgramStateMessage = {\n type: string\n runner: {\n id: string\n state: ProgramState\n start_time?: number | null\n execution_time?: number | null\n }\n}\n\n/**\n * Interface for running Wandelscript programs on the Nova instance and\n * tracking their progress and output\n * @deprecated\n */\nexport class ProgramStateConnection {\n currentProgram: CurrentProgram = {}\n logs: ProgramRunnerLogEntry[] = []\n\n executionState = \"idle\" as \"idle\" | \"starting\" | \"executing\" | \"stopping\"\n currentlyExecutingProgramRunnerId = null as string | null\n\n programStateSocket: AutoReconnectingWebsocket\n\n constructor(readonly nova: NovaClient) {\n makeAutoObservable(this, {}, { autoBind: true })\n\n this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)\n\n this.programStateSocket.addEventListener(\"message\", (ev) => {\n const msg = tryParseJson(ev.data)\n\n if (!msg) {\n console.error(\"Failed to parse program state message\", ev.data)\n return\n }\n if (msg.type === \"update\") {\n this.handleProgramStateMessage(msg)\n }\n })\n }\n\n /** Handle a program state update from the backend */\n async handleProgramStateMessage(msg: ProgramStateMessage) {\n const { runner } = msg\n\n // Ignoring other programs for now\n // TODO - show if execution state is busy from another source\n if (runner.id !== this.currentlyExecutingProgramRunnerId) return\n\n if (runner.state === ProgramState.Failed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n // TODO - wandelengine should send print statements in real time over\n // websocket as well, rather than at the end\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.logError(\n `Program runner ${runner.id} failed with error: ${runnerState.error}\\n${runnerState.traceback}`,\n )\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.currentProgram.state = ProgramState.Failed\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Stopped) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n\n this.currentProgram.state = ProgramState.Stopped\n this.log(`Program runner ${runner.id} stopped`)\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Completed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.log(\n `Program runner ${runner.id} finished successfully in ${runner.execution_time?.toFixed(2)} seconds`,\n )\n\n this.currentProgram.state = ProgramState.Completed\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Running) {\n this.currentProgram.state = ProgramState.Running\n this.log(`Program runner ${runner.id} now running`)\n } else if (runner.state !== ProgramState.NotStarted) {\n console.error(runner)\n this.logError(\n `Program runner ${runner.id} entered unexpected state: ${runner.state}`,\n )\n this.currentProgram.state = ProgramState.NotStarted\n this.gotoIdleState()\n }\n }\n\n /** Call when a program is no longer executing */\n gotoIdleState() {\n runInAction(() => {\n this.executionState = \"idle\"\n })\n this.currentlyExecutingProgramRunnerId = null\n }\n\n async executeProgram(\n wandelscript: string,\n initial_state?: { [key: string]: CollectionValue },\n activeRobot?: MotionStreamConnection,\n ) {\n this.currentProgram = {\n wandelscript: wandelscript,\n state: ProgramState.NotStarted,\n }\n\n const { currentProgram: openProgram } = this\n if (!openProgram) return\n runInAction(() => {\n this.executionState = \"starting\"\n })\n\n // Jogging can cause program execution to fail for some time after\n // So we need to explicitly stop jogging before running a program\n if (activeRobot) {\n try {\n await this.nova.api.motionGroupJogging.stopJogging(\n activeRobot.motionGroupId,\n )\n } catch (err) {\n console.error(err)\n }\n }\n\n // WOS-1539: Wandelengine parser currently breaks if there are empty lines with indentation\n const trimmedCode = openProgram.wandelscript!.replaceAll(/^\\s*$/gm, \"\")\n\n try {\n const programRunnerRef = await this.nova.api.program.createProgramRunner(\n {\n code: trimmedCode,\n initial_state: initial_state,\n // @ts-expect-error legacy code - check if param still used\n default_robot: activeRobot?.wandelscriptIdentifier,\n },\n {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n )\n\n this.log(`Created program runner ${programRunnerRef.id}\"`)\n runInAction(() => {\n this.executionState = \"executing\"\n })\n this.currentlyExecutingProgramRunnerId = programRunnerRef.id\n } catch (error) {\n if (error instanceof AxiosError && error.response && error.request) {\n this.logError(\n `${error.response.status} ${error.response.statusText} from ${error.response.config.url} ${JSON.stringify(error.response.data)}`,\n )\n } else {\n this.logError(JSON.stringify(error))\n }\n runInAction(() => {\n this.executionState = \"idle\"\n })\n }\n }\n\n async stopProgram() {\n if (!this.currentlyExecutingProgramRunnerId) return\n runInAction(() => {\n this.executionState = \"stopping\"\n })\n\n try {\n await this.nova.api.program.stopProgramRunner(\n this.currentlyExecutingProgramRunnerId,\n )\n } catch (err) {\n // Reactivate the stop button so user can try again\n runInAction(() => {\n this.executionState = \"executing\"\n })\n throw err\n }\n }\n\n reset() {\n this.currentProgram = {}\n }\n\n log(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n })\n }\n\n logError(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n level: \"error\",\n })\n }\n}\n"],"mappings":";;;;;;AAGA,IAAI,gCAA6B,IAAI,IAAI;;AAGzC,eAAsB,sBACpB,WACA,aAAqB,IACrB,2BACkC;CAClC,MAAM,kBAA2C,CAAC;CAElD,IAAI;EACF,MAAM,UAAU,MAAM,UAAU,OAAO,YAAY;EACnD,MAAM,mBAAmB,IAAI,IAAI,QAAQ,OAAO;EAEhD,MAAM,eAAe,MAAM,KAAK,gBAAgB,EAAE,QAC/C,OAAO,CAAC,cAAc,IAAI,EAAE,CAC/B;EAEA,KAAK,MAAM,YAAY,cAAc;GACnC,MAAM,aAAa,MAAM,UAAU,OAAO,oBACxC,UACA,YACA,yBACF;GACA,gBAAgB,KAAK,UAAU;EACjC;EAEA,gBAAgB;CAClB,SAAS,OAAO;EACd,QAAQ,MAAM,sCAAsC,KAAK;CAC3D;CAEA,OAAO;AACT;;;;ACnBA,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,gBAAA;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../../../AutoReconnectingWebsocket-DEs8wlLZ.cjs";
2
- import { a as WithCellId, c as JoggerConnectionOpts, d as MotionGroupOption, i as NovaCellAPIClient, l as MotionStreamConnection, n as NovaClient, o as WithUnwrappedAxiosResponse, r as NovaClientConfig, s as JoggerConnection, t as poseToWandelscriptString, u as ConnectedMotionGroup } from "../../../wandelscriptUtils-_Si3ueEd.cjs";
1
+ import { t as AutoReconnectingWebsocket } from "../../../AutoReconnectingWebsocket-DNOF9mpz.cjs";
2
+ import { a as WithCellId, c as JoggerConnectionOpts, d as MotionGroupOption, i as NovaCellAPIClient, l as MotionStreamConnection, n as NovaClient, o as WithUnwrappedAxiosResponse, r as NovaClientConfig, s as JoggerConnection, t as poseToWandelscriptString, u as ConnectedMotionGroup } from "../../../wandelscriptUtils-1A9uFPV_.cjs";
3
3
  import { CollectionValue, GetTrajectoryResponse } from "@wandelbots/nova-api/v1";
4
4
  export * from "@wandelbots/nova-api/v1";
5
5
 
6
6
  //#region src/lib/deprecated/v1/getLatestTrajectories.d.ts
7
+ /** @deprecated */
7
8
  declare function getLatestTrajectories(apiClient: NovaCellAPIClient, sampleTime?: number, responsesCoordinateSystem?: string): Promise<GetTrajectoryResponse[]>;
8
9
  //#endregion
9
10
  //#region src/lib/deprecated/v1/ProgramStateConnection.d.ts
11
+ /** @deprecated */
10
12
  type ProgramRunnerLogEntry = {
11
13
  timestamp: number;
12
14
  message: string;
13
15
  level?: "warn" | "error";
14
16
  };
17
+ /** @deprecated */
15
18
  declare enum ProgramState {
16
19
  NotStarted = "not started",
17
20
  Running = "running",
@@ -19,6 +22,7 @@ declare enum ProgramState {
19
22
  Failed = "failed",
20
23
  Completed = "completed"
21
24
  }
25
+ /** @deprecated */
22
26
  type CurrentProgram = {
23
27
  id?: string;
24
28
  wandelscript?: string;
@@ -36,6 +40,7 @@ type ProgramStateMessage = {
36
40
  /**
37
41
  * Interface for running Wandelscript programs on the Nova instance and
38
42
  * tracking their progress and output
43
+ * @deprecated
39
44
  */
40
45
  declare class ProgramStateConnection {
41
46
  readonly nova: NovaClient;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../../../src/lib/deprecated/v1/getLatestTrajectories.ts","../../../../src/lib/deprecated/v1/ProgramStateConnection.ts"],"mappings":";;;;;;iBAKsB,qBAAA,CACpB,SAAA,EAAW,iBAAA,EACX,UAAA,WACA,yBAAA,YACC,OAAA,CAAQ,qBAAA;;;KCAC,qBAAA;EACV,SAAA;EACA,OAAA;EACA,KAAA;AAAA;AAAA,aAGU,YAAA;EACV,UAAA;EACA,OAAA;EACA,OAAA;EACA,MAAA;EACA,SAAA;AAAA;AAAA,KAGU,cAAA;EACV,EAAA;EACA,YAAA;EACA,KAAA,GAAQ,YAAY;AAAA;AAAA,KAGjB,mBAAA;EACH,IAAA;EACA,MAAA;IACE,EAAA;IACA,KAAA,EAAO,YAAY;IACnB,UAAA;IACA,cAAA;EAAA;AAAA;;;;AAvBG;cA+BM,sBAAA;EAAA,SASU,IAAA,EAAM,UAAA;EAR3B,cAAA,EAAgB,cAAA;EAChB,IAAA,EAAM,qBAAA;EAEN,cAAA;EACA,iCAAA;EAEA,kBAAA,EAAoB,yBAAA;cAEC,IAAA,EAAM,UAAA;EAhC3B;EAmDM,yBAAA,CAA0B,GAAA,EAAK,mBAAA,GAAmB,OAAA;EAnD/C;EA0IT,aAAA,CAAA;EAOM,cAAA,CACJ,YAAA,UACA,aAAA;IAAA,CAAmB,GAAA,WAAc,eAAA;EAAA,GACjC,WAAA,GAAc,sBAAA,GAAsB,OAAA;EA8DhC,WAAA,CAAA,GAAW,OAAA;EAmBjB,KAAA,CAAA;EAIA,GAAA,CAAI,OAAA;EAQJ,QAAA,CAAS,OAAA;AAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../../src/lib/deprecated/v1/getLatestTrajectories.ts","../../../../src/lib/deprecated/v1/ProgramStateConnection.ts"],"mappings":";;;;;;;iBAMsB,qBAAA,CACpB,SAAA,EAAW,iBAAA,EACX,UAAA,WACA,yBAAA,YACC,OAAA,CAAQ,qBAAA;;;;KCAC,qBAAA;EACV,SAAA;EACA,OAAA;EACA,KAAA;AAAA;;aAIU,YAAA;EACV,UAAA;EACA,OAAA;EACA,OAAA;EACA,MAAA;EACA,SAAA;AAAA;;KAIU,cAAA;EACV,EAAA;EACA,YAAA;EACA,KAAA,GAAQ,YAAY;AAAA;AAAA,KAGjB,mBAAA;EACH,IAAA;EACA,MAAA;IACE,EAAA;IACA,KAAA,EAAO,YAAY;IACnB,UAAA;IACA,cAAA;EAAA;AAAA;AAzBG;AAIP;;;;AAJO,cAkCM,sBAAA;EAAA,SASU,IAAA,EAAM,UAAA;EAR3B,cAAA,EAAgB,cAAA;EAChB,IAAA,EAAM,qBAAA;EAEN,cAAA;EACA,iCAAA;EAEA,kBAAA,EAAoB,yBAAA;cAEC,IAAA,EAAM,UAAA;EA9BH;EAiDlB,yBAAA,CAA0B,GAAA,EAAK,mBAAA,GAAmB,OAAA;EA9CpC;EAqIpB,aAAA,CAAA;EAOM,cAAA,CACJ,YAAA,UACA,aAAA;IAAA,CAAmB,GAAA,WAAc,eAAA;EAAA,GACjC,WAAA,GAAc,sBAAA,GAAsB,OAAA;EA8DhC,WAAA,CAAA,GAAW,OAAA;EAmBjB,KAAA,CAAA;EAIA,GAAA,CAAI,OAAA;EAQJ,QAAA,CAAS,OAAA;AAAA"}
@@ -1,17 +1,20 @@
1
- import { t as AutoReconnectingWebsocket } from "../../../AutoReconnectingWebsocket-DEs8wlLZ.mjs";
2
- import { a as WithCellId, c as JoggerConnectionOpts, d as MotionGroupOption, i as NovaCellAPIClient, l as MotionStreamConnection, n as NovaClient, o as WithUnwrappedAxiosResponse, r as NovaClientConfig, s as JoggerConnection, t as poseToWandelscriptString, u as ConnectedMotionGroup } from "../../../wandelscriptUtils-Cz-yQ2eJ.mjs";
1
+ import { t as AutoReconnectingWebsocket } from "../../../AutoReconnectingWebsocket-DNOF9mpz.mjs";
2
+ import { a as WithCellId, c as JoggerConnectionOpts, d as MotionGroupOption, i as NovaCellAPIClient, l as MotionStreamConnection, n as NovaClient, o as WithUnwrappedAxiosResponse, r as NovaClientConfig, s as JoggerConnection, t as poseToWandelscriptString, u as ConnectedMotionGroup } from "../../../wandelscriptUtils-pySXnBlX.mjs";
3
3
  import { CollectionValue, GetTrajectoryResponse } from "@wandelbots/nova-api/v1";
4
4
  export * from "@wandelbots/nova-api/v1";
5
5
 
6
6
  //#region src/lib/deprecated/v1/getLatestTrajectories.d.ts
7
+ /** @deprecated */
7
8
  declare function getLatestTrajectories(apiClient: NovaCellAPIClient, sampleTime?: number, responsesCoordinateSystem?: string): Promise<GetTrajectoryResponse[]>;
8
9
  //#endregion
9
10
  //#region src/lib/deprecated/v1/ProgramStateConnection.d.ts
11
+ /** @deprecated */
10
12
  type ProgramRunnerLogEntry = {
11
13
  timestamp: number;
12
14
  message: string;
13
15
  level?: "warn" | "error";
14
16
  };
17
+ /** @deprecated */
15
18
  declare enum ProgramState {
16
19
  NotStarted = "not started",
17
20
  Running = "running",
@@ -19,6 +22,7 @@ declare enum ProgramState {
19
22
  Failed = "failed",
20
23
  Completed = "completed"
21
24
  }
25
+ /** @deprecated */
22
26
  type CurrentProgram = {
23
27
  id?: string;
24
28
  wandelscript?: string;
@@ -36,6 +40,7 @@ type ProgramStateMessage = {
36
40
  /**
37
41
  * Interface for running Wandelscript programs on the Nova instance and
38
42
  * tracking their progress and output
43
+ * @deprecated
39
44
  */
40
45
  declare class ProgramStateConnection {
41
46
  readonly nova: NovaClient;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/lib/deprecated/v1/getLatestTrajectories.ts","../../../../src/lib/deprecated/v1/ProgramStateConnection.ts"],"mappings":";;;;;;iBAKsB,qBAAA,CACpB,SAAA,EAAW,iBAAA,EACX,UAAA,WACA,yBAAA,YACC,OAAA,CAAQ,qBAAA;;;KCAC,qBAAA;EACV,SAAA;EACA,OAAA;EACA,KAAA;AAAA;AAAA,aAGU,YAAA;EACV,UAAA;EACA,OAAA;EACA,OAAA;EACA,MAAA;EACA,SAAA;AAAA;AAAA,KAGU,cAAA;EACV,EAAA;EACA,YAAA;EACA,KAAA,GAAQ,YAAY;AAAA;AAAA,KAGjB,mBAAA;EACH,IAAA;EACA,MAAA;IACE,EAAA;IACA,KAAA,EAAO,YAAY;IACnB,UAAA;IACA,cAAA;EAAA;AAAA;;;;AAvBG;cA+BM,sBAAA;EAAA,SASU,IAAA,EAAM,UAAA;EAR3B,cAAA,EAAgB,cAAA;EAChB,IAAA,EAAM,qBAAA;EAEN,cAAA;EACA,iCAAA;EAEA,kBAAA,EAAoB,yBAAA;cAEC,IAAA,EAAM,UAAA;EAhC3B;EAmDM,yBAAA,CAA0B,GAAA,EAAK,mBAAA,GAAmB,OAAA;EAnD/C;EA0IT,aAAA,CAAA;EAOM,cAAA,CACJ,YAAA,UACA,aAAA;IAAA,CAAmB,GAAA,WAAc,eAAA;EAAA,GACjC,WAAA,GAAc,sBAAA,GAAsB,OAAA;EA8DhC,WAAA,CAAA,GAAW,OAAA;EAmBjB,KAAA,CAAA;EAIA,GAAA,CAAI,OAAA;EAQJ,QAAA,CAAS,OAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/lib/deprecated/v1/getLatestTrajectories.ts","../../../../src/lib/deprecated/v1/ProgramStateConnection.ts"],"mappings":";;;;;;;iBAMsB,qBAAA,CACpB,SAAA,EAAW,iBAAA,EACX,UAAA,WACA,yBAAA,YACC,OAAA,CAAQ,qBAAA;;;;KCAC,qBAAA;EACV,SAAA;EACA,OAAA;EACA,KAAA;AAAA;;aAIU,YAAA;EACV,UAAA;EACA,OAAA;EACA,OAAA;EACA,MAAA;EACA,SAAA;AAAA;;KAIU,cAAA;EACV,EAAA;EACA,YAAA;EACA,KAAA,GAAQ,YAAY;AAAA;AAAA,KAGjB,mBAAA;EACH,IAAA;EACA,MAAA;IACE,EAAA;IACA,KAAA,EAAO,YAAY;IACnB,UAAA;IACA,cAAA;EAAA;AAAA;AAzBG;AAIP;;;;AAJO,cAkCM,sBAAA;EAAA,SASU,IAAA,EAAM,UAAA;EAR3B,cAAA,EAAgB,cAAA;EAChB,IAAA,EAAM,qBAAA;EAEN,cAAA;EACA,iCAAA;EAEA,kBAAA,EAAoB,yBAAA;cAEC,IAAA,EAAM,UAAA;EA9BH;EAiDlB,yBAAA,CAA0B,GAAA,EAAK,mBAAA,GAAmB,OAAA;EA9CpC;EAqIpB,aAAA,CAAA;EAOM,cAAA,CACJ,YAAA,UACA,aAAA;IAAA,CAAmB,GAAA,WAAc,eAAA;EAAA,GACjC,WAAA,GAAc,sBAAA,GAAsB,OAAA;EA8DhC,WAAA,CAAA,GAAW,OAAA;EAmBjB,KAAA,CAAA;EAIA,GAAA,CAAI,OAAA;EAQJ,QAAA,CAAS,OAAA;AAAA"}
@@ -1,10 +1,11 @@
1
1
  import { u as tryParseJson } from "../../../LoginWithAuth0-DeirP_w9.mjs";
2
- import { a as JoggerConnection, i as MotionStreamConnection, n as NovaClient, o as ConnectedMotionGroup, r as NovaCellAPIClient, t as poseToWandelscriptString } from "../../../wandelscriptUtils-CsQAUu_9.mjs";
2
+ import { a as JoggerConnection, i as MotionStreamConnection, n as NovaClient, o as ConnectedMotionGroup, r as NovaCellAPIClient, t as poseToWandelscriptString } from "../../../wandelscriptUtils-C7hQePlo.mjs";
3
3
  import { AxiosError } from "axios";
4
4
  import { makeAutoObservable, runInAction } from "mobx";
5
5
  export * from "@wandelbots/nova-api/v1";
6
6
  //#region src/lib/deprecated/v1/getLatestTrajectories.ts
7
7
  let lastMotionIds = /* @__PURE__ */ new Set();
8
+ /** @deprecated */
8
9
  async function getLatestTrajectories(apiClient, sampleTime = 50, responsesCoordinateSystem) {
9
10
  const newTrajectories = [];
10
11
  try {
@@ -23,6 +24,7 @@ async function getLatestTrajectories(apiClient, sampleTime = 50, responsesCoordi
23
24
  }
24
25
  //#endregion
25
26
  //#region src/lib/deprecated/v1/ProgramStateConnection.ts
27
+ /** @deprecated */
26
28
  let ProgramState = /* @__PURE__ */ function(ProgramState) {
27
29
  ProgramState["NotStarted"] = "not started";
28
30
  ProgramState["Running"] = "running";
@@ -34,6 +36,7 @@ let ProgramState = /* @__PURE__ */ function(ProgramState) {
34
36
  /**
35
37
  * Interface for running Wandelscript programs on the Nova instance and
36
38
  * tracking their progress and output
39
+ * @deprecated
37
40
  */
38
41
  var ProgramStateConnection = class {
39
42
  constructor(nova) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/lib/deprecated/v1/getLatestTrajectories.ts","../../../../src/lib/deprecated/v1/ProgramStateConnection.ts"],"sourcesContent":["import type { GetTrajectoryResponse } from \"@wandelbots/nova-api/v1\"\nimport type { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\nlet lastMotionIds: Set<string> = new Set()\n\nexport async function getLatestTrajectories(\n apiClient: NovaCellAPIClient,\n sampleTime: number = 50,\n responsesCoordinateSystem?: string,\n): Promise<GetTrajectoryResponse[]> {\n const newTrajectories: GetTrajectoryResponse[] = []\n\n try {\n const motions = await apiClient.motion.listMotions()\n const currentMotionIds = new Set(motions.motions)\n\n const newMotionIds = Array.from(currentMotionIds).filter(\n (id) => !lastMotionIds.has(id),\n )\n\n for (const motionId of newMotionIds) {\n const trajectory = await apiClient.motion.getMotionTrajectory(\n motionId,\n sampleTime,\n responsesCoordinateSystem,\n )\n newTrajectories.push(trajectory)\n }\n\n lastMotionIds = currentMotionIds\n } catch (error) {\n console.error(\"Failed to get latest trajectories:\", error)\n }\n\n return newTrajectories\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { CollectionValue } from \"@wandelbots/nova-api/v1\"\nimport { AxiosError } from \"axios\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\nexport type ProgramRunnerLogEntry = {\n timestamp: number\n message: string\n level?: \"warn\" | \"error\"\n}\n\nexport enum ProgramState {\n NotStarted = \"not started\",\n Running = \"running\",\n Stopped = \"stopped\",\n Failed = \"failed\",\n Completed = \"completed\",\n}\n\nexport type CurrentProgram = {\n id?: string\n wandelscript?: string\n state?: ProgramState\n}\n\ntype ProgramStateMessage = {\n type: string\n runner: {\n id: string\n state: ProgramState\n start_time?: number | null\n execution_time?: number | null\n }\n}\n\n/**\n * Interface for running Wandelscript programs on the Nova instance and\n * tracking their progress and output\n */\nexport class ProgramStateConnection {\n currentProgram: CurrentProgram = {}\n logs: ProgramRunnerLogEntry[] = []\n\n executionState = \"idle\" as \"idle\" | \"starting\" | \"executing\" | \"stopping\"\n currentlyExecutingProgramRunnerId = null as string | null\n\n programStateSocket: AutoReconnectingWebsocket\n\n constructor(readonly nova: NovaClient) {\n makeAutoObservable(this, {}, { autoBind: true })\n\n this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)\n\n this.programStateSocket.addEventListener(\"message\", (ev) => {\n const msg = tryParseJson(ev.data)\n\n if (!msg) {\n console.error(\"Failed to parse program state message\", ev.data)\n return\n }\n if (msg.type === \"update\") {\n this.handleProgramStateMessage(msg)\n }\n })\n }\n\n /** Handle a program state update from the backend */\n async handleProgramStateMessage(msg: ProgramStateMessage) {\n const { runner } = msg\n\n // Ignoring other programs for now\n // TODO - show if execution state is busy from another source\n if (runner.id !== this.currentlyExecutingProgramRunnerId) return\n\n if (runner.state === ProgramState.Failed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n // TODO - wandelengine should send print statements in real time over\n // websocket as well, rather than at the end\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.logError(\n `Program runner ${runner.id} failed with error: ${runnerState.error}\\n${runnerState.traceback}`,\n )\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.currentProgram.state = ProgramState.Failed\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Stopped) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n\n this.currentProgram.state = ProgramState.Stopped\n this.log(`Program runner ${runner.id} stopped`)\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Completed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.log(\n `Program runner ${runner.id} finished successfully in ${runner.execution_time?.toFixed(2)} seconds`,\n )\n\n this.currentProgram.state = ProgramState.Completed\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Running) {\n this.currentProgram.state = ProgramState.Running\n this.log(`Program runner ${runner.id} now running`)\n } else if (runner.state !== ProgramState.NotStarted) {\n console.error(runner)\n this.logError(\n `Program runner ${runner.id} entered unexpected state: ${runner.state}`,\n )\n this.currentProgram.state = ProgramState.NotStarted\n this.gotoIdleState()\n }\n }\n\n /** Call when a program is no longer executing */\n gotoIdleState() {\n runInAction(() => {\n this.executionState = \"idle\"\n })\n this.currentlyExecutingProgramRunnerId = null\n }\n\n async executeProgram(\n wandelscript: string,\n initial_state?: { [key: string]: CollectionValue },\n activeRobot?: MotionStreamConnection,\n ) {\n this.currentProgram = {\n wandelscript: wandelscript,\n state: ProgramState.NotStarted,\n }\n\n const { currentProgram: openProgram } = this\n if (!openProgram) return\n runInAction(() => {\n this.executionState = \"starting\"\n })\n\n // Jogging can cause program execution to fail for some time after\n // So we need to explicitly stop jogging before running a program\n if (activeRobot) {\n try {\n await this.nova.api.motionGroupJogging.stopJogging(\n activeRobot.motionGroupId,\n )\n } catch (err) {\n console.error(err)\n }\n }\n\n // WOS-1539: Wandelengine parser currently breaks if there are empty lines with indentation\n const trimmedCode = openProgram.wandelscript!.replaceAll(/^\\s*$/gm, \"\")\n\n try {\n const programRunnerRef = await this.nova.api.program.createProgramRunner(\n {\n code: trimmedCode,\n initial_state: initial_state,\n // @ts-expect-error legacy code - check if param still used\n default_robot: activeRobot?.wandelscriptIdentifier,\n },\n {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n )\n\n this.log(`Created program runner ${programRunnerRef.id}\"`)\n runInAction(() => {\n this.executionState = \"executing\"\n })\n this.currentlyExecutingProgramRunnerId = programRunnerRef.id\n } catch (error) {\n if (error instanceof AxiosError && error.response && error.request) {\n this.logError(\n `${error.response.status} ${error.response.statusText} from ${error.response.config.url} ${JSON.stringify(error.response.data)}`,\n )\n } else {\n this.logError(JSON.stringify(error))\n }\n runInAction(() => {\n this.executionState = \"idle\"\n })\n }\n }\n\n async stopProgram() {\n if (!this.currentlyExecutingProgramRunnerId) return\n runInAction(() => {\n this.executionState = \"stopping\"\n })\n\n try {\n await this.nova.api.program.stopProgramRunner(\n this.currentlyExecutingProgramRunnerId,\n )\n } catch (err) {\n // Reactivate the stop button so user can try again\n runInAction(() => {\n this.executionState = \"executing\"\n })\n throw err\n }\n }\n\n reset() {\n this.currentProgram = {}\n }\n\n log(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n })\n }\n\n logError(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n level: \"error\",\n })\n }\n}\n"],"mappings":";;;;;;AAGA,IAAI,gCAA6B,IAAI,IAAI;AAEzC,eAAsB,sBACpB,WACA,aAAqB,IACrB,2BACkC;CAClC,MAAM,kBAA2C,CAAC;CAElD,IAAI;EACF,MAAM,UAAU,MAAM,UAAU,OAAO,YAAY;EACnD,MAAM,mBAAmB,IAAI,IAAI,QAAQ,OAAO;EAEhD,MAAM,eAAe,MAAM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CACH;CAEA,SAAS,SAAiB;EACxB,QAAQ,IAAI,OAAO;EACnB,KAAK,KAAK,KAAK;GACb,WAAW,KAAK,IAAI;GACpB;GACA,OAAO;EACT,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/lib/deprecated/v1/getLatestTrajectories.ts","../../../../src/lib/deprecated/v1/ProgramStateConnection.ts"],"sourcesContent":["import type { GetTrajectoryResponse } from \"@wandelbots/nova-api/v1\"\nimport type { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\nlet lastMotionIds: Set<string> = new Set()\n\n/** @deprecated */\nexport async function getLatestTrajectories(\n apiClient: NovaCellAPIClient,\n sampleTime: number = 50,\n responsesCoordinateSystem?: string,\n): Promise<GetTrajectoryResponse[]> {\n const newTrajectories: GetTrajectoryResponse[] = []\n\n try {\n const motions = await apiClient.motion.listMotions()\n const currentMotionIds = new Set(motions.motions)\n\n const newMotionIds = Array.from(currentMotionIds).filter(\n (id) => !lastMotionIds.has(id),\n )\n\n for (const motionId of newMotionIds) {\n const trajectory = await apiClient.motion.getMotionTrajectory(\n motionId,\n sampleTime,\n responsesCoordinateSystem,\n )\n newTrajectories.push(trajectory)\n }\n\n lastMotionIds = currentMotionIds\n } catch (error) {\n console.error(\"Failed to get latest trajectories:\", error)\n }\n\n return newTrajectories\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type { CollectionValue } from \"@wandelbots/nova-api/v1\"\nimport { AxiosError } from \"axios\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\n/** @deprecated */\nexport type ProgramRunnerLogEntry = {\n timestamp: number\n message: string\n level?: \"warn\" | \"error\"\n}\n\n/** @deprecated */\nexport enum ProgramState {\n NotStarted = \"not started\",\n Running = \"running\",\n Stopped = \"stopped\",\n Failed = \"failed\",\n Completed = \"completed\",\n}\n\n/** @deprecated */\nexport type CurrentProgram = {\n id?: string\n wandelscript?: string\n state?: ProgramState\n}\n\ntype ProgramStateMessage = {\n type: string\n runner: {\n id: string\n state: ProgramState\n start_time?: number | null\n execution_time?: number | null\n }\n}\n\n/**\n * Interface for running Wandelscript programs on the Nova instance and\n * tracking their progress and output\n * @deprecated\n */\nexport class ProgramStateConnection {\n currentProgram: CurrentProgram = {}\n logs: ProgramRunnerLogEntry[] = []\n\n executionState = \"idle\" as \"idle\" | \"starting\" | \"executing\" | \"stopping\"\n currentlyExecutingProgramRunnerId = null as string | null\n\n programStateSocket: AutoReconnectingWebsocket\n\n constructor(readonly nova: NovaClient) {\n makeAutoObservable(this, {}, { autoBind: true })\n\n this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)\n\n this.programStateSocket.addEventListener(\"message\", (ev) => {\n const msg = tryParseJson(ev.data)\n\n if (!msg) {\n console.error(\"Failed to parse program state message\", ev.data)\n return\n }\n if (msg.type === \"update\") {\n this.handleProgramStateMessage(msg)\n }\n })\n }\n\n /** Handle a program state update from the backend */\n async handleProgramStateMessage(msg: ProgramStateMessage) {\n const { runner } = msg\n\n // Ignoring other programs for now\n // TODO - show if execution state is busy from another source\n if (runner.id !== this.currentlyExecutingProgramRunnerId) return\n\n if (runner.state === ProgramState.Failed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n // TODO - wandelengine should send print statements in real time over\n // websocket as well, rather than at the end\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.logError(\n `Program runner ${runner.id} failed with error: ${runnerState.error}\\n${runnerState.traceback}`,\n )\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.currentProgram.state = ProgramState.Failed\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Stopped) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n\n this.currentProgram.state = ProgramState.Stopped\n this.log(`Program runner ${runner.id} stopped`)\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Completed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = runnerState.stdout\n if (stdout) {\n this.log(stdout)\n }\n this.log(\n `Program runner ${runner.id} finished successfully in ${runner.execution_time?.toFixed(2)} seconds`,\n )\n\n this.currentProgram.state = ProgramState.Completed\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Running) {\n this.currentProgram.state = ProgramState.Running\n this.log(`Program runner ${runner.id} now running`)\n } else if (runner.state !== ProgramState.NotStarted) {\n console.error(runner)\n this.logError(\n `Program runner ${runner.id} entered unexpected state: ${runner.state}`,\n )\n this.currentProgram.state = ProgramState.NotStarted\n this.gotoIdleState()\n }\n }\n\n /** Call when a program is no longer executing */\n gotoIdleState() {\n runInAction(() => {\n this.executionState = \"idle\"\n })\n this.currentlyExecutingProgramRunnerId = null\n }\n\n async executeProgram(\n wandelscript: string,\n initial_state?: { [key: string]: CollectionValue },\n activeRobot?: MotionStreamConnection,\n ) {\n this.currentProgram = {\n wandelscript: wandelscript,\n state: ProgramState.NotStarted,\n }\n\n const { currentProgram: openProgram } = this\n if (!openProgram) return\n runInAction(() => {\n this.executionState = \"starting\"\n })\n\n // Jogging can cause program execution to fail for some time after\n // So we need to explicitly stop jogging before running a program\n if (activeRobot) {\n try {\n await this.nova.api.motionGroupJogging.stopJogging(\n activeRobot.motionGroupId,\n )\n } catch (err) {\n console.error(err)\n }\n }\n\n // WOS-1539: Wandelengine parser currently breaks if there are empty lines with indentation\n const trimmedCode = openProgram.wandelscript!.replaceAll(/^\\s*$/gm, \"\")\n\n try {\n const programRunnerRef = await this.nova.api.program.createProgramRunner(\n {\n code: trimmedCode,\n initial_state: initial_state,\n // @ts-expect-error legacy code - check if param still used\n default_robot: activeRobot?.wandelscriptIdentifier,\n },\n {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n )\n\n this.log(`Created program runner ${programRunnerRef.id}\"`)\n runInAction(() => {\n this.executionState = \"executing\"\n })\n this.currentlyExecutingProgramRunnerId = programRunnerRef.id\n } catch (error) {\n if (error instanceof AxiosError && error.response && error.request) {\n this.logError(\n `${error.response.status} ${error.response.statusText} from ${error.response.config.url} ${JSON.stringify(error.response.data)}`,\n )\n } else {\n this.logError(JSON.stringify(error))\n }\n runInAction(() => {\n this.executionState = \"idle\"\n })\n }\n }\n\n async stopProgram() {\n if (!this.currentlyExecutingProgramRunnerId) return\n runInAction(() => {\n this.executionState = \"stopping\"\n })\n\n try {\n await this.nova.api.program.stopProgramRunner(\n this.currentlyExecutingProgramRunnerId,\n )\n } catch (err) {\n // Reactivate the stop button so user can try again\n runInAction(() => {\n this.executionState = \"executing\"\n })\n throw err\n }\n }\n\n reset() {\n this.currentProgram = {}\n }\n\n log(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n })\n }\n\n logError(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n level: \"error\",\n })\n }\n}\n"],"mappings":";;;;;;AAGA,IAAI,gCAA6B,IAAI,IAAI;;AAGzC,eAAsB,sBACpB,WACA,aAAqB,IACrB,2BACkC;CAClC,MAAM,kBAA2C,CAAC;CAElD,IAAI;EACF,MAAM,UAAU,MAAM,UAAU,OAAO,YAAY;EACnD,MAAM,mBAAmB,IAAI,IAAI,QAAQ,OAAO;EAEhD,MAAM,eAAe,MAAM,KAAK,gBAAgB,EAAE,QAC/C,OAAO,CAAC,cAAc,IAAI,EAAE,CAC/B;EAEA,KAAK,MAAM,YAAY,cAAc;GACnC,MAAM,aAAa,MAAM,UAAU,O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ACH;AACF"}
@@ -2,16 +2,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_LoginWithAuth0 = require("../../LoginWithAuth0-oZFpwe7m.cjs");
3
3
  let axios = require("axios");
4
4
  axios = require_LoginWithAuth0.__toESM(axios, 1);
5
- let url_join = require("url-join");
6
- url_join = require_LoginWithAuth0.__toESM(url_join, 1);
7
5
  let path_to_regexp = require("path-to-regexp");
8
6
  path_to_regexp = require_LoginWithAuth0.__toESM(path_to_regexp, 1);
9
7
  let _wandelbots_nova_api_v2 = require("@wandelbots/nova-api/v2");
10
- _wandelbots_nova_api_v2 = require_LoginWithAuth0.__toESM(_wandelbots_nova_api_v2, 1);
11
8
  //#region src/lib/deprecated/v2/NovaCellAPIClient.ts
12
9
  /**
13
10
  * API client providing type-safe access to all the Nova API REST endpoints
14
11
  * associated with a specific cell id.
12
+ * @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
15
13
  */
16
14
  var NovaCellAPIClient = class {
17
15
  constructor(cellId, opts) {
@@ -695,8 +693,8 @@ const defaultMotionState = { result: {
695
693
  //#endregion
696
694
  //#region src/lib/deprecated/v2/NovaClient.ts
697
695
  /**
698
- *
699
696
  * Client for connecting to a Nova instance and controlling robots.
697
+ * @deprecated Use `Nova` from `@wandelbots/nova-js/v2` instead.
700
698
  */
701
699
  var NovaClient = class {
702
700
  constructor(config) {
@@ -711,7 +709,7 @@ var NovaClient = class {
711
709
  if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
712
710
  this.instanceUrl = require_LoginWithAuth0.parseNovaInstanceUrl(this.config.instanceUrl);
713
711
  const axiosInstance = axios.default.create({
714
- baseURL: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
712
+ baseURL: new URL("/api/v2", this.instanceUrl).href,
715
713
  headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
716
714
  });
717
715
  axiosInstance.interceptors.request.use(async (request) => {
@@ -741,7 +739,7 @@ var NovaClient = class {
741
739
  });
742
740
  this.api = new NovaCellAPIClient(cellId, {
743
741
  ...config,
744
- basePath: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
742
+ basePath: new URL("/api/v2", this.instanceUrl).href,
745
743
  isJsonMime: (mime) => {
746
744
  return mime === "application/json";
747
745
  },
@@ -771,7 +769,7 @@ var NovaClient = class {
771
769
  }
772
770
  }
773
771
  makeWebsocketURL(path) {
774
- const url = new URL((0, url_join.default)(this.instanceUrl.href, `/api/v2/cells/${this.config.cellId}`, path));
772
+ const url = new URL(new URL(`/api/v2/cells/${this.config.cellId}/${path.replace(/^\/+/, "")}`, this.instanceUrl).href);
775
773
  url.protocol = url.protocol.replace("http", "ws");
776
774
  url.protocol = url.protocol.replace("https", "wss");
777
775
  if (this.accessToken) url.searchParams.append("token", this.accessToken);
@@ -795,6 +793,7 @@ var NovaClient = class {
795
793
  /**
796
794
  * Convert a Pose object representing a motion group position
797
795
  * into a string which represents that pose in Wandelscript.
796
+ * @deprecated Wandelscript usage is deprecated; switching to Python is recommended.
798
797
  */
799
798
  function poseToWandelscriptString(pose) {
800
799
  const position = [
@@ -813,10 +812,7 @@ function poseToWandelscriptString(pose) {
813
812
  }
814
813
  //#endregion
815
814
  //#region src/lib/v2/NovaAPIClient.ts
816
- function isApiClass(name, value) {
817
- return name.endsWith("Api") && typeof value === "function" && !name.includes("Factory") && !name.includes("Fp") && !name.includes("ParamCreator");
818
- }
819
- function wrapApi(ApiConstructor, opts) {
815
+ function unwrap(ApiConstructor, opts) {
820
816
  const apiClient = new ApiConstructor({
821
817
  ...opts,
822
818
  isJsonMime: (mime) => mime === "application/json"
@@ -829,20 +825,36 @@ function wrapApi(ApiConstructor, opts) {
829
825
  }
830
826
  /**
831
827
  * API client providing type-safe access to all the endpoints of a NOVA
832
- * instance. API sections are auto-discovered from @wandelbots/nova-api/v2
833
- * at runtime, so new sections added upstream are exposed automatically.
828
+ * instance.
834
829
  */
835
- const NovaAPIClient = class NovaAPIClient {
830
+ var NovaAPIClient = class {
836
831
  constructor(opts) {
837
832
  this.opts = opts;
838
- for (const [name, value] of Object.entries(_wandelbots_nova_api_v2)) if (isApiClass(name, value)) {
839
- const stripped = name.slice(0, -3);
840
- let i = 0;
841
- while (i < stripped.length && stripped[i] === stripped[i].toUpperCase() && stripped[i] !== stripped[i].toLowerCase()) i++;
842
- const boundary = i > 1 ? i - 1 : i;
843
- const propName = stripped.slice(0, boundary).toLowerCase() + stripped.slice(boundary);
844
- this[propName] = wrapApi(value, opts);
845
- }
833
+ this.application = unwrap(_wandelbots_nova_api_v2.ApplicationApi, opts);
834
+ this.busIOs = unwrap(_wandelbots_nova_api_v2.BUSInputsOutputsApi, opts);
835
+ this.cell = unwrap(_wandelbots_nova_api_v2.CellApi, opts);
836
+ this.controller = unwrap(_wandelbots_nova_api_v2.ControllerApi, opts);
837
+ this.controllerIOs = unwrap(_wandelbots_nova_api_v2.ControllerInputsOutputsApi, opts);
838
+ this.jogging = unwrap(_wandelbots_nova_api_v2.JoggingApi, opts);
839
+ this.kinematics = unwrap(_wandelbots_nova_api_v2.KinematicsApi, opts);
840
+ this.license = unwrap(_wandelbots_nova_api_v2.LicenseApi, opts);
841
+ this.motionGroup = unwrap(_wandelbots_nova_api_v2.MotionGroupApi, opts);
842
+ this.motionGroupModels = unwrap(_wandelbots_nova_api_v2.MotionGroupModelsApi, opts);
843
+ this.novaCloud = unwrap(_wandelbots_nova_api_v2.NOVACloudApi, opts);
844
+ this.program = unwrap(_wandelbots_nova_api_v2.ProgramApi, opts);
845
+ this.robotConfigurations = unwrap(_wandelbots_nova_api_v2.RobotConfigurationsApi, opts);
846
+ this.session = unwrap(_wandelbots_nova_api_v2.SessionApi, opts);
847
+ this.storeCollisionComponents = unwrap(_wandelbots_nova_api_v2.StoreCollisionComponentsApi, opts);
848
+ this.storeCollisionSetups = unwrap(_wandelbots_nova_api_v2.StoreCollisionSetupsApi, opts);
849
+ this.storeObject = unwrap(_wandelbots_nova_api_v2.StoreObjectApi, opts);
850
+ this.system = unwrap(_wandelbots_nova_api_v2.SystemApi, opts);
851
+ this.trajectoryCaching = unwrap(_wandelbots_nova_api_v2.TrajectoryCachingApi, opts);
852
+ this.trajectoryExecution = unwrap(_wandelbots_nova_api_v2.TrajectoryExecutionApi, opts);
853
+ this.trajectoryPlanning = unwrap(_wandelbots_nova_api_v2.TrajectoryPlanningApi, opts);
854
+ this.version = unwrap(_wandelbots_nova_api_v2.VersionApi, opts);
855
+ this.virtualController = unwrap(_wandelbots_nova_api_v2.VirtualControllerApi, opts);
856
+ this.virtualControllerBehavior = unwrap(_wandelbots_nova_api_v2.VirtualControllerBehaviorApi, opts);
857
+ this.virtualControllerIOs = unwrap(_wandelbots_nova_api_v2.VirtualControllerInputsOutputsApi, opts);
846
858
  }
847
859
  };
848
860
  //#endregion
@@ -860,7 +872,7 @@ var Nova = class {
860
872
  if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
861
873
  this.instanceUrl = require_LoginWithAuth0.parseNovaInstanceUrl(this.config.instanceUrl);
862
874
  const axiosInstance = axios.default.create({
863
- baseURL: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
875
+ baseURL: new URL("/api/v2", this.instanceUrl).href,
864
876
  headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
865
877
  });
866
878
  axiosInstance.interceptors.request.use(async (request) => {
@@ -890,12 +902,13 @@ var Nova = class {
890
902
  });
891
903
  this.api = new NovaAPIClient({
892
904
  ...config,
893
- basePath: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
905
+ basePath: new URL("/api/v2", this.instanceUrl).href,
894
906
  isJsonMime: (mime) => {
895
907
  return mime === "application/json";
896
908
  },
897
909
  baseOptions: {
898
910
  ...this.mock ? { adapter: (config) => {
911
+ if (!this.mock) throw new Error("Mock adapter used without a mock instance");
899
912
  return this.mock.handleAPIRequest(config);
900
913
  } } : {},
901
914
  ...config.baseOptions
@@ -920,7 +933,7 @@ var Nova = class {
920
933
  }
921
934
  }
922
935
  makeWebsocketURL(path) {
923
- const url = new URL((0, url_join.default)(this.instanceUrl.href, `/api/v2`, path));
936
+ const url = new URL(`/api/v2/${path.replace(/^\/+/, "")}`, this.instanceUrl);
924
937
  url.protocol = url.protocol.replace("http", "ws");
925
938
  url.protocol = url.protocol.replace("https", "wss");
926
939
  if (this.accessToken) url.searchParams.append("token", this.accessToken);