@wandelbots/nova-js 3.13.0 → 4.0.0-pr.309.02b99fd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AutoReconnectingWebsocket-1K2J1NA4.d.cts → AutoReconnectingWebsocket-BSt-vnzX.d.mts} +4 -16
- package/dist/AutoReconnectingWebsocket-BSt-vnzX.d.mts.map +1 -0
- package/dist/{context-ffr5Q2dc.mjs → LoginWithAuth0-D92HnzHq.mjs} +3 -13
- package/dist/LoginWithAuth0-D92HnzHq.mjs.map +1 -0
- package/dist/{Nova--8gozkLR.d.mts → Nova-C8nDNSCa.d.mts} +2 -2
- package/dist/{Nova--8gozkLR.d.mts.map → Nova-C8nDNSCa.d.mts.map} +1 -1
- package/dist/experimental/nats/index.d.mts +1 -1
- package/dist/index.d.mts +2 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -3
- package/dist/v2/index.d.mts +2 -130
- package/dist/v2/index.mjs +4 -231
- package/dist/v2/index.mjs.map +1 -1
- package/package.json +13 -17
- package/src/index.ts +0 -2
- package/src/lib/AutoReconnectingWebsocket.ts +3 -4
- package/src/lib/LoginWithAuth0.ts +1 -1
- package/src/lib/context.ts +1 -1
- package/src/lib/errorHandling.ts +0 -7
- package/src/v2/index.ts +0 -3
- package/dist/AutoReconnectingWebsocket-1K2J1NA4.d.cts.map +0 -1
- package/dist/AutoReconnectingWebsocket-1K2J1NA4.d.mts +0 -69
- package/dist/AutoReconnectingWebsocket-1K2J1NA4.d.mts.map +0 -1
- package/dist/Nova-B1o5iTQ6.d.cts +0 -85
- package/dist/Nova-B1o5iTQ6.d.cts.map +0 -1
- package/dist/context-BZELA2eh.cjs +0 -348
- package/dist/context-BZELA2eh.cjs.map +0 -1
- package/dist/context-ffr5Q2dc.mjs.map +0 -1
- package/dist/converters-EYS27XJE.cjs +0 -146
- package/dist/converters-EYS27XJE.cjs.map +0 -1
- package/dist/experimental/nats/index.cjs +0 -158
- package/dist/experimental/nats/index.cjs.map +0 -1
- package/dist/experimental/nats/index.d.cts +0 -3235
- package/dist/experimental/nats/index.d.cts.map +0 -1
- package/dist/index.cjs +0 -24
- package/dist/index.d.cts +0 -110
- package/dist/index.d.cts.map +0 -1
- package/dist/v1/index.cjs +0 -201
- package/dist/v1/index.cjs.map +0 -1
- package/dist/v1/index.d.cts +0 -67
- package/dist/v1/index.d.cts.map +0 -1
- package/dist/v1/index.d.mts +0 -67
- package/dist/v1/index.d.mts.map +0 -1
- package/dist/v1/index.mjs +0 -184
- package/dist/v1/index.mjs.map +0 -1
- package/dist/v2/index.cjs +0 -1038
- package/dist/v2/index.cjs.map +0 -1
- package/dist/v2/index.d.cts +0 -131
- package/dist/v2/index.d.cts.map +0 -1
- package/dist/v2/index.d.mts.map +0 -1
- package/dist/wandelscriptUtils-CpUXdLVc.mjs +0 -2062
- package/dist/wandelscriptUtils-CpUXdLVc.mjs.map +0 -1
- package/dist/wandelscriptUtils-DY3WsiuB.d.cts +0 -356
- package/dist/wandelscriptUtils-DY3WsiuB.d.cts.map +0 -1
- package/dist/wandelscriptUtils-DcY1aLWu.cjs +0 -2099
- package/dist/wandelscriptUtils-DcY1aLWu.cjs.map +0 -1
- package/dist/wandelscriptUtils-YHTxn_p9.d.mts +0 -356
- package/dist/wandelscriptUtils-YHTxn_p9.d.mts.map +0 -1
- package/src/lib/deprecated/v1/ConnectedMotionGroup.ts +0 -449
- package/src/lib/deprecated/v1/JoggerConnection.ts +0 -491
- package/src/lib/deprecated/v1/MotionStreamConnection.ts +0 -215
- package/src/lib/deprecated/v1/NovaCellAPIClient.ts +0 -208
- package/src/lib/deprecated/v1/NovaClient.ts +0 -260
- package/src/lib/deprecated/v1/ProgramStateConnection.ts +0 -277
- package/src/lib/deprecated/v1/getLatestTrajectories.ts +0 -37
- package/src/lib/deprecated/v1/mock/MockNovaInstance.ts +0 -1303
- package/src/lib/deprecated/v1/motionStateUpdate.ts +0 -58
- package/src/lib/deprecated/v1/wandelscriptUtils.ts +0 -23
- package/src/lib/deprecated/v2/NovaCellAPIClient.ts +0 -215
- package/src/lib/deprecated/v2/NovaClient.ts +0 -218
- package/src/lib/deprecated/v2/wandelscriptUtils.ts +0 -28
- package/src/v1/index.ts +0 -14
package/dist/{AutoReconnectingWebsocket-1K2J1NA4.d.cts → AutoReconnectingWebsocket-BSt-vnzX.d.mts}
RENAMED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import ReconnectingWebSocket from "reconnecting-websocket";
|
|
2
2
|
import { AxiosResponse, InternalAxiosRequestConfig } from "axios";
|
|
3
3
|
|
|
4
|
-
//#region src/lib/deprecated/v1/mock/MockNovaInstance.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Ultra-simplified mock Nova server for testing stuff
|
|
7
|
-
* @deprecated
|
|
8
|
-
*/
|
|
9
|
-
declare class MockNovaInstance$1 {
|
|
10
|
-
readonly connections: AutoReconnectingWebsocket[];
|
|
11
|
-
handleAPIRequest(config: InternalAxiosRequestConfig): Promise<AxiosResponse>;
|
|
12
|
-
handleWebsocketConnection(socket: AutoReconnectingWebsocket): void;
|
|
13
|
-
handleWebsocketMessage(socket: AutoReconnectingWebsocket, message: string): void;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
4
|
//#region src/lib/mock/MockNovaInstance.d.ts
|
|
17
5
|
/**
|
|
18
6
|
* Ultra-simplified mock Nova server for testing stuff
|
|
@@ -30,11 +18,11 @@ declare class AutoReconnectingWebsocket extends ReconnectingWebSocket {
|
|
|
30
18
|
targetUrl: string;
|
|
31
19
|
disposed: boolean;
|
|
32
20
|
readonly opts: {
|
|
33
|
-
mock?: MockNovaInstance
|
|
21
|
+
mock?: MockNovaInstance;
|
|
34
22
|
onDispose?: () => void;
|
|
35
23
|
};
|
|
36
24
|
constructor(targetUrl: string, opts?: {
|
|
37
|
-
mock?: MockNovaInstance
|
|
25
|
+
mock?: MockNovaInstance;
|
|
38
26
|
onDispose?: () => void;
|
|
39
27
|
});
|
|
40
28
|
changeUrl(targetUrl: string): void;
|
|
@@ -65,5 +53,5 @@ declare class AutoReconnectingWebsocket extends ReconnectingWebSocket {
|
|
|
65
53
|
nextMessage(): Promise<MessageEvent<any>>;
|
|
66
54
|
}
|
|
67
55
|
//#endregion
|
|
68
|
-
export { MockNovaInstance as n,
|
|
69
|
-
//# sourceMappingURL=AutoReconnectingWebsocket-
|
|
56
|
+
export { MockNovaInstance as n, AutoReconnectingWebsocket as t };
|
|
57
|
+
//# sourceMappingURL=AutoReconnectingWebsocket-BSt-vnzX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoReconnectingWebsocket-BSt-vnzX.d.mts","names":[],"sources":["../src/lib/mock/MockNovaInstance.ts","../src/lib/AutoReconnectingWebsocket.ts"],"mappings":";;;;;;AAeA;cAAa,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;;;cCzF/C,yBAAA,SAAkC,qBAAA;EAC7C,oBAAA,GAAuB,YAAA;EACvB,SAAA;EACA,QAAA;EAAA,SACS,IAAA;IACP,IAAA,GAAO,gBAAA;IACP,SAAA;EAAA;cAIA,SAAA,UACA,IAAA;IACE,IAAA,GAAO,gBAAA;IACP,SAAA;EAAA;EA6CJ,SAAA,CAAU,SAAA;EAMV,QAAA,CAAS,IAAA;EDnDa;;;;EC+DtB,OAAA;ED3DW;;;ECsEL,MAAA,IAAM,OAAA;EDEZ;;;ECYM,MAAA,IAAM,OAAA;EDZ6D;AAAA;;;;EC4BnE,YAAA,IAAY,OAAA,CAAA,YAAA;EArHmB;;;;EAiJ/B,WAAA,IAAW,OAAA,CAAA,YAAA;AAAA"}
|
|
@@ -159,12 +159,6 @@ function delay(ms) {
|
|
|
159
159
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
|
-
* @deprecated Use makeErrorMessage instead and truncate the error for display as needed, or make a situation-specific localized error message based on a response code
|
|
163
|
-
*/
|
|
164
|
-
function makeShortErrorMessage(err) {
|
|
165
|
-
return makeErrorMessage(err);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
162
|
* Attempts to make a helpful error message from an unknown thrown error
|
|
169
163
|
* or promise rejection.
|
|
170
164
|
*
|
|
@@ -231,7 +225,7 @@ const getAuth0Config = (instanceUrl) => {
|
|
|
231
225
|
* when deployed on the instance domain)
|
|
232
226
|
*/
|
|
233
227
|
const loginWithAuth0 = async (instanceUrl) => {
|
|
234
|
-
if (typeof window === "undefined") throw new Error(`Access token must be set to use
|
|
228
|
+
if (typeof window === "undefined") throw new Error(`Access token must be set to use Nova when not in a browser environment.`);
|
|
235
229
|
if (instanceUrl.origin === window.location.origin) return guardedPageReload("cloud_instance_auth");
|
|
236
230
|
const { Auth0Client } = await import("@auth0/auth0-spa-js");
|
|
237
231
|
const auth0Config = getAuth0Config(instanceUrl);
|
|
@@ -251,10 +245,6 @@ const loginWithAuth0 = async (instanceUrl) => {
|
|
|
251
245
|
return await auth0Client.getTokenSilently();
|
|
252
246
|
};
|
|
253
247
|
//#endregion
|
|
254
|
-
|
|
255
|
-
const isBrowser = typeof window !== "undefined";
|
|
256
|
-
const isLocalhostDev = isBrowser && window.location.hostname === "localhost" && process.env.NODE_ENV === "development";
|
|
257
|
-
//#endregion
|
|
258
|
-
export { delay as a, makeShortErrorMessage as c, loginWithAuth0 as i, availableStorage as l, isLocalhostDev as n, guardedPageReload as o, getAuth0Config as r, makeErrorMessage as s, isBrowser as t, AutoReconnectingWebsocket as u };
|
|
248
|
+
export { makeErrorMessage as a, guardedPageReload as i, loginWithAuth0 as n, availableStorage as o, delay as r, AutoReconnectingWebsocket as s, getAuth0Config as t };
|
|
259
249
|
|
|
260
|
-
//# sourceMappingURL=
|
|
250
|
+
//# sourceMappingURL=LoginWithAuth0-D92HnzHq.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginWithAuth0-D92HnzHq.mjs","names":[],"sources":["../src/lib/AutoReconnectingWebsocket.ts","../src/lib/availableStorage.ts","../src/lib/errorHandling.ts","../src/lib/LoginWithAuth0.ts"],"sourcesContent":["import ReconnectingWebSocket, { type ErrorEvent } from \"reconnecting-websocket\"\nimport type { MockNovaInstance } from \"./mock/MockNovaInstance.ts\"\n\nexport class AutoReconnectingWebsocket extends ReconnectingWebSocket {\n receivedFirstMessage?: MessageEvent\n targetUrl: string\n disposed = false\n readonly opts: {\n mock?: MockNovaInstance\n onDispose?: () => void\n }\n\n constructor(\n targetUrl: string,\n opts: {\n mock?: MockNovaInstance\n onDispose?: () => void\n } = {},\n ) {\n console.log(\"Opening websocket to\", targetUrl)\n\n super(() => this.targetUrl || targetUrl, undefined, {\n startClosed: true,\n })\n\n // Reconnecting websocket doesn't set this properly with startClosed\n Object.defineProperty(this, \"url\", {\n get() {\n return this.targetUrl\n },\n })\n\n this.targetUrl = targetUrl\n this.opts = opts\n\n this.addEventListener(\"open\", () => {\n console.log(`Websocket to ${this.url} opened`)\n })\n\n this.addEventListener(\"message\", (ev) => {\n if (!this.receivedFirstMessage) {\n this.receivedFirstMessage = ev\n }\n })\n\n this.addEventListener(\"close\", () => {\n console.log(`Websocket to ${this.url} closed`)\n })\n\n const origReconnect = this.reconnect\n this.reconnect = () => {\n if (this.opts.mock) {\n this.opts.mock.handleWebsocketConnection(this)\n } else {\n origReconnect.apply(this)\n }\n }\n\n this.reconnect()\n }\n\n changeUrl(targetUrl: string) {\n this.receivedFirstMessage = undefined\n this.targetUrl = targetUrl\n this.reconnect()\n }\n\n sendJson(data: unknown) {\n if (this.opts.mock) {\n this.opts.mock.handleWebsocketMessage(this, JSON.stringify(data))\n } else {\n this.send(JSON.stringify(data))\n }\n }\n\n /**\n * Permanently close this websocket and indicate that\n * this object should not be used again.\n **/\n dispose() {\n this.close()\n this.disposed = true\n if (this.opts.onDispose) {\n this.opts.onDispose()\n }\n }\n\n /**\n * Returns a promise that resolves once the websocket\n * is in the OPEN state. */\n async opened() {\n return new Promise<void>((resolve, reject) => {\n if (this.readyState === WebSocket.OPEN) {\n resolve()\n } else {\n this.addEventListener(\"open\", () => resolve())\n this.addEventListener(\"error\", reject)\n }\n })\n }\n\n /**\n * Returns a promise that resolves once the websocket\n * is in the CLOSED state. */\n async closed() {\n return new Promise<void>((resolve, reject) => {\n if (this.readyState === WebSocket.CLOSED) {\n resolve()\n } else {\n this.addEventListener(\"close\", () => resolve())\n this.addEventListener(\"error\", reject)\n }\n })\n }\n\n /**\n * Returns a promise that resolves when the first message\n * is received from the websocket. Resolves immediately if\n * the first message has already been received.\n */\n async firstMessage() {\n if (this.receivedFirstMessage) {\n return this.receivedFirstMessage\n }\n\n return new Promise<MessageEvent>((resolve, reject) => {\n const onMessage = (ev: MessageEvent) => {\n this.receivedFirstMessage = ev\n this.removeEventListener(\"message\", onMessage)\n this.removeEventListener(\"error\", onError)\n resolve(ev)\n }\n\n const onError = (ev: ErrorEvent) => {\n this.removeEventListener(\"message\", onMessage)\n this.removeEventListener(\"error\", onError)\n reject(ev)\n }\n\n this.addEventListener(\"message\", onMessage)\n this.addEventListener(\"error\", onError)\n })\n }\n\n /**\n * Returns a promise that resolves when the next message\n * is received from the websocket.\n */\n async nextMessage() {\n return new Promise<MessageEvent>((resolve, reject) => {\n const onMessage = (ev: MessageEvent) => {\n this.removeEventListener(\"message\", onMessage)\n this.removeEventListener(\"error\", onError)\n resolve(ev)\n }\n\n const onError = (ev: ErrorEvent) => {\n this.removeEventListener(\"message\", onMessage)\n this.removeEventListener(\"error\", onError)\n reject(ev)\n }\n\n this.addEventListener(\"message\", onMessage)\n this.addEventListener(\"error\", onError)\n })\n }\n}\n","/**\n * Safety wrapper around browser localStorage providing context availability\n * checks and JSON parsing\n */\nclass AvailableStorage {\n available = typeof window !== \"undefined\" && !!window.localStorage\n\n getJSON<T>(key: string): Partial<T> | null {\n if (!this.available) return null\n\n const result = window.localStorage.getItem(key)\n if (result === null) return null\n\n try {\n return JSON.parse(result)\n } catch (err) {\n return null\n }\n }\n\n setJSON(key: string, obj: unknown) {\n if (!this.available) return null\n\n window.localStorage.setItem(key, JSON.stringify(obj))\n }\n\n delete(key: string) {\n if (!this.available) return null\n\n window.localStorage.removeItem(key)\n }\n\n setString(key: string, value: string) {\n if (!this.available) return null\n\n window.localStorage.setItem(key, value)\n }\n\n getString(key: string): string | null {\n if (!this.available) return null\n\n return window.localStorage.getItem(key)\n }\n}\n\nexport const availableStorage = new AvailableStorage()\n","import { isAxiosError } from \"axios\"\nimport { tryStringifyJson } from \"./converters.ts\"\n\nexport function delay(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * Attempts to make a helpful error message from an unknown thrown error\n * or promise rejection.\n *\n * This function is mainly to aid debugging and good bug reports. For\n * expected errors encountered by end users, it's more ideal to catch\n * the specific error code and provide a localized app-specific error message.\n */\nexport function makeErrorMessage(err: unknown): string {\n if (isAxiosError(err)) {\n if (err.response) {\n return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || \"accessing\"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`\n } else if (err.config) {\n if (err.code === \"ERR_NETWORK\") {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}. This error can happen because of either connection issues or server CORS policy.`\n } else {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}`\n }\n }\n } else if (err instanceof Error) {\n return err.message\n } else if (typeof err === \"string\") {\n return err\n } else if (typeof err === \"object\") {\n return tryStringifyJson(err) || `Unserializable object ${err}`\n }\n\n return `${err}`\n}\n\n/**\n * Reloads the page with protection against loops.\n * Allows at most one reload per 10 seconds; otherwise throws\n * an error.\n */\nexport function guardedPageReload(key: string): Promise<never> {\n const RELOAD_KEY = `novajs_reload_guard:${key}`\n const RELOAD_COOLDOWN_MS = 10_000\n const lastReloadAt = Number(window.sessionStorage.getItem(RELOAD_KEY) ?? \"0\")\n\n if (Date.now() - lastReloadAt < RELOAD_COOLDOWN_MS) {\n throw new Error(\n `Unhandled error caused a reload (${key}), but a reload was already attempted recently. Aborting to prevent reload loop.`,\n )\n }\n\n window.sessionStorage.setItem(RELOAD_KEY, String(Date.now()))\n window.location.reload()\n\n return new Promise(() => {}) // never settles, the page should be reloading\n}\n","import { guardedPageReload } from \"./errorHandling.ts\"\n\n/**\n * Mapping of stages to Auth0 configurations.\n * The client ids are public identifiers for a specific auth0 application\n * and are safe to include in client-side code.\n * https://auth0.com/docs/get-started/applications/application-settings\n */\nconst auth0ConfigMap = {\n dev: {\n domain: `https://auth.portal.dev.wandelbots.io`,\n clientId: \"fLbJD0RLp5r2Dpucm5j8BjwMR6Hunfha\",\n },\n stg: {\n domain: `https://auth.portal.stg.wandelbots.io`,\n clientId: \"joVDeD9e786WzFNSGCqoVq7HNkWt5j6s\",\n },\n prod: {\n domain: `https://auth.portal.wandelbots.io`,\n clientId: \"J7WJUi38xVQdJAEBNRT9Xw1b0fXDb4J2\",\n },\n}\n\n/** Determine which Auth0 configuration to use based on instance URL */\nexport const getAuth0Config = (instanceUrl: URL) => {\n if (instanceUrl.host.endsWith(\".dev.wandelbots.io\")) return auth0ConfigMap.dev\n if (instanceUrl.host.endsWith(\".stg.wandelbots.io\")) return auth0ConfigMap.stg\n if (instanceUrl.host.endsWith(\".wandelbots.io\")) return auth0ConfigMap.prod\n throw new Error(\n `Unable to authenticate with NOVA instance \"${instanceUrl}\". Auth0 login is only supported for cloud instances with hosts of the form \"**.wandelbots.io\".`,\n )\n}\n\n/**\n * Initializes Auth0 login process using redirect if necessary and retrieves an access token.\n * Returns null when an access token should not be needed to authenticate (i.e. cookie auth\n * when deployed on the instance domain)\n */\nexport const loginWithAuth0 = async (\n instanceUrl: URL,\n): Promise<string | null> => {\n if (typeof window === \"undefined\") {\n throw new Error(\n `Access token must be set to use Nova when not in a browser environment.`,\n )\n }\n\n if (instanceUrl.origin === window.location.origin) {\n // When deployed on the instance itself, our auth is handled by cookies\n // and no access token is needed-- just need to reload the page and it'll\n // login again / set cookie as needed\n return guardedPageReload(\"cloud_instance_auth\")\n }\n\n // If we're on localhost or another domain, we need to do the full oauth flow\n // Note this will ONLY work for origins which are whitelisted as a redirect_uri\n // in the auth0 config, currently\n const { Auth0Client } = await import(\"@auth0/auth0-spa-js\")\n\n const auth0Config = getAuth0Config(instanceUrl)\n\n const auth0Client = new Auth0Client({\n domain: auth0Config.domain,\n clientId: auth0Config.clientId ?? \"\",\n useRefreshTokens: false,\n authorizationParams: {\n audience: \"nova-api\",\n redirect_uri: window.location.origin,\n },\n })\n\n // If the URL includes a redirect result, handle it\n if (\n window.location.search.includes(\"code=\") &&\n window.location.search.includes(\"state=\")\n ) {\n const { appState } = await auth0Client.handleRedirectCallback()\n // Return to the URL the user was originally on before the redirect\n window.history.replaceState(\n {},\n document.title,\n appState?.returnTo || window.location.pathname,\n )\n } else {\n // Initiate login with redirect\n await auth0Client.loginWithRedirect()\n }\n\n // Once logged in, retrieve the access token silently\n const accessToken = await auth0Client.getTokenSilently()\n return accessToken\n}\n"],"mappings":";;;;AAGA,IAAa,4BAAb,cAA+C,sBAAsB;CACnE;CACA;CACA,WAAW;CACX;CAKA,YACE,WACA,OAGI,CAAC,GACL;EACA,QAAQ,IAAI,wBAAwB,SAAS;EAE7C,YAAY,KAAK,aAAa,WAAW,KAAA,GAAW,EAClD,aAAa,KACf,CAAC;EAGD,OAAO,eAAe,MAAM,OAAO,EACjC,MAAM;GACJ,OAAO,KAAK;EACd,EACF,CAAC;EAED,KAAK,YAAY;EACjB,KAAK,OAAO;EAEZ,KAAK,iBAAiB,cAAc;GAClC,QAAQ,IAAI,gBAAgB,KAAK,IAAI,QAAQ;EAC/C,CAAC;EAED,KAAK,iBAAiB,YAAY,OAAO;G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stance, t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-BSt-vnzX.mjs";
|
|
2
2
|
import { AxiosInstance } from "axios";
|
|
3
3
|
import { ApplicationApi, BUSInputsOutputsApi, CellApi, Configuration, ControllerApi, ControllerInputsOutputsApi, JoggingApi, KinematicsApi, LicenseApi, MotionGroupApi, MotionGroupModelsApi, NOVACloudApi, ProgramApi, RobotConfigurationsApi, SessionApi, StoreCollisionComponentsApi, StoreCollisionSetupsApi, StoreObjectApi, SystemApi, TrajectoryCachingApi, TrajectoryExecutionApi, TrajectoryPlanningApi, VersionApi, VirtualControllerApi, VirtualControllerBehaviorApi, VirtualControllerInputsOutputsApi } from "@wandelbots/nova-api/v2";
|
|
4
4
|
|
|
@@ -82,4 +82,4 @@ declare class Nova {
|
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
84
|
export { NovaConfig as n, NovaAPIClient as r, Nova as t };
|
|
85
|
-
//# sourceMappingURL=Nova
|
|
85
|
+
//# sourceMappingURL=Nova-C8nDNSCa.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Nova
|
|
1
|
+
{"version":3,"file":"Nova-C8nDNSCa.d.mts","names":[],"sources":["../src/lib/NovaAPIClient.ts","../src/lib/Nova.ts"],"mappings":";;;;;KAmCK,yBAAA,MAA+B,CAAA,cAAc,CAAA,uBAEzC,CAAA,EAAG,UAAA,CAAW,CAAA,MACd,OAAA,CAAQ,OAAA,CAAQ,UAAA,CAAW,CAAA;EAAc,IAAA;AAAA,IAAkB,CAAA;AAAA,KAG/D,0BAAA,oBACS,CAAA,GAAI,yBAAA,CAA0B,CAAA,CAAE,CAAA;AAAA,KAGzC,iBAAA,GAAoB,aAAA;EACvB,aAAA,GAAgB,aAAa;EAC7B,IAAA;AAAA;;;;;cAuCW,aAAA;EAAA,SACF,IAAA,EAAM,iBAAA;EAAA,SAEN,WAAA,EAAa,0BAAA,CAA2B,cAAA;EAAA,SACxC,MAAA,EAAQ,0B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A,SACF,GAAA,EAAK,aAAA;EAAA,SACL,MAAA,EAAQ,UAAA;EAAA,SACR,IAAA,GAAO,gBAAA;EAAA,SACP,WAAA,EAAa,GAAA;EACtB,WAAA,EAAa,OAAA;EACb,WAAA;cAEY,MAAA,EAAQ,UAAA;EAqId,mBAAA,IAAuB,OAAA;EA4B7B,gBAAA,CAAiB,IAAA;EDlKkD;AAAA;;;;ECmLnE,yBAAA,CAA0B,IAAA,WAAY,yBAAA;AAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-
|
|
2
|
-
import { n as NovaClient, r as NovaClientConfig, t as poseToWandelscriptString } from "./wandelscriptUtils-YHTxn_p9.mjs";
|
|
1
|
+
import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-BSt-vnzX.mjs";
|
|
3
2
|
|
|
4
3
|
//#region src/lib/availableStorage.d.ts
|
|
5
4
|
/**
|
|
@@ -73,10 +72,6 @@ declare const XYZ_TO_VECTOR: {
|
|
|
73
72
|
//#endregion
|
|
74
73
|
//#region src/lib/errorHandling.d.ts
|
|
75
74
|
declare function delay(ms: number): Promise<unknown>;
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated Use makeErrorMessage instead and truncate the error for display as needed, or make a situation-specific localized error message based on a response code
|
|
78
|
-
*/
|
|
79
|
-
declare function makeShortErrorMessage(err: unknown): string;
|
|
80
75
|
/**
|
|
81
76
|
* Attempts to make a helpful error message from an unknown thrown error
|
|
82
77
|
* or promise rejection.
|
|
@@ -106,5 +101,5 @@ declare const getAuth0Config: (instanceUrl: URL) => {
|
|
|
106
101
|
*/
|
|
107
102
|
declare const loginWithAuth0: (instanceUrl: URL) => Promise<string | null>;
|
|
108
103
|
//#endregion
|
|
109
|
-
export { AutoReconnectingWebsocket,
|
|
104
|
+
export { AutoReconnectingWebsocket, URLParseOptions, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, getAuth0Config, guardedPageReload, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeUrlQueryString, parseNovaInstanceUrl, parseUrl, radiansToDegrees, tryParseJson, tryParseUrl, tryStringifyJson };
|
|
110
105
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/availableStorage.ts","../src/lib/converters.ts","../src/lib/errorHandling.ts","../src/lib/LoginWithAuth0.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/availableStorage.ts","../src/lib/converters.ts","../src/lib/errorHandling.ts","../src/lib/LoginWithAuth0.ts"],"mappings":";;;;;;;cAIM,gBAAA;EACJ,SAAA;EAEA,OAAA,IAAW,GAAA,WAAc,OAAO,CAAC,CAAA;EAajC,OAAA,CAAQ,GAAA,UAAa,GAAA;EAMrB,MAAA,CAAO,GAAA;EAMP,SAAA,CAAU,GAAA,UAAa,KAAA;EAMvB,SAAA,CAAU,GAAA;AAAA;AAAA,cAOC,gBAAA,EAAgB,gBAAyB;;;KC7C1C,eAAA;;;;EAIV,MAAA;EDAoB;;;;ECKpB,aAAa;AAAA;;;;iBAMC,QAAA,CAAS,GAAA,UAAa,OAAA,GAAS,eAAA,GAAuB,GAAG;;;;iBAoBzD,WAAA,CACd,GAAA,UACA,OAAA,GAAS,eAAA,GACR,GAAG;;;;;;ADAiB;iBCcP,oBAAA,CAAqB,GAAA,WAAc,GAAG;;iBAWtC,YAAA,CAAa,IAAa;;iBAS1B,gBAAA,CAAiB,IAAa;;;;AAxE9C;;iBAqFgB,kBAAA,CAAmB,GAA2B,EAAtB,MAAM;;iBAM9B,gBAAA,CAAiB,OAAe;AA5EhD;AAAA,iBAiFgB,gBAAA,CAAiB,OAAe;;;;;iBAQhC,sBAAA,CACd,gBAAA,sBACA,iBAAqC;;;AA3FkC;cAsG5D,aAAA;;;;;;;iBClHG,KAAA,CAAM,EAAA,WAAU,OAAA;;;;;;;;;iBAYhB,gBAAA,CAAiB,GAAY;;;;;;iBA2B7B,iBAAA,CAAkB,GAAA,WAAc,OAAO;;;;cClB1C,cAAA,GAAkB,WAAA,EAAa,GAAG;;;;;;;;;cAclC,cAAA,GACX,WAAA,EAAa,GAAA,KACZ,OAAO"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as makeErrorMessage, i as guardedPageReload, n as loginWithAuth0, o as availableStorage, r as delay, s as AutoReconnectingWebsocket, t as getAuth0Config } from "./LoginWithAuth0-D92HnzHq.mjs";
|
|
2
2
|
import { a as parseNovaInstanceUrl, c as tryParseJson, i as makeUrlQueryString, l as tryParseUrl, n as degreesToRadians, o as parseUrl, r as isSameCoordinateSystem, s as radiansToDegrees, t as XYZ_TO_VECTOR, u as tryStringifyJson } from "./converters-DnG1fX23.mjs";
|
|
3
|
-
|
|
4
|
-
export { AutoReconnectingWebsocket, NovaClient, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, getAuth0Config, guardedPageReload, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeShortErrorMessage, makeUrlQueryString, parseNovaInstanceUrl, parseUrl, poseToWandelscriptString, radiansToDegrees, tryParseJson, tryParseUrl, tryStringifyJson };
|
|
3
|
+
export { AutoReconnectingWebsocket, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, getAuth0Config, guardedPageReload, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeUrlQueryString, parseNovaInstanceUrl, parseUrl, radiansToDegrees, tryParseJson, tryParseUrl, tryStringifyJson };
|
package/dist/v2/index.d.mts
CHANGED
|
@@ -1,131 +1,3 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { n as NovaConfig, r as NovaAPIClient, t as Nova } from "../Nova--8gozkLR.mjs";
|
|
3
|
-
import { AxiosInstance } from "axios";
|
|
4
|
-
import { ApplicationApi, BUSInputsOutputsApi, CellApi, Configuration, ControllerApi, ControllerInputsOutputsApi, JoggingApi, KinematicsApi, LicenseApi, MotionGroupApi, MotionGroupModelsApi, NOVACloudApi, Pose, ProgramApi, RobotConfigurationsApi, SessionApi, StoreCollisionComponentsApi, StoreCollisionSetupsApi, StoreObjectApi, SystemApi, TrajectoryCachingApi, TrajectoryExecutionApi, TrajectoryPlanningApi, VersionApi, VirtualControllerApi, VirtualControllerBehaviorApi, VirtualControllerInputsOutputsApi } from "@wandelbots/nova-api/v2";
|
|
1
|
+
import { n as NovaConfig, r as NovaAPIClient, t as Nova } from "../Nova-C8nDNSCa.mjs";
|
|
5
2
|
export * from "@wandelbots/nova-api/v2";
|
|
6
|
-
|
|
7
|
-
//#region src/lib/deprecated/v2/NovaCellAPIClient.d.ts
|
|
8
|
-
type OmitFirstArg<F> = F extends ((x: any, ...args: infer P) => infer R) ? (...args: P) => R : never;
|
|
9
|
-
type UnwrapAxiosResponseReturn<T> = T extends ((...a: any) => any) ? (...a: Parameters<T>) => Promise<Awaited<ReturnType<T>> extends {
|
|
10
|
-
data: infer D;
|
|
11
|
-
} ? D : never> : never;
|
|
12
|
-
/** @deprecated Use `NovaAPIClient` instead. */
|
|
13
|
-
type WithCellId<T> = { [P in keyof T]: UnwrapAxiosResponseReturn<OmitFirstArg<T[P]>> };
|
|
14
|
-
/** @deprecated Use `NovaAPIClient` instead. */
|
|
15
|
-
type WithUnwrappedAxiosResponse<T> = { [P in keyof T]: UnwrapAxiosResponseReturn<T[P]> };
|
|
16
|
-
/**
|
|
17
|
-
* API client providing type-safe access to all the Nova API REST endpoints
|
|
18
|
-
* associated with a specific cell id.
|
|
19
|
-
* @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
|
|
20
|
-
*/
|
|
21
|
-
declare class NovaCellAPIClient {
|
|
22
|
-
readonly system: WithUnwrappedAxiosResponse<SystemApi>;
|
|
23
|
-
readonly cell: WithUnwrappedAxiosResponse<CellApi>;
|
|
24
|
-
readonly motionGroup: WithCellId<MotionGroupApi>;
|
|
25
|
-
readonly motionGroupModels: WithUnwrappedAxiosResponse<MotionGroupModelsApi>;
|
|
26
|
-
readonly controller: WithCellId<ControllerApi>;
|
|
27
|
-
readonly controllerIOs: WithCellId<ControllerInputsOutputsApi>;
|
|
28
|
-
readonly trajectoryPlanning: WithCellId<TrajectoryPlanningApi>;
|
|
29
|
-
readonly trajectoryExecution: WithCellId<TrajectoryExecutionApi>;
|
|
30
|
-
readonly trajectoryCaching: WithCellId<TrajectoryCachingApi>;
|
|
31
|
-
readonly application: WithCellId<ApplicationApi>;
|
|
32
|
-
readonly applicationGlobal: WithUnwrappedAxiosResponse<ApplicationApi>;
|
|
33
|
-
readonly jogging: WithCellId<JoggingApi>;
|
|
34
|
-
readonly kinematics: WithCellId<KinematicsApi>;
|
|
35
|
-
readonly busInputsOutputs: WithCellId<BUSInputsOutputsApi>;
|
|
36
|
-
readonly virtualController: WithCellId<VirtualControllerApi>;
|
|
37
|
-
readonly virtualControllerBehavior: WithCellId<VirtualControllerBehaviorApi>;
|
|
38
|
-
readonly virtualControllerIOs: WithCellId<VirtualControllerInputsOutputsApi>;
|
|
39
|
-
readonly storeObject: WithCellId<StoreObjectApi>;
|
|
40
|
-
readonly storeCollisionComponents: WithCellId<StoreCollisionComponentsApi>;
|
|
41
|
-
readonly storeCollisionSetups: WithCellId<StoreCollisionSetupsApi>;
|
|
42
|
-
readonly program: WithCellId<ProgramApi>;
|
|
43
|
-
readonly license: WithUnwrappedAxiosResponse<LicenseApi>;
|
|
44
|
-
readonly novaCloud: WithUnwrappedAxiosResponse<NOVACloudApi>;
|
|
45
|
-
readonly robotConfigurations: WithUnwrappedAxiosResponse<RobotConfigurationsApi>;
|
|
46
|
-
readonly version: WithUnwrappedAxiosResponse<VersionApi>;
|
|
47
|
-
readonly session: WithUnwrappedAxiosResponse<SessionApi>;
|
|
48
|
-
readonly cellId: string;
|
|
49
|
-
readonly opts: Configuration & {
|
|
50
|
-
axiosInstance?: AxiosInstance;
|
|
51
|
-
mock?: boolean;
|
|
52
|
-
};
|
|
53
|
-
constructor(cellId: string, opts: Configuration & {
|
|
54
|
-
axiosInstance?: AxiosInstance;
|
|
55
|
-
mock?: boolean;
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* Some TypeScript sorcery which alters the API class methods so you don't
|
|
59
|
-
* have to pass the cell id to every single one, and de-encapsulates the
|
|
60
|
-
* response data
|
|
61
|
-
*/
|
|
62
|
-
private withCellId;
|
|
63
|
-
/**
|
|
64
|
-
* As withCellId, but only does the response unwrapping
|
|
65
|
-
*/
|
|
66
|
-
private withUnwrappedResponsesOnly;
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/lib/deprecated/v2/NovaClient.d.ts
|
|
70
|
-
/** @deprecated Use `NovaClientConfig` from `Nova` instead. */
|
|
71
|
-
type NovaClientConfig = {
|
|
72
|
-
/**
|
|
73
|
-
* Url of the deployed Nova instance to connect to
|
|
74
|
-
* e.g. https://saeattii.instance.wandelbots.io
|
|
75
|
-
*/
|
|
76
|
-
instanceUrl: string | "https://mock.example.com";
|
|
77
|
-
/**
|
|
78
|
-
* Identifier of the cell on the Nova instance to connect this client to.
|
|
79
|
-
* If omitted, the default identifier "cell" is used.
|
|
80
|
-
**/
|
|
81
|
-
cellId?: string;
|
|
82
|
-
/**
|
|
83
|
-
* Username for basic auth to the Nova instance.
|
|
84
|
-
* @deprecated use accessToken instead
|
|
85
|
-
*/
|
|
86
|
-
username?: string;
|
|
87
|
-
/**
|
|
88
|
-
* Password for basic auth to the Nova instance.
|
|
89
|
-
* @deprecated use accessToken instead
|
|
90
|
-
*/
|
|
91
|
-
password?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Access token for Bearer authentication.
|
|
94
|
-
*/
|
|
95
|
-
accessToken?: string;
|
|
96
|
-
} & Omit<Configuration, "isJsonMime" | "basePath">;
|
|
97
|
-
type NovaClientConfigWithDefaults = NovaClientConfig & {
|
|
98
|
-
cellId: string;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Client for connecting to a Nova instance and controlling robots.
|
|
102
|
-
* @deprecated Use `Nova` from `@wandelbots/nova-js/v2` instead.
|
|
103
|
-
*/
|
|
104
|
-
declare class NovaClient {
|
|
105
|
-
readonly api: NovaCellAPIClient;
|
|
106
|
-
readonly config: NovaClientConfigWithDefaults;
|
|
107
|
-
readonly mock?: MockNovaInstance;
|
|
108
|
-
readonly instanceUrl: URL;
|
|
109
|
-
authPromise: Promise<string | null> | null;
|
|
110
|
-
accessToken: string | null;
|
|
111
|
-
constructor(config: NovaClientConfig);
|
|
112
|
-
renewAuthentication(): Promise<void>;
|
|
113
|
-
makeWebsocketURL(path: string): string;
|
|
114
|
-
/**
|
|
115
|
-
* Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.
|
|
116
|
-
* If you explicitly want to reconnect an existing websocket, call `reconnect`
|
|
117
|
-
* on the returned object.
|
|
118
|
-
*/
|
|
119
|
-
openReconnectingWebsocket(path: string): AutoReconnectingWebsocket;
|
|
120
|
-
}
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region src/lib/deprecated/v2/wandelscriptUtils.d.ts
|
|
123
|
-
/**
|
|
124
|
-
* Convert a Pose object representing a motion group position
|
|
125
|
-
* into a string which represents that pose in Wandelscript.
|
|
126
|
-
* @deprecated Wandelscript usage is deprecated; switching to Python is recommended.
|
|
127
|
-
*/
|
|
128
|
-
declare function poseToWandelscriptString(pose: Pick<Pose, "position" | "orientation">): string;
|
|
129
|
-
//#endregion
|
|
130
|
-
export { Nova, NovaAPIClient, NovaCellAPIClient, NovaClient, NovaClientConfig, type NovaConfig, WithCellId, WithUnwrappedAxiosResponse, poseToWandelscriptString };
|
|
131
|
-
//# sourceMappingURL=index.d.mts.map
|
|
3
|
+
export { Nova, NovaAPIClient, type NovaConfig };
|
package/dist/v2/index.mjs
CHANGED
|
@@ -1,113 +1,10 @@
|
|
|
1
|
-
import { i as
|
|
1
|
+
import { i as guardedPageReload, n as loginWithAuth0, o as availableStorage, s as AutoReconnectingWebsocket } from "../LoginWithAuth0-D92HnzHq.mjs";
|
|
2
2
|
import { a as parseNovaInstanceUrl } from "../converters-DnG1fX23.mjs";
|
|
3
3
|
import axios, { AxiosError, isAxiosError } from "axios";
|
|
4
|
-
import * as pathToRegexp from "path-to-regexp";
|
|
5
4
|
import { ApplicationApi, BUSInputsOutputsApi, CellApi, ControllerApi, ControllerInputsOutputsApi, JoggingApi, KinematicsApi, LicenseApi, MotionGroupApi, MotionGroupModelsApi, NOVACloudApi, ProgramApi, RobotConfigurationsApi, SessionApi, StoreCollisionComponentsApi, StoreCollisionSetupsApi, StoreObjectApi, SystemApi, TrajectoryCachingApi, TrajectoryExecutionApi, TrajectoryPlanningApi, VersionApi, VirtualControllerApi, VirtualControllerBehaviorApi, VirtualControllerInputsOutputsApi } from "@wandelbots/nova-api/v2";
|
|
5
|
+
import * as pathToRegexp from "path-to-regexp";
|
|
6
6
|
export * from "@wandelbots/nova-api/v2";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* API client providing type-safe access to all the Nova API REST endpoints
|
|
10
|
-
* associated with a specific cell id.
|
|
11
|
-
* @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
|
|
12
|
-
*/
|
|
13
|
-
var NovaCellAPIClient = class {
|
|
14
|
-
system;
|
|
15
|
-
cell;
|
|
16
|
-
motionGroup;
|
|
17
|
-
motionGroupModels;
|
|
18
|
-
controller;
|
|
19
|
-
controllerIOs;
|
|
20
|
-
trajectoryPlanning;
|
|
21
|
-
trajectoryExecution;
|
|
22
|
-
trajectoryCaching;
|
|
23
|
-
application;
|
|
24
|
-
applicationGlobal;
|
|
25
|
-
jogging;
|
|
26
|
-
kinematics;
|
|
27
|
-
busInputsOutputs;
|
|
28
|
-
virtualController;
|
|
29
|
-
virtualControllerBehavior;
|
|
30
|
-
virtualControllerIOs;
|
|
31
|
-
storeObject;
|
|
32
|
-
storeCollisionComponents;
|
|
33
|
-
storeCollisionSetups;
|
|
34
|
-
program;
|
|
35
|
-
license;
|
|
36
|
-
novaCloud;
|
|
37
|
-
robotConfigurations;
|
|
38
|
-
version;
|
|
39
|
-
session;
|
|
40
|
-
cellId;
|
|
41
|
-
opts;
|
|
42
|
-
constructor(cellId, opts) {
|
|
43
|
-
this.cellId = cellId;
|
|
44
|
-
this.opts = opts;
|
|
45
|
-
this.system = this.withUnwrappedResponsesOnly(SystemApi);
|
|
46
|
-
this.cell = this.withUnwrappedResponsesOnly(CellApi);
|
|
47
|
-
this.motionGroup = this.withCellId(MotionGroupApi);
|
|
48
|
-
this.motionGroupModels = this.withUnwrappedResponsesOnly(MotionGroupModelsApi);
|
|
49
|
-
this.controller = this.withCellId(ControllerApi);
|
|
50
|
-
this.controllerIOs = this.withCellId(ControllerInputsOutputsApi);
|
|
51
|
-
this.trajectoryPlanning = this.withCellId(TrajectoryPlanningApi);
|
|
52
|
-
this.trajectoryExecution = this.withCellId(TrajectoryExecutionApi);
|
|
53
|
-
this.trajectoryCaching = this.withCellId(TrajectoryCachingApi);
|
|
54
|
-
this.application = this.withCellId(ApplicationApi);
|
|
55
|
-
this.applicationGlobal = this.withUnwrappedResponsesOnly(ApplicationApi);
|
|
56
|
-
this.jogging = this.withCellId(JoggingApi);
|
|
57
|
-
this.kinematics = this.withCellId(KinematicsApi);
|
|
58
|
-
this.busInputsOutputs = this.withCellId(BUSInputsOutputsApi);
|
|
59
|
-
this.virtualController = this.withCellId(VirtualControllerApi);
|
|
60
|
-
this.virtualControllerBehavior = this.withCellId(VirtualControllerBehaviorApi);
|
|
61
|
-
this.virtualControllerIOs = this.withCellId(VirtualControllerInputsOutputsApi);
|
|
62
|
-
this.storeObject = this.withCellId(StoreObjectApi);
|
|
63
|
-
this.storeCollisionComponents = this.withCellId(StoreCollisionComponentsApi);
|
|
64
|
-
this.storeCollisionSetups = this.withCellId(StoreCollisionSetupsApi);
|
|
65
|
-
this.program = this.withCellId(ProgramApi);
|
|
66
|
-
this.license = this.withUnwrappedResponsesOnly(LicenseApi);
|
|
67
|
-
this.novaCloud = this.withUnwrappedResponsesOnly(NOVACloudApi);
|
|
68
|
-
this.robotConfigurations = this.withUnwrappedResponsesOnly(RobotConfigurationsApi);
|
|
69
|
-
this.version = this.withUnwrappedResponsesOnly(VersionApi);
|
|
70
|
-
this.session = this.withUnwrappedResponsesOnly(SessionApi);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Some TypeScript sorcery which alters the API class methods so you don't
|
|
74
|
-
* have to pass the cell id to every single one, and de-encapsulates the
|
|
75
|
-
* response data
|
|
76
|
-
*/
|
|
77
|
-
withCellId(ApiConstructor) {
|
|
78
|
-
const apiClient = new ApiConstructor({
|
|
79
|
-
...this.opts,
|
|
80
|
-
isJsonMime: (mime) => {
|
|
81
|
-
return mime === "application/json";
|
|
82
|
-
}
|
|
83
|
-
}, this.opts.basePath ?? "", this.opts.axiosInstance ?? axios.create());
|
|
84
|
-
for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient))) if (key !== "constructor" && typeof apiClient[key] === "function") {
|
|
85
|
-
const originalFunction = apiClient[key];
|
|
86
|
-
apiClient[key] = (...args) => {
|
|
87
|
-
return originalFunction.apply(apiClient, [this.cellId, ...args]).then((res) => res.data);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return apiClient;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* As withCellId, but only does the response unwrapping
|
|
94
|
-
*/
|
|
95
|
-
withUnwrappedResponsesOnly(ApiConstructor) {
|
|
96
|
-
const apiClient = new ApiConstructor({
|
|
97
|
-
...this.opts,
|
|
98
|
-
isJsonMime: (mime) => {
|
|
99
|
-
return mime === "application/json";
|
|
100
|
-
}
|
|
101
|
-
}, this.opts.basePath ?? "", this.opts.axiosInstance ?? axios.create());
|
|
102
|
-
for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient))) if (key !== "constructor" && typeof apiClient[key] === "function") {
|
|
103
|
-
const originalFunction = apiClient[key];
|
|
104
|
-
apiClient[key] = (...args) => {
|
|
105
|
-
return originalFunction.apply(apiClient, args).then((res) => res.data);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return apiClient;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
7
|
+
const isLocalhostDev = typeof window !== "undefined" && window.location.hostname === "localhost" && process.env.NODE_ENV === "development";
|
|
111
8
|
//#endregion
|
|
112
9
|
//#region src/lib/mock/getCurrentRobotControllerState.ts
|
|
113
10
|
const getCurrentRobotControllerState = {
|
|
@@ -716,130 +613,6 @@ const defaultMotionState = { result: {
|
|
|
716
613
|
description_revision: 0
|
|
717
614
|
} };
|
|
718
615
|
//#endregion
|
|
719
|
-
//#region src/lib/deprecated/v2/NovaClient.ts
|
|
720
|
-
/**
|
|
721
|
-
* Client for connecting to a Nova instance and controlling robots.
|
|
722
|
-
* @deprecated Use `Nova` from `@wandelbots/nova-js/v2` instead.
|
|
723
|
-
*/
|
|
724
|
-
var NovaClient = class {
|
|
725
|
-
api;
|
|
726
|
-
config;
|
|
727
|
-
mock;
|
|
728
|
-
instanceUrl;
|
|
729
|
-
authPromise = null;
|
|
730
|
-
accessToken = null;
|
|
731
|
-
constructor(config) {
|
|
732
|
-
const cellId = config.cellId ?? "cell";
|
|
733
|
-
this.config = {
|
|
734
|
-
cellId,
|
|
735
|
-
...config
|
|
736
|
-
};
|
|
737
|
-
this.accessToken = config.accessToken || availableStorage.getString("wbjs.access_token") || null;
|
|
738
|
-
if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
|
|
739
|
-
this.instanceUrl = parseNovaInstanceUrl(this.config.instanceUrl);
|
|
740
|
-
const axiosInstance = axios.create({
|
|
741
|
-
baseURL: new URL("/api/v2", this.instanceUrl).href,
|
|
742
|
-
headers: isLocalhostDev ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
|
|
743
|
-
});
|
|
744
|
-
axiosInstance.interceptors.request.use(async (request) => {
|
|
745
|
-
if (!request.headers.Authorization) {
|
|
746
|
-
if (this.accessToken) request.headers.Authorization = `Bearer ${this.accessToken}`;
|
|
747
|
-
else if (this.config.username && this.config.password) request.headers.Authorization = `Basic ${btoa(`${config.username}:${config.password}`)}`;
|
|
748
|
-
}
|
|
749
|
-
return request;
|
|
750
|
-
});
|
|
751
|
-
if (typeof window !== "undefined") axiosInstance.interceptors.response.use((r) => r, async (error) => {
|
|
752
|
-
if (isAxiosError(error)) {
|
|
753
|
-
if (error.response?.status === 401) try {
|
|
754
|
-
await this.renewAuthentication();
|
|
755
|
-
if (error.config) {
|
|
756
|
-
if (this.accessToken) error.config.headers.Authorization = `Bearer ${this.accessToken}`;
|
|
757
|
-
else delete error.config.headers.Authorization;
|
|
758
|
-
return axiosInstance.request(error.config);
|
|
759
|
-
}
|
|
760
|
-
} catch (err) {
|
|
761
|
-
return Promise.reject(err);
|
|
762
|
-
}
|
|
763
|
-
else if (error.response?.status === 503) {
|
|
764
|
-
if ((await fetch(window.location.href)).status === 503) return guardedPageReload("503_server_unavailable");
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
return Promise.reject(error);
|
|
768
|
-
});
|
|
769
|
-
this.api = new NovaCellAPIClient(cellId, {
|
|
770
|
-
...config,
|
|
771
|
-
basePath: new URL("/api/v2", this.instanceUrl).href,
|
|
772
|
-
isJsonMime: (mime) => {
|
|
773
|
-
return mime === "application/json";
|
|
774
|
-
},
|
|
775
|
-
baseOptions: {
|
|
776
|
-
...this.mock ? { adapter: (config) => {
|
|
777
|
-
return this.mock.handleAPIRequest(config);
|
|
778
|
-
} } : {},
|
|
779
|
-
...config.baseOptions
|
|
780
|
-
},
|
|
781
|
-
axiosInstance
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
async renewAuthentication() {
|
|
785
|
-
if (this.authPromise) return;
|
|
786
|
-
const storedToken = availableStorage.getString("wbjs.access_token");
|
|
787
|
-
if (storedToken && this.accessToken !== storedToken) {
|
|
788
|
-
this.accessToken = storedToken;
|
|
789
|
-
return;
|
|
790
|
-
}
|
|
791
|
-
this.authPromise = loginWithAuth0(this.instanceUrl);
|
|
792
|
-
try {
|
|
793
|
-
this.accessToken = await this.authPromise;
|
|
794
|
-
if (this.accessToken) availableStorage.setString("wbjs.access_token", this.accessToken);
|
|
795
|
-
else availableStorage.delete("wbjs.access_token");
|
|
796
|
-
} finally {
|
|
797
|
-
this.authPromise = null;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
makeWebsocketURL(path) {
|
|
801
|
-
const url = new URL(new URL(`/api/v2/cells/${this.config.cellId}/${path.replace(/^\/+/, "")}`, this.instanceUrl).href);
|
|
802
|
-
url.protocol = url.protocol.replace("http", "ws");
|
|
803
|
-
url.protocol = url.protocol.replace("https", "wss");
|
|
804
|
-
if (this.accessToken) url.searchParams.append("token", this.accessToken);
|
|
805
|
-
else if (this.config.username && this.config.password) {
|
|
806
|
-
url.username = this.config.username;
|
|
807
|
-
url.password = this.config.password;
|
|
808
|
-
}
|
|
809
|
-
return url.toString();
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.
|
|
813
|
-
* If you explicitly want to reconnect an existing websocket, call `reconnect`
|
|
814
|
-
* on the returned object.
|
|
815
|
-
*/
|
|
816
|
-
openReconnectingWebsocket(path) {
|
|
817
|
-
return new AutoReconnectingWebsocket(this.makeWebsocketURL(path), { mock: this.mock });
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
//#endregion
|
|
821
|
-
//#region src/lib/deprecated/v2/wandelscriptUtils.ts
|
|
822
|
-
/**
|
|
823
|
-
* Convert a Pose object representing a motion group position
|
|
824
|
-
* into a string which represents that pose in Wandelscript.
|
|
825
|
-
* @deprecated Wandelscript usage is deprecated; switching to Python is recommended.
|
|
826
|
-
*/
|
|
827
|
-
function poseToWandelscriptString(pose) {
|
|
828
|
-
const position = [
|
|
829
|
-
pose.position?.[0] ?? 0,
|
|
830
|
-
pose.position?.[1] ?? 0,
|
|
831
|
-
pose.position?.[2] ?? 0
|
|
832
|
-
];
|
|
833
|
-
const orientation = [
|
|
834
|
-
pose.orientation?.[0] ?? 0,
|
|
835
|
-
pose.orientation?.[1] ?? 0,
|
|
836
|
-
pose.orientation?.[2] ?? 0
|
|
837
|
-
];
|
|
838
|
-
const positionValues = position.map((v) => v.toFixed(1));
|
|
839
|
-
const rotationValues = orientation.map((v) => v.toFixed(4));
|
|
840
|
-
return `(${positionValues.concat(rotationValues).join(", ")})`;
|
|
841
|
-
}
|
|
842
|
-
//#endregion
|
|
843
616
|
//#region src/lib/NovaAPIClient.ts
|
|
844
617
|
function unwrap(ApiConstructor, opts) {
|
|
845
618
|
const apiClient = new ApiConstructor({
|
|
@@ -1019,6 +792,6 @@ var Nova = class {
|
|
|
1019
792
|
}
|
|
1020
793
|
};
|
|
1021
794
|
//#endregion
|
|
1022
|
-
export { Nova, NovaAPIClient
|
|
795
|
+
export { Nova, NovaAPIClient };
|
|
1023
796
|
|
|
1024
797
|
//# sourceMappingURL=index.mjs.map
|