@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.
Files changed (72) hide show
  1. package/dist/{AutoReconnectingWebsocket-1K2J1NA4.d.cts → AutoReconnectingWebsocket-BSt-vnzX.d.mts} +4 -16
  2. package/dist/AutoReconnectingWebsocket-BSt-vnzX.d.mts.map +1 -0
  3. package/dist/{context-ffr5Q2dc.mjs → LoginWithAuth0-D92HnzHq.mjs} +3 -13
  4. package/dist/LoginWithAuth0-D92HnzHq.mjs.map +1 -0
  5. package/dist/{Nova--8gozkLR.d.mts → Nova-C8nDNSCa.d.mts} +2 -2
  6. package/dist/{Nova--8gozkLR.d.mts.map → Nova-C8nDNSCa.d.mts.map} +1 -1
  7. package/dist/experimental/nats/index.d.mts +1 -1
  8. package/dist/index.d.mts +2 -7
  9. package/dist/index.d.mts.map +1 -1
  10. package/dist/index.mjs +2 -3
  11. package/dist/v2/index.d.mts +2 -130
  12. package/dist/v2/index.mjs +4 -231
  13. package/dist/v2/index.mjs.map +1 -1
  14. package/package.json +13 -17
  15. package/src/index.ts +0 -2
  16. package/src/lib/AutoReconnectingWebsocket.ts +3 -4
  17. package/src/lib/LoginWithAuth0.ts +1 -1
  18. package/src/lib/context.ts +1 -1
  19. package/src/lib/errorHandling.ts +0 -7
  20. package/src/v2/index.ts +0 -3
  21. package/dist/AutoReconnectingWebsocket-1K2J1NA4.d.cts.map +0 -1
  22. package/dist/AutoReconnectingWebsocket-1K2J1NA4.d.mts +0 -69
  23. package/dist/AutoReconnectingWebsocket-1K2J1NA4.d.mts.map +0 -1
  24. package/dist/Nova-B1o5iTQ6.d.cts +0 -85
  25. package/dist/Nova-B1o5iTQ6.d.cts.map +0 -1
  26. package/dist/context-BZELA2eh.cjs +0 -348
  27. package/dist/context-BZELA2eh.cjs.map +0 -1
  28. package/dist/context-ffr5Q2dc.mjs.map +0 -1
  29. package/dist/converters-EYS27XJE.cjs +0 -146
  30. package/dist/converters-EYS27XJE.cjs.map +0 -1
  31. package/dist/experimental/nats/index.cjs +0 -158
  32. package/dist/experimental/nats/index.cjs.map +0 -1
  33. package/dist/experimental/nats/index.d.cts +0 -3235
  34. package/dist/experimental/nats/index.d.cts.map +0 -1
  35. package/dist/index.cjs +0 -24
  36. package/dist/index.d.cts +0 -110
  37. package/dist/index.d.cts.map +0 -1
  38. package/dist/v1/index.cjs +0 -201
  39. package/dist/v1/index.cjs.map +0 -1
  40. package/dist/v1/index.d.cts +0 -67
  41. package/dist/v1/index.d.cts.map +0 -1
  42. package/dist/v1/index.d.mts +0 -67
  43. package/dist/v1/index.d.mts.map +0 -1
  44. package/dist/v1/index.mjs +0 -184
  45. package/dist/v1/index.mjs.map +0 -1
  46. package/dist/v2/index.cjs +0 -1038
  47. package/dist/v2/index.cjs.map +0 -1
  48. package/dist/v2/index.d.cts +0 -131
  49. package/dist/v2/index.d.cts.map +0 -1
  50. package/dist/v2/index.d.mts.map +0 -1
  51. package/dist/wandelscriptUtils-CpUXdLVc.mjs +0 -2062
  52. package/dist/wandelscriptUtils-CpUXdLVc.mjs.map +0 -1
  53. package/dist/wandelscriptUtils-DY3WsiuB.d.cts +0 -356
  54. package/dist/wandelscriptUtils-DY3WsiuB.d.cts.map +0 -1
  55. package/dist/wandelscriptUtils-DcY1aLWu.cjs +0 -2099
  56. package/dist/wandelscriptUtils-DcY1aLWu.cjs.map +0 -1
  57. package/dist/wandelscriptUtils-YHTxn_p9.d.mts +0 -356
  58. package/dist/wandelscriptUtils-YHTxn_p9.d.mts.map +0 -1
  59. package/src/lib/deprecated/v1/ConnectedMotionGroup.ts +0 -449
  60. package/src/lib/deprecated/v1/JoggerConnection.ts +0 -491
  61. package/src/lib/deprecated/v1/MotionStreamConnection.ts +0 -215
  62. package/src/lib/deprecated/v1/NovaCellAPIClient.ts +0 -208
  63. package/src/lib/deprecated/v1/NovaClient.ts +0 -260
  64. package/src/lib/deprecated/v1/ProgramStateConnection.ts +0 -277
  65. package/src/lib/deprecated/v1/getLatestTrajectories.ts +0 -37
  66. package/src/lib/deprecated/v1/mock/MockNovaInstance.ts +0 -1303
  67. package/src/lib/deprecated/v1/motionStateUpdate.ts +0 -58
  68. package/src/lib/deprecated/v1/wandelscriptUtils.ts +0 -23
  69. package/src/lib/deprecated/v2/NovaCellAPIClient.ts +0 -215
  70. package/src/lib/deprecated/v2/NovaClient.ts +0 -218
  71. package/src/lib/deprecated/v2/wandelscriptUtils.ts +0 -28
  72. package/src/v1/index.ts +0 -14
@@ -1,348 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
- //#endregion
23
- const require_converters = require("./converters-EYS27XJE.cjs");
24
- let reconnecting_websocket = require("reconnecting-websocket");
25
- reconnecting_websocket = __toESM(reconnecting_websocket, 1);
26
- let axios = require("axios");
27
- //#region src/lib/AutoReconnectingWebsocket.ts
28
- var AutoReconnectingWebsocket = class extends reconnecting_websocket.default {
29
- receivedFirstMessage;
30
- targetUrl;
31
- disposed = false;
32
- opts;
33
- constructor(targetUrl, opts = {}) {
34
- console.log("Opening websocket to", targetUrl);
35
- super(() => this.targetUrl || targetUrl, void 0, { startClosed: true });
36
- Object.defineProperty(this, "url", { get() {
37
- return this.targetUrl;
38
- } });
39
- this.targetUrl = targetUrl;
40
- this.opts = opts;
41
- this.addEventListener("open", () => {
42
- console.log(`Websocket to ${this.url} opened`);
43
- });
44
- this.addEventListener("message", (ev) => {
45
- if (!this.receivedFirstMessage) this.receivedFirstMessage = ev;
46
- });
47
- this.addEventListener("close", () => {
48
- console.log(`Websocket to ${this.url} closed`);
49
- });
50
- const origReconnect = this.reconnect;
51
- this.reconnect = () => {
52
- if (this.opts.mock) this.opts.mock.handleWebsocketConnection(this);
53
- else origReconnect.apply(this);
54
- };
55
- this.reconnect();
56
- }
57
- changeUrl(targetUrl) {
58
- this.receivedFirstMessage = void 0;
59
- this.targetUrl = targetUrl;
60
- this.reconnect();
61
- }
62
- sendJson(data) {
63
- if (this.opts.mock) this.opts.mock.handleWebsocketMessage(this, JSON.stringify(data));
64
- else this.send(JSON.stringify(data));
65
- }
66
- /**
67
- * Permanently close this websocket and indicate that
68
- * this object should not be used again.
69
- **/
70
- dispose() {
71
- this.close();
72
- this.disposed = true;
73
- if (this.opts.onDispose) this.opts.onDispose();
74
- }
75
- /**
76
- * Returns a promise that resolves once the websocket
77
- * is in the OPEN state. */
78
- async opened() {
79
- return new Promise((resolve, reject) => {
80
- if (this.readyState === WebSocket.OPEN) resolve();
81
- else {
82
- this.addEventListener("open", () => resolve());
83
- this.addEventListener("error", reject);
84
- }
85
- });
86
- }
87
- /**
88
- * Returns a promise that resolves once the websocket
89
- * is in the CLOSED state. */
90
- async closed() {
91
- return new Promise((resolve, reject) => {
92
- if (this.readyState === WebSocket.CLOSED) resolve();
93
- else {
94
- this.addEventListener("close", () => resolve());
95
- this.addEventListener("error", reject);
96
- }
97
- });
98
- }
99
- /**
100
- * Returns a promise that resolves when the first message
101
- * is received from the websocket. Resolves immediately if
102
- * the first message has already been received.
103
- */
104
- async firstMessage() {
105
- if (this.receivedFirstMessage) return this.receivedFirstMessage;
106
- return new Promise((resolve, reject) => {
107
- const onMessage = (ev) => {
108
- this.receivedFirstMessage = ev;
109
- this.removeEventListener("message", onMessage);
110
- this.removeEventListener("error", onError);
111
- resolve(ev);
112
- };
113
- const onError = (ev) => {
114
- this.removeEventListener("message", onMessage);
115
- this.removeEventListener("error", onError);
116
- reject(ev);
117
- };
118
- this.addEventListener("message", onMessage);
119
- this.addEventListener("error", onError);
120
- });
121
- }
122
- /**
123
- * Returns a promise that resolves when the next message
124
- * is received from the websocket.
125
- */
126
- async nextMessage() {
127
- return new Promise((resolve, reject) => {
128
- const onMessage = (ev) => {
129
- this.removeEventListener("message", onMessage);
130
- this.removeEventListener("error", onError);
131
- resolve(ev);
132
- };
133
- const onError = (ev) => {
134
- this.removeEventListener("message", onMessage);
135
- this.removeEventListener("error", onError);
136
- reject(ev);
137
- };
138
- this.addEventListener("message", onMessage);
139
- this.addEventListener("error", onError);
140
- });
141
- }
142
- };
143
- //#endregion
144
- //#region src/lib/availableStorage.ts
145
- /**
146
- * Safety wrapper around browser localStorage providing context availability
147
- * checks and JSON parsing
148
- */
149
- var AvailableStorage = class {
150
- available = typeof window !== "undefined" && !!window.localStorage;
151
- getJSON(key) {
152
- if (!this.available) return null;
153
- const result = window.localStorage.getItem(key);
154
- if (result === null) return null;
155
- try {
156
- return JSON.parse(result);
157
- } catch (err) {
158
- return null;
159
- }
160
- }
161
- setJSON(key, obj) {
162
- if (!this.available) return null;
163
- window.localStorage.setItem(key, JSON.stringify(obj));
164
- }
165
- delete(key) {
166
- if (!this.available) return null;
167
- window.localStorage.removeItem(key);
168
- }
169
- setString(key, value) {
170
- if (!this.available) return null;
171
- window.localStorage.setItem(key, value);
172
- }
173
- getString(key) {
174
- if (!this.available) return null;
175
- return window.localStorage.getItem(key);
176
- }
177
- };
178
- const availableStorage = new AvailableStorage();
179
- //#endregion
180
- //#region src/lib/errorHandling.ts
181
- function delay(ms) {
182
- return new Promise((resolve) => setTimeout(resolve, ms));
183
- }
184
- /**
185
- * @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
186
- */
187
- function makeShortErrorMessage(err) {
188
- return makeErrorMessage(err);
189
- }
190
- /**
191
- * Attempts to make a helpful error message from an unknown thrown error
192
- * or promise rejection.
193
- *
194
- * This function is mainly to aid debugging and good bug reports. For
195
- * expected errors encountered by end users, it's more ideal to catch
196
- * the specific error code and provide a localized app-specific error message.
197
- */
198
- function makeErrorMessage(err) {
199
- if ((0, axios.isAxiosError)(err)) {
200
- if (err.response) return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || "accessing"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`;
201
- else if (err.config) if (err.code === "ERR_NETWORK") 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.`;
202
- else return `${err.message} from ${err.config.method?.toUpperCase() || "accessing"} ${err.config.url}`;
203
- } else if (err instanceof Error) return err.message;
204
- else if (typeof err === "string") return err;
205
- else if (typeof err === "object") return require_converters.tryStringifyJson(err) || `Unserializable object ${err}`;
206
- return `${err}`;
207
- }
208
- /**
209
- * Reloads the page with protection against loops.
210
- * Allows at most one reload per 10 seconds; otherwise throws
211
- * an error.
212
- */
213
- function guardedPageReload(key) {
214
- const RELOAD_KEY = `novajs_reload_guard:${key}`;
215
- const RELOAD_COOLDOWN_MS = 1e4;
216
- const lastReloadAt = Number(window.sessionStorage.getItem(RELOAD_KEY) ?? "0");
217
- if (Date.now() - lastReloadAt < RELOAD_COOLDOWN_MS) throw new Error(`Unhandled error caused a reload (${key}), but a reload was already attempted recently. Aborting to prevent reload loop.`);
218
- window.sessionStorage.setItem(RELOAD_KEY, String(Date.now()));
219
- window.location.reload();
220
- return new Promise(() => {});
221
- }
222
- //#endregion
223
- //#region src/lib/LoginWithAuth0.ts
224
- /**
225
- * Mapping of stages to Auth0 configurations.
226
- * The client ids are public identifiers for a specific auth0 application
227
- * and are safe to include in client-side code.
228
- * https://auth0.com/docs/get-started/applications/application-settings
229
- */
230
- const auth0ConfigMap = {
231
- dev: {
232
- domain: `https://auth.portal.dev.wandelbots.io`,
233
- clientId: "fLbJD0RLp5r2Dpucm5j8BjwMR6Hunfha"
234
- },
235
- stg: {
236
- domain: `https://auth.portal.stg.wandelbots.io`,
237
- clientId: "joVDeD9e786WzFNSGCqoVq7HNkWt5j6s"
238
- },
239
- prod: {
240
- domain: `https://auth.portal.wandelbots.io`,
241
- clientId: "J7WJUi38xVQdJAEBNRT9Xw1b0fXDb4J2"
242
- }
243
- };
244
- /** Determine which Auth0 configuration to use based on instance URL */
245
- const getAuth0Config = (instanceUrl) => {
246
- if (instanceUrl.host.endsWith(".dev.wandelbots.io")) return auth0ConfigMap.dev;
247
- if (instanceUrl.host.endsWith(".stg.wandelbots.io")) return auth0ConfigMap.stg;
248
- if (instanceUrl.host.endsWith(".wandelbots.io")) return auth0ConfigMap.prod;
249
- throw new Error(`Unable to authenticate with NOVA instance "${instanceUrl}". Auth0 login is only supported for cloud instances with hosts of the form "**.wandelbots.io".`);
250
- };
251
- /**
252
- * Initializes Auth0 login process using redirect if necessary and retrieves an access token.
253
- * Returns null when an access token should not be needed to authenticate (i.e. cookie auth
254
- * when deployed on the instance domain)
255
- */
256
- const loginWithAuth0 = async (instanceUrl) => {
257
- if (typeof window === "undefined") throw new Error(`Access token must be set to use NovaClient when not in a browser environment.`);
258
- if (instanceUrl.origin === window.location.origin) return guardedPageReload("cloud_instance_auth");
259
- const { Auth0Client } = await import("@auth0/auth0-spa-js");
260
- const auth0Config = getAuth0Config(instanceUrl);
261
- const auth0Client = new Auth0Client({
262
- domain: auth0Config.domain,
263
- clientId: auth0Config.clientId ?? "",
264
- useRefreshTokens: false,
265
- authorizationParams: {
266
- audience: "nova-api",
267
- redirect_uri: window.location.origin
268
- }
269
- });
270
- if (window.location.search.includes("code=") && window.location.search.includes("state=")) {
271
- const { appState } = await auth0Client.handleRedirectCallback();
272
- window.history.replaceState({}, document.title, appState?.returnTo || window.location.pathname);
273
- } else await auth0Client.loginWithRedirect();
274
- return await auth0Client.getTokenSilently();
275
- };
276
- //#endregion
277
- //#region src/lib/context.ts
278
- const isBrowser = typeof window !== "undefined";
279
- const isLocalhostDev = isBrowser && window.location.hostname === "localhost" && process.env.NODE_ENV === "development";
280
- //#endregion
281
- Object.defineProperty(exports, "AutoReconnectingWebsocket", {
282
- enumerable: true,
283
- get: function() {
284
- return AutoReconnectingWebsocket;
285
- }
286
- });
287
- Object.defineProperty(exports, "__toESM", {
288
- enumerable: true,
289
- get: function() {
290
- return __toESM;
291
- }
292
- });
293
- Object.defineProperty(exports, "availableStorage", {
294
- enumerable: true,
295
- get: function() {
296
- return availableStorage;
297
- }
298
- });
299
- Object.defineProperty(exports, "delay", {
300
- enumerable: true,
301
- get: function() {
302
- return delay;
303
- }
304
- });
305
- Object.defineProperty(exports, "getAuth0Config", {
306
- enumerable: true,
307
- get: function() {
308
- return getAuth0Config;
309
- }
310
- });
311
- Object.defineProperty(exports, "guardedPageReload", {
312
- enumerable: true,
313
- get: function() {
314
- return guardedPageReload;
315
- }
316
- });
317
- Object.defineProperty(exports, "isBrowser", {
318
- enumerable: true,
319
- get: function() {
320
- return isBrowser;
321
- }
322
- });
323
- Object.defineProperty(exports, "isLocalhostDev", {
324
- enumerable: true,
325
- get: function() {
326
- return isLocalhostDev;
327
- }
328
- });
329
- Object.defineProperty(exports, "loginWithAuth0", {
330
- enumerable: true,
331
- get: function() {
332
- return loginWithAuth0;
333
- }
334
- });
335
- Object.defineProperty(exports, "makeErrorMessage", {
336
- enumerable: true,
337
- get: function() {
338
- return makeErrorMessage;
339
- }
340
- });
341
- Object.defineProperty(exports, "makeShortErrorMessage", {
342
- enumerable: true,
343
- get: function() {
344
- return makeShortErrorMessage;
345
- }
346
- });
347
-
348
- //# sourceMappingURL=context-BZELA2eh.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-BZELA2eh.cjs","names":["ReconnectingWebSocket","tryStringifyJson"],"sources":["../src/lib/AutoReconnectingWebsocket.ts","../src/lib/availableStorage.ts","../src/lib/errorHandling.ts","../src/lib/LoginWithAuth0.ts","../src/lib/context.ts"],"sourcesContent":["import ReconnectingWebSocket, { type ErrorEvent } from \"reconnecting-websocket\"\nimport type * as v1 from \"./deprecated/v1/mock/MockNovaInstance.ts\"\nimport type * as v2 from \"./mock/MockNovaInstance.ts\"\n\nexport class AutoReconnectingWebsocket extends ReconnectingWebSocket {\n receivedFirstMessage?: MessageEvent\n targetUrl: string\n disposed = false\n readonly opts: {\n mock?: v1.MockNovaInstance | v2.MockNovaInstance\n onDispose?: () => void\n }\n\n constructor(\n targetUrl: string,\n opts: {\n mock?: v1.MockNovaInstance | v2.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 * @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\n */\nexport function makeShortErrorMessage(err: unknown) {\n return makeErrorMessage(err)\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 NovaClient 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","// Some general checks about the context the nova-js code is running in\n\nexport const isBrowser = typeof window !== \"undefined\"\n\nexport const isLocalhostDev =\n isBrowser &&\n window.location.hostname === \"localhost\" &&\n process.env.NODE_ENV === \"development\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAa,4BAAb,cAA+CA,uBAAAA,QAAsB;CACnE;CACA;CACA,WAAW;CACX;CAKA,YACE,WACA,OAGI,CAAC,GACL;EACA,QAAQ,IAAI,wBAA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GD,IACE,OAAO,SAAS,OAAO,SAAS,OAAO,KACvC,OAAO,SAAS,OAAO,SAAS,QAAQ,GACxC;EACA,MAAM,EAAE,aAAa,MAAM,YAAY,uBAAuB;EAE9D,OAAO,QAAQ,aACb,CAAC,GACD,SAAS,OACT,UAAU,YAAY,OAAO,SAAS,QACxC;CACF,OAEE,MAAM,YAAY,kBAAkB;CAKtC,OAAO,MADmB,YAAY,iBAAiB;AAEzD;;;ACzFA,MAAa,YAAY,OAAO,WAAW;AAE3C,MAAa,iBACX,aACA,OAAO,SAAS,aAAa,eAC7B,QAAQ,IAAI,aAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-ffr5Q2dc.mjs","names":[],"sources":["../src/lib/AutoReconnectingWebsocket.ts","../src/lib/availableStorage.ts","../src/lib/errorHandling.ts","../src/lib/LoginWithAuth0.ts","../src/lib/context.ts"],"sourcesContent":["import ReconnectingWebSocket, { type ErrorEvent } from \"reconnecting-websocket\"\nimport type * as v1 from \"./deprecated/v1/mock/MockNovaInstance.ts\"\nimport type * as v2 from \"./mock/MockNovaInstance.ts\"\n\nexport class AutoReconnectingWebsocket extends ReconnectingWebSocket {\n receivedFirstMessage?: MessageEvent\n targetUrl: string\n disposed = false\n readonly opts: {\n mock?: v1.MockNovaInstance | v2.MockNovaInstance\n onDispose?: () => void\n }\n\n constructor(\n targetUrl: string,\n opts: {\n mock?: v1.MockNovaInstance | v2.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 * @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\n */\nexport function makeShortErrorMessage(err: unknown) {\n return makeErrorMessage(err)\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 NovaClient 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","// Some general checks about the context the nova-js code is running in\n\nexport const isBrowser = typeof window !== \"undefined\"\n\nexport const isLocalhostDev =\n isBrowser &&\n window.location.hostname === \"localhost\" &&\n process.env.NODE_ENV === \"development\"\n"],"mappings":";;;;AAIA,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;GACvC,IAAI,CAAC,KAAK,sBACR,KAAK,uBAAuB;EAEhC,CAAC;EAED,KAAK,iBAAiB,eAAe;GACnC,QAAQ,IAAI,gBAAgB,KAAK,IAAI,QAAQ;EAC/C,CAAC;EAED,MAAM,gBAAgB,KAAK;EAC3B,KAAK,kBAAkB;GACrB,IAAI,KAAK,KAAK,MACZ,KAAK,KAAK,KAAK,0BAA0B,IAAI;QAE7C,cAAc,MAAM,IAAI;EAE5B;EAEA,KAAK,UAAU;CACjB;CAEA,UAAU,WAAmB;EAC3B,KAAK,uBAAuB,KAAA;EAC5B,KAAK,YAAY;EACjB,KAAK,UAAU;CACjB;CAEA,SAAS,MAAe;EACtB,IAAI,KAAK,KAAK,MACZ,KAAK,KAAK,KAAK,uBAAuB,MAAM,KAAK,UAAU,IAAI,CAAC;OAEhE,KAAK,KAAK,KAAK,UAAU,IAAI,CAAC;CAElC;;;;;CAMA,UAAU;EACR,KAAK,MAAM;EACX,KAAK,WAAW;E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EACF;CAGF,IAAI,YAAY,WAAW,OAAO,SAAS,QAIzC,OAAO,kBAAkB,qBAAqB;CAMhD,MAAM,EAAE,gBAAgB,MAAM,OAAO;CAErC,MAAM,cAAc,eAAe,WAAW;CAE9C,MAAM,cAAc,IAAI,YAAY;EAClC,QAAQ,YAAY;EACpB,UAAU,YAAY,YAAY;EAClC,kBAAkB;EAClB,qBAAqB;GACnB,UAAU;GACV,cAAc,OAAO,SAAS;EAChC;CACF,CAAC;CAGD,IACE,OAAO,SAAS,OAAO,SAAS,OAAO,KACvC,OAAO,SAAS,OAAO,SAAS,QAAQ,GACxC;EACA,MAAM,EAAE,aAAa,MAAM,YAAY,uBAAuB;EAE9D,OAAO,QAAQ,aACb,CAAC,GACD,SAAS,OACT,UAAU,YAAY,OAAO,SAAS,QACxC;CACF,OAEE,MAAM,YAAY,kBAAkB;CAKtC,OAAO,MADmB,YAAY,iBAAiB;AAEzD;;;ACzFA,MAAa,YAAY,OAAO,WAAW;AAE3C,MAAa,iBACX,aACA,OAAO,SAAS,aAAa,eAC7B,QAAQ,IAAI,aAAa"}
@@ -1,146 +0,0 @@
1
- //#region src/lib/converters.ts
2
- /**
3
- * Parse a string as a URL, with options to enforce or default the scheme.
4
- */
5
- function parseUrl(url, options = {}) {
6
- const { scheme, defaultScheme } = options;
7
- const schemeRegex = /^[a-zA-Z]+:\/\//;
8
- if (scheme) {
9
- url = url.replace(schemeRegex, "");
10
- url = `${scheme}://${url}`;
11
- } else if (defaultScheme && !schemeRegex.test(url)) url = `${defaultScheme}://${url}`;
12
- return new URL(url);
13
- }
14
- /**
15
- * Attempt to parse a string as a URL; return undefined if we can't
16
- */
17
- function tryParseUrl(url, options = {}) {
18
- try {
19
- return parseUrl(url, options);
20
- } catch {
21
- return;
22
- }
23
- }
24
- /**
25
- * Permissively parse a NOVA instance URL from a config variable.
26
- * If scheme is not specified, defaults to https for *.wandelbots.io hosts,
27
- * and http otherwise.
28
- * Throws an error if a valid URL could not be determined.
29
- */
30
- function parseNovaInstanceUrl(url) {
31
- if (tryParseUrl(url, { defaultScheme: "http" })?.host.endsWith(".wandelbots.io")) return parseUrl(url, { defaultScheme: "https" });
32
- else return parseUrl(url, { defaultScheme: "http" });
33
- }
34
- /** Try to parse something as JSON; return undefined if we can't */
35
- function tryParseJson(json) {
36
- try {
37
- return JSON.parse(json);
38
- } catch {
39
- return;
40
- }
41
- }
42
- /** Try to turn something into JSON; return undefined if we can't */
43
- function tryStringifyJson(json) {
44
- try {
45
- return JSON.stringify(json);
46
- } catch {
47
- return;
48
- }
49
- }
50
- /**
51
- * Converts object parameters to query string.
52
- * e.g. { a: "1", b: "2" } => "?a=1&b=2"
53
- * {} => ""
54
- */
55
- function makeUrlQueryString(obj) {
56
- const str = new URLSearchParams(obj).toString();
57
- return str ? `?${str}` : "";
58
- }
59
- /** Convert radians to degrees */
60
- function radiansToDegrees(radians) {
61
- return radians * (180 / Math.PI);
62
- }
63
- /** Convert degrees to radians */
64
- function degreesToRadians(degrees) {
65
- return degrees * (Math.PI / 180);
66
- }
67
- /**
68
- * Check for coordinate system id equivalence, accounting for the "world" default
69
- * on empty/undefined values.
70
- */
71
- function isSameCoordinateSystem(firstCoordSystem, secondCoordSystem) {
72
- if (!firstCoordSystem) firstCoordSystem = "world";
73
- if (!secondCoordSystem) secondCoordSystem = "world";
74
- return firstCoordSystem === secondCoordSystem;
75
- }
76
- /**
77
- * Helpful const for converting {x, y, z} to [x, y, z] and vice versa
78
- */
79
- const XYZ_TO_VECTOR = {
80
- x: 0,
81
- y: 1,
82
- z: 2
83
- };
84
- //#endregion
85
- Object.defineProperty(exports, "XYZ_TO_VECTOR", {
86
- enumerable: true,
87
- get: function() {
88
- return XYZ_TO_VECTOR;
89
- }
90
- });
91
- Object.defineProperty(exports, "degreesToRadians", {
92
- enumerable: true,
93
- get: function() {
94
- return degreesToRadians;
95
- }
96
- });
97
- Object.defineProperty(exports, "isSameCoordinateSystem", {
98
- enumerable: true,
99
- get: function() {
100
- return isSameCoordinateSystem;
101
- }
102
- });
103
- Object.defineProperty(exports, "makeUrlQueryString", {
104
- enumerable: true,
105
- get: function() {
106
- return makeUrlQueryString;
107
- }
108
- });
109
- Object.defineProperty(exports, "parseNovaInstanceUrl", {
110
- enumerable: true,
111
- get: function() {
112
- return parseNovaInstanceUrl;
113
- }
114
- });
115
- Object.defineProperty(exports, "parseUrl", {
116
- enumerable: true,
117
- get: function() {
118
- return parseUrl;
119
- }
120
- });
121
- Object.defineProperty(exports, "radiansToDegrees", {
122
- enumerable: true,
123
- get: function() {
124
- return radiansToDegrees;
125
- }
126
- });
127
- Object.defineProperty(exports, "tryParseJson", {
128
- enumerable: true,
129
- get: function() {
130
- return tryParseJson;
131
- }
132
- });
133
- Object.defineProperty(exports, "tryParseUrl", {
134
- enumerable: true,
135
- get: function() {
136
- return tryParseUrl;
137
- }
138
- });
139
- Object.defineProperty(exports, "tryStringifyJson", {
140
- enumerable: true,
141
- get: function() {
142
- return tryStringifyJson;
143
- }
144
- });
145
-
146
- //# sourceMappingURL=converters-EYS27XJE.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"converters-EYS27XJE.cjs","names":[],"sources":["../src/lib/converters.ts"],"sourcesContent":["export type URLParseOptions = {\n /**\n * Ignore any scheme in the input string and force this scheme instead.\n */\n scheme?: \"http\" | \"https\"\n /**\n * If the input string does not include a scheme, use this as the default\n * scheme.\n */\n defaultScheme?: \"http\" | \"https\"\n}\n\n/**\n * Parse a string as a URL, with options to enforce or default the scheme.\n */\nexport function parseUrl(url: string, options: URLParseOptions = {}): URL {\n const { scheme, defaultScheme } = options\n\n const schemeRegex = /^[a-zA-Z]+:\\/\\//\n\n if (scheme) {\n // Force the scheme by removing any existing scheme and prepending the desired one\n url = url.replace(schemeRegex, \"\")\n url = `${scheme}://${url}`\n } else if (defaultScheme && !schemeRegex.test(url)) {\n // No scheme is present, add the default one\n url = `${defaultScheme}://${url}`\n }\n\n return new URL(url)\n}\n\n/**\n * Attempt to parse a string as a URL; return undefined if we can't\n */\nexport function tryParseUrl(\n url: string,\n options: URLParseOptions = {},\n): URL | undefined {\n try {\n return parseUrl(url, options)\n } catch {\n return undefined\n }\n}\n\n/**\n * Permissively parse a NOVA instance URL from a config variable.\n * If scheme is not specified, defaults to https for *.wandelbots.io hosts,\n * and http otherwise.\n * Throws an error if a valid URL could not be determined.\n */\nexport function parseNovaInstanceUrl(url: string): URL {\n const testUrl = tryParseUrl(url, { defaultScheme: \"http\" })\n if (testUrl?.host.endsWith(\".wandelbots.io\")) {\n return parseUrl(url, { defaultScheme: \"https\" })\n } else {\n return parseUrl(url, { defaultScheme: \"http\" })\n }\n}\n\n/** Try to parse something as JSON; return undefined if we can't */\n// biome-ignore lint/suspicious/noExplicitAny: it's json\nexport function tryParseJson(json: unknown): any {\n try {\n return JSON.parse(json as string)\n } catch {\n return undefined\n }\n}\n\n/** Try to turn something into JSON; return undefined if we can't */\nexport function tryStringifyJson(json: unknown): string | undefined {\n try {\n return JSON.stringify(json)\n } catch {\n return undefined\n }\n}\n\n/**\n * Converts object parameters to query string.\n * e.g. { a: \"1\", b: \"2\" } => \"?a=1&b=2\"\n * {} => \"\"\n */\nexport function makeUrlQueryString(obj: Record<string, string>): string {\n const str = new URLSearchParams(obj).toString()\n return str ? `?${str}` : \"\"\n}\n\n/** Convert radians to degrees */\nexport function radiansToDegrees(radians: number): number {\n return radians * (180 / Math.PI)\n}\n\n/** Convert degrees to radians */\nexport function degreesToRadians(degrees: number): number {\n return degrees * (Math.PI / 180)\n}\n\n/**\n * Check for coordinate system id equivalence, accounting for the \"world\" default\n * on empty/undefined values.\n */\nexport function isSameCoordinateSystem(\n firstCoordSystem: string | undefined,\n secondCoordSystem: string | undefined,\n) {\n if (!firstCoordSystem) firstCoordSystem = \"world\"\n if (!secondCoordSystem) secondCoordSystem = \"world\"\n\n return firstCoordSystem === secondCoordSystem\n}\n\n/**\n * Helpful const for converting {x, y, z} to [x, y, z] and vice versa\n */\nexport const XYZ_TO_VECTOR = { x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