@wandelbots/nova-js 3.9.0-pr.280.641b7e2 → 3.9.0-pr.280.7a81d6a

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 +10 -10
  2. package/dist/{AutoReconnectingWebsocket-DNOF9mpz.d.cts → AutoReconnectingWebsocket-DEs8wlLZ.d.cts} +1 -2
  3. package/dist/AutoReconnectingWebsocket-DEs8wlLZ.d.cts.map +1 -0
  4. package/dist/{AutoReconnectingWebsocket-DNOF9mpz.d.mts → AutoReconnectingWebsocket-DEs8wlLZ.d.mts} +1 -2
  5. package/dist/AutoReconnectingWebsocket-DEs8wlLZ.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 +1 -4
  11. package/dist/lib/deprecated/v1/index.cjs.map +1 -1
  12. package/dist/lib/deprecated/v1/index.d.cts +2 -7
  13. package/dist/lib/deprecated/v1/index.d.cts.map +1 -1
  14. package/dist/lib/deprecated/v1/index.d.mts +2 -7
  15. package/dist/lib/deprecated/v1/index.d.mts.map +1 -1
  16. package/dist/lib/deprecated/v1/index.mjs +1 -4
  17. package/dist/lib/deprecated/v1/index.mjs.map +1 -1
  18. package/dist/lib/v2/index.cjs +25 -38
  19. package/dist/lib/v2/index.cjs.map +1 -1
  20. package/dist/lib/v2/index.d.cts +35 -44
  21. package/dist/lib/v2/index.d.cts.map +1 -1
  22. package/dist/lib/v2/index.d.mts +35 -44
  23. package/dist/lib/v2/index.d.mts.map +1 -1
  24. package/dist/lib/v2/index.mjs +24 -38
  25. package/dist/lib/v2/index.mjs.map +1 -1
  26. package/dist/{wandelscriptUtils-P0WYSZww.cjs → wandelscriptUtils-BvZ8hcul.cjs} +6 -12
  27. package/dist/wandelscriptUtils-BvZ8hcul.cjs.map +1 -0
  28. package/dist/{wandelscriptUtils-C7hQePlo.mjs → wandelscriptUtils-CsQAUu_9.mjs} +5 -12
  29. package/dist/wandelscriptUtils-CsQAUu_9.mjs.map +1 -0
  30. package/dist/{wandelscriptUtils-1A9uFPV_.d.cts → wandelscriptUtils-Cz-yQ2eJ.d.mts} +3 -13
  31. package/dist/wandelscriptUtils-Cz-yQ2eJ.d.mts.map +1 -0
  32. package/dist/{wandelscriptUtils-pySXnBlX.d.mts → wandelscriptUtils-_Si3ueEd.d.cts} +3 -13
  33. package/dist/wandelscriptUtils-_Si3ueEd.d.cts.map +1 -0
  34. package/package.json +3 -2
  35. package/src/lib/deprecated/v1/ConnectedMotionGroup.ts +0 -2
  36. package/src/lib/deprecated/v1/JoggerConnection.ts +0 -2
  37. package/src/lib/deprecated/v1/MotionStreamConnection.ts +0 -1
  38. package/src/lib/deprecated/v1/NovaCellAPIClient.ts +0 -3
  39. package/src/lib/deprecated/v1/NovaClient.ts +8 -8
  40. package/src/lib/deprecated/v1/ProgramStateConnection.ts +0 -4
  41. package/src/lib/deprecated/v1/getLatestTrajectories.ts +0 -1
  42. package/src/lib/deprecated/v1/mock/MockNovaInstance.ts +0 -1
  43. package/src/lib/deprecated/v1/motionStateUpdate.ts +0 -2
  44. package/src/lib/deprecated/v1/wandelscriptUtils.ts +0 -1
  45. package/src/lib/deprecated/v2/NovaCellAPIClient.ts +0 -3
  46. package/src/lib/deprecated/v2/NovaClient.ts +9 -9
  47. package/src/lib/deprecated/v2/wandelscriptUtils.ts +0 -1
  48. package/src/lib/v2/Nova.ts +9 -10
  49. package/src/lib/v2/NovaAPIClient.ts +93 -81
  50. package/src/lib/v2/index.ts +1 -1
  51. package/dist/AutoReconnectingWebsocket-DNOF9mpz.d.cts.map +0 -1
  52. package/dist/AutoReconnectingWebsocket-DNOF9mpz.d.mts.map +0 -1
  53. package/dist/wandelscriptUtils-1A9uFPV_.d.cts.map +0 -1
  54. package/dist/wandelscriptUtils-C7hQePlo.mjs.map +0 -1
  55. package/dist/wandelscriptUtils-P0WYSZww.cjs.map +0 -1
  56. package/dist/wandelscriptUtils-pySXnBlX.d.mts.map +0 -1
package/README.md CHANGED
@@ -15,17 +15,15 @@ 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 `Nova` client, which represents a connection to a given NOVA instance:
18
+ The core of this package is the `NovaClient`, which represents a connection to a configured robot cell on a given NOVA instance:
19
19
 
20
20
  ```ts
21
- import { Nova } from "@wandelbots/nova-js/v2"
21
+ import { NovaClient } from "@wandelbots/nova-js/v2"
22
22
 
23
- const nova = new Nova({
23
+ const nova = new NovaClient({
24
24
  instanceUrl: "https://example.instance.wandelbots.io",
25
-
25
+ cellId: "cell",
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)
29
27
  accessToken: "...",
30
28
  })
31
29
  ```
@@ -37,7 +35,7 @@ You can make calls to the REST API via `nova.api`, which contains a bunch of nam
37
35
  For example, to list the controllers configured in your cell:
38
36
 
39
37
  ```ts
40
- const controllerIds = await nova.api.controller.listRobotControllers("cell")
38
+ const controllerIds = await nova.api.controller.listRobotControllers()
41
39
  // -> e.g. ["ur5e", ...]
42
40
  ```
43
41
 
@@ -48,9 +46,9 @@ Documentation for the various API endpoints is available on your Nova instance a
48
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:
49
47
 
50
48
  ```ts
51
- const joggingWebsocket = nova.openReconnectingWebsocket(`/cells/cell/controllers/ur5e/execution/jogging`)
49
+ const programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)
52
50
 
53
- this.joggingWebsocket.addEventListener("message", (ev) => {
51
+ this.programStateSocket.addEventListener("message", (ev) => {
54
52
  console.log(ev.data)
55
53
  })
56
54
  ```
@@ -58,9 +56,11 @@ this.joggingWebsocket.addEventListener("message", (ev) => {
58
56
  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:
59
57
 
60
58
  ```ts
61
- joggingWebsocket.dispose()
59
+ programStateSocket.dispose()
62
60
  ```
63
61
 
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
64
  ## Contributing
65
65
 
66
66
  If you would like to contribute a change to this repository, see [CONTRIBUTING.md](CONTRIBUTING.md).
@@ -4,7 +4,6 @@ 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
8
7
  */
9
8
  declare class MockNovaInstance$1 {
10
9
  readonly connections: AutoReconnectingWebsocket[];
@@ -66,4 +65,4 @@ declare class AutoReconnectingWebsocket extends ReconnectingWebSocket {
66
65
  }
67
66
  //#endregion
68
67
  export { MockNovaInstance as n, MockNovaInstance$1 as r, AutoReconnectingWebsocket as t };
69
- //# sourceMappingURL=AutoReconnectingWebsocket-DNOF9mpz.d.cts.map
68
+ //# sourceMappingURL=AutoReconnectingWebsocket-DEs8wlLZ.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoReconnectingWebsocket-DEs8wlLZ.d.cts","names":[],"sources":["../src/lib/deprecated/v1/mock/MockNovaInstance.ts","../src/lib/v2/mock/MockNovaInstance.ts","../src/lib/AutoReconnectingWebsocket.ts"],"mappings":";;;;;;AAeA;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;cCAa,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;EF7CH;;;;EEyDN,OAAA,CAAA;EFy4BA;;;EE93BM,MAAA,CAAA,GAAM,OAAA;EFgmCmB;;;EEllCzB,MAAA,CAAA,GAAM,OAAA;EFklC6D;;;;ACvqC3E;ECqGQ,YAAA,CAAA,GAAY,OAAA,CAAA,YAAA;;;;;EA4BZ,WAAA,CAAA,GAAW,OAAA,CAAA,YAAA;AAAA"}
@@ -4,7 +4,6 @@ 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
8
7
  */
9
8
  declare class MockNovaInstance$1 {
10
9
  readonly connections: AutoReconnectingWebsocket[];
@@ -66,4 +65,4 @@ declare class AutoReconnectingWebsocket extends ReconnectingWebSocket {
66
65
  }
67
66
  //#endregion
68
67
  export { MockNovaInstance as n, MockNovaInstance$1 as r, AutoReconnectingWebsocket as t };
69
- //# sourceMappingURL=AutoReconnectingWebsocket-DNOF9mpz.d.mts.map
68
+ //# sourceMappingURL=AutoReconnectingWebsocket-DEs8wlLZ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoReconnectingWebsocket-DEs8wlLZ.d.mts","names":[],"sources":["../src/lib/deprecated/v1/mock/MockNovaInstance.ts","../src/lib/v2/mock/MockNovaInstance.ts","../src/lib/AutoReconnectingWebsocket.ts"],"mappings":";;;;;;AAeA;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;cCAa,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;EF7CH;;;;EEyDN,OAAA,CAAA;EFy4BA;;;EE93BM,MAAA,CAAA,GAAM,OAAA;EFgmCmB;;;EEllCzB,MAAA,CAAA,GAAM,OAAA;EFklC6D;;;;ACvqC3E;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-P0WYSZww.cjs");
3
+ const require_wandelscriptUtils = require("./wandelscriptUtils-BvZ8hcul.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-DNOF9mpz.cjs";
2
- import { n as NovaClient, r as NovaClientConfig, t as poseToWandelscriptString } from "./wandelscriptUtils-1A9uFPV_.cjs";
1
+ import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-DEs8wlLZ.cjs";
2
+ import { n as NovaClient, r as NovaClientConfig, t as poseToWandelscriptString } from "./wandelscriptUtils-_Si3ueEd.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-DNOF9mpz.mjs";
2
- import { n as NovaClient, r as NovaClientConfig, t as poseToWandelscriptString } from "./wandelscriptUtils-pySXnBlX.mjs";
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";
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-C7hQePlo.mjs";
2
+ import { n as NovaClient, t as poseToWandelscriptString } from "./wandelscriptUtils-CsQAUu_9.mjs";
3
3
  import { isAxiosError } from "axios";
4
4
  //#region src/lib/errorHandling.ts
5
5
  function delay(ms) {
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_LoginWithAuth0 = require("../../../LoginWithAuth0-oZFpwe7m.cjs");
3
- const require_wandelscriptUtils = require("../../../wandelscriptUtils-P0WYSZww.cjs");
3
+ const require_wandelscriptUtils = require("../../../wandelscriptUtils-BvZ8hcul.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 */
9
8
  async function getLatestTrajectories(apiClient, sampleTime = 50, responsesCoordinateSystem) {
10
9
  const newTrajectories = [];
11
10
  try {
@@ -24,7 +23,6 @@ async function getLatestTrajectories(apiClient, sampleTime = 50, responsesCoordi
24
23
  }
25
24
  //#endregion
26
25
  //#region src/lib/deprecated/v1/ProgramStateConnection.ts
27
- /** @deprecated */
28
26
  let ProgramState = /* @__PURE__ */ function(ProgramState) {
29
27
  ProgramState["NotStarted"] = "not started";
30
28
  ProgramState["Running"] = "running";
@@ -36,7 +34,6 @@ let ProgramState = /* @__PURE__ */ function(ProgramState) {
36
34
  /**
37
35
  * Interface for running Wandelscript programs on the Nova instance and
38
36
  * tracking their progress and output
39
- * @deprecated
40
37
  */
41
38
  var ProgramStateConnection = class {
42
39
  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\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;CACA,aAAA,aAAA;CACA,aAAA,aAAA;CACA,aAAA,YAAA;CACA,aAAA,eAAA;;AACF,EAAA,CAAA,CAAA;;;;;;AAw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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\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;CACA,aAAA,YAAA;CACA,aAAA,eAAA;;AACF,EAAA,CAAA,CAAA;;;;;AAsBA,IAAa,yBAAb,MAAoC;CAS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AClB,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,20 +1,17 @@
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";
1
+ import { t as AutoReconnectingWebsocket } from "../../../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";
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 */
8
7
  declare function getLatestTrajectories(apiClient: NovaCellAPIClient, sampleTime?: number, responsesCoordinateSystem?: string): Promise<GetTrajectoryResponse[]>;
9
8
  //#endregion
10
9
  //#region src/lib/deprecated/v1/ProgramStateConnection.d.ts
11
- /** @deprecated */
12
10
  type ProgramRunnerLogEntry = {
13
11
  timestamp: number;
14
12
  message: string;
15
13
  level?: "warn" | "error";
16
14
  };
17
- /** @deprecated */
18
15
  declare enum ProgramState {
19
16
  NotStarted = "not started",
20
17
  Running = "running",
@@ -22,7 +19,6 @@ declare enum ProgramState {
22
19
  Failed = "failed",
23
20
  Completed = "completed"
24
21
  }
25
- /** @deprecated */
26
22
  type CurrentProgram = {
27
23
  id?: string;
28
24
  wandelscript?: string;
@@ -40,7 +36,6 @@ type ProgramStateMessage = {
40
36
  /**
41
37
  * Interface for running Wandelscript programs on the Nova instance and
42
38
  * tracking their progress and output
43
- * @deprecated
44
39
  */
45
40
  declare class ProgramStateConnection {
46
41
  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":";;;;;;;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
+ {"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,20 +1,17 @@
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";
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";
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 */
8
7
  declare function getLatestTrajectories(apiClient: NovaCellAPIClient, sampleTime?: number, responsesCoordinateSystem?: string): Promise<GetTrajectoryResponse[]>;
9
8
  //#endregion
10
9
  //#region src/lib/deprecated/v1/ProgramStateConnection.d.ts
11
- /** @deprecated */
12
10
  type ProgramRunnerLogEntry = {
13
11
  timestamp: number;
14
12
  message: string;
15
13
  level?: "warn" | "error";
16
14
  };
17
- /** @deprecated */
18
15
  declare enum ProgramState {
19
16
  NotStarted = "not started",
20
17
  Running = "running",
@@ -22,7 +19,6 @@ declare enum ProgramState {
22
19
  Failed = "failed",
23
20
  Completed = "completed"
24
21
  }
25
- /** @deprecated */
26
22
  type CurrentProgram = {
27
23
  id?: string;
28
24
  wandelscript?: string;
@@ -40,7 +36,6 @@ type ProgramStateMessage = {
40
36
  /**
41
37
  * Interface for running Wandelscript programs on the Nova instance and
42
38
  * tracking their progress and output
43
- * @deprecated
44
39
  */
45
40
  declare class ProgramStateConnection {
46
41
  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":";;;;;;;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
+ {"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,11 +1,10 @@
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-C7hQePlo.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";
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 */
9
8
  async function getLatestTrajectories(apiClient, sampleTime = 50, responsesCoordinateSystem) {
10
9
  const newTrajectories = [];
11
10
  try {
@@ -24,7 +23,6 @@ async function getLatestTrajectories(apiClient, sampleTime = 50, responsesCoordi
24
23
  }
25
24
  //#endregion
26
25
  //#region src/lib/deprecated/v1/ProgramStateConnection.ts
27
- /** @deprecated */
28
26
  let ProgramState = /* @__PURE__ */ function(ProgramState) {
29
27
  ProgramState["NotStarted"] = "not started";
30
28
  ProgramState["Running"] = "running";
@@ -36,7 +34,6 @@ let ProgramState = /* @__PURE__ */ function(ProgramState) {
36
34
  /**
37
35
  * Interface for running Wandelscript programs on the Nova instance and
38
36
  * tracking their progress and output
39
- * @deprecated
40
37
  */
41
38
  var ProgramStateConnection = class {
42
39
  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\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,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W,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\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,OAA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AM,mBAAmB,MAAM,KAAK,KAAK,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,kBAAkB;IAChB,KAAK,iBAAiB;GACxB,CAAC;GACD,KAAK,oCAAoC,iBAAiB;EAC5D,SAAS,OAAO;GACd,IAAI,iBAAiB,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,kBAAkB;IAChB,KAAK,iBAAiB;GACxB,CAAC;EACH;CACF;CAEA,MAAM,cAAc;EAClB,IAAI,CAAC,KAAK,mCAAmC;EAC7C,kBAAkB;GAChB,KAAK,iBAAiB;EACxB,CAAC;EAED,IAAI;GACF,MAAM,KAAK,KAAK,IAAI,QAAQ,kBAC1B,KAAK,iCACP;EACF,SAAS,KAAK;GAEZ,kBAAkB;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"}
@@ -2,14 +2,16 @@ 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);
5
7
  let path_to_regexp = require("path-to-regexp");
6
8
  path_to_regexp = require_LoginWithAuth0.__toESM(path_to_regexp, 1);
7
9
  let _wandelbots_nova_api_v2 = require("@wandelbots/nova-api/v2");
10
+ _wandelbots_nova_api_v2 = require_LoginWithAuth0.__toESM(_wandelbots_nova_api_v2, 1);
8
11
  //#region src/lib/deprecated/v2/NovaCellAPIClient.ts
9
12
  /**
10
13
  * API client providing type-safe access to all the Nova API REST endpoints
11
14
  * associated with a specific cell id.
12
- * @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
13
15
  */
14
16
  var NovaCellAPIClient = class {
15
17
  constructor(cellId, opts) {
@@ -693,8 +695,8 @@ const defaultMotionState = { result: {
693
695
  //#endregion
694
696
  //#region src/lib/deprecated/v2/NovaClient.ts
695
697
  /**
698
+ *
696
699
  * Client for connecting to a Nova instance and controlling robots.
697
- * @deprecated Use `Nova` from `@wandelbots/nova-js/v2` instead.
698
700
  */
699
701
  var NovaClient = class {
700
702
  constructor(config) {
@@ -709,7 +711,7 @@ var NovaClient = class {
709
711
  if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
710
712
  this.instanceUrl = require_LoginWithAuth0.parseNovaInstanceUrl(this.config.instanceUrl);
711
713
  const axiosInstance = axios.default.create({
712
- baseURL: new URL("/api/v2", this.instanceUrl).href,
714
+ baseURL: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
713
715
  headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
714
716
  });
715
717
  axiosInstance.interceptors.request.use(async (request) => {
@@ -739,7 +741,7 @@ var NovaClient = class {
739
741
  });
740
742
  this.api = new NovaCellAPIClient(cellId, {
741
743
  ...config,
742
- basePath: new URL("/api/v2", this.instanceUrl).href,
744
+ basePath: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
743
745
  isJsonMime: (mime) => {
744
746
  return mime === "application/json";
745
747
  },
@@ -769,7 +771,7 @@ var NovaClient = class {
769
771
  }
770
772
  }
771
773
  makeWebsocketURL(path) {
772
- const url = new URL(new URL(`/api/v2/cells/${this.config.cellId}/${path.replace(/^\/+/, "")}`, this.instanceUrl).href);
774
+ const url = new URL((0, url_join.default)(this.instanceUrl.href, `/api/v2/cells/${this.config.cellId}`, path));
773
775
  url.protocol = url.protocol.replace("http", "ws");
774
776
  url.protocol = url.protocol.replace("https", "wss");
775
777
  if (this.accessToken) url.searchParams.append("token", this.accessToken);
@@ -793,7 +795,6 @@ var NovaClient = class {
793
795
  /**
794
796
  * Convert a Pose object representing a motion group position
795
797
  * into a string which represents that pose in Wandelscript.
796
- * @deprecated Wandelscript usage is deprecated; switching to Python is recommended.
797
798
  */
798
799
  function poseToWandelscriptString(pose) {
799
800
  const position = [
@@ -812,7 +813,10 @@ function poseToWandelscriptString(pose) {
812
813
  }
813
814
  //#endregion
814
815
  //#region src/lib/v2/NovaAPIClient.ts
815
- function unwrap(ApiConstructor, opts) {
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) {
816
820
  const apiClient = new ApiConstructor({
817
821
  ...opts,
818
822
  isJsonMime: (mime) => mime === "application/json"
@@ -825,36 +829,20 @@ function unwrap(ApiConstructor, opts) {
825
829
  }
826
830
  /**
827
831
  * API client providing type-safe access to all the endpoints of a NOVA
828
- * instance.
832
+ * instance. API sections are auto-discovered from @wandelbots/nova-api/v2
833
+ * at runtime, so new sections added upstream are exposed automatically.
829
834
  */
830
- var NovaAPIClient = class {
835
+ const NovaAPIClient = class NovaAPIClient {
831
836
  constructor(opts) {
832
837
  this.opts = opts;
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);
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
+ }
858
846
  }
859
847
  };
860
848
  //#endregion
@@ -872,7 +860,7 @@ var Nova = class {
872
860
  if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
873
861
  this.instanceUrl = require_LoginWithAuth0.parseNovaInstanceUrl(this.config.instanceUrl);
874
862
  const axiosInstance = axios.default.create({
875
- baseURL: new URL("/api/v2", this.instanceUrl).href,
863
+ baseURL: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
876
864
  headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
877
865
  });
878
866
  axiosInstance.interceptors.request.use(async (request) => {
@@ -902,13 +890,12 @@ var Nova = class {
902
890
  });
903
891
  this.api = new NovaAPIClient({
904
892
  ...config,
905
- basePath: new URL("/api/v2", this.instanceUrl).href,
893
+ basePath: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
906
894
  isJsonMime: (mime) => {
907
895
  return mime === "application/json";
908
896
  },
909
897
  baseOptions: {
910
898
  ...this.mock ? { adapter: (config) => {
911
- if (!this.mock) throw new Error("Mock adapter used without a mock instance");
912
899
  return this.mock.handleAPIRequest(config);
913
900
  } } : {},
914
901
  ...config.baseOptions
@@ -933,7 +920,7 @@ var Nova = class {
933
920
  }
934
921
  }
935
922
  makeWebsocketURL(path) {
936
- const url = new URL(`/api/v2/${path.replace(/^\/+/, "")}`, this.instanceUrl);
923
+ const url = new URL((0, url_join.default)(this.instanceUrl.href, `/api/v2`, path));
937
924
  url.protocol = url.protocol.replace("http", "ws");
938
925
  url.protocol = url.protocol.replace("https", "wss");
939
926
  if (this.accessToken) url.searchParams.append("token", this.accessToken);