@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
package/dist/v2/index.cjs DELETED
@@ -1,1038 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_context = require("../context-BZELA2eh.cjs");
3
- const require_converters = require("../converters-EYS27XJE.cjs");
4
- let axios = require("axios");
5
- axios = require_context.__toESM(axios, 1);
6
- let path_to_regexp = require("path-to-regexp");
7
- path_to_regexp = require_context.__toESM(path_to_regexp, 1);
8
- let _wandelbots_nova_api_v2 = require("@wandelbots/nova-api/v2");
9
- //#region src/lib/deprecated/v2/NovaCellAPIClient.ts
10
- /**
11
- * API client providing type-safe access to all the Nova API REST endpoints
12
- * associated with a specific cell id.
13
- * @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
14
- */
15
- var NovaCellAPIClient = class {
16
- system;
17
- cell;
18
- motionGroup;
19
- motionGroupModels;
20
- controller;
21
- controllerIOs;
22
- trajectoryPlanning;
23
- trajectoryExecution;
24
- trajectoryCaching;
25
- application;
26
- applicationGlobal;
27
- jogging;
28
- kinematics;
29
- busInputsOutputs;
30
- virtualController;
31
- virtualControllerBehavior;
32
- virtualControllerIOs;
33
- storeObject;
34
- storeCollisionComponents;
35
- storeCollisionSetups;
36
- program;
37
- license;
38
- novaCloud;
39
- robotConfigurations;
40
- version;
41
- session;
42
- cellId;
43
- opts;
44
- constructor(cellId, opts) {
45
- this.cellId = cellId;
46
- this.opts = opts;
47
- this.system = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.SystemApi);
48
- this.cell = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.CellApi);
49
- this.motionGroup = this.withCellId(_wandelbots_nova_api_v2.MotionGroupApi);
50
- this.motionGroupModels = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.MotionGroupModelsApi);
51
- this.controller = this.withCellId(_wandelbots_nova_api_v2.ControllerApi);
52
- this.controllerIOs = this.withCellId(_wandelbots_nova_api_v2.ControllerInputsOutputsApi);
53
- this.trajectoryPlanning = this.withCellId(_wandelbots_nova_api_v2.TrajectoryPlanningApi);
54
- this.trajectoryExecution = this.withCellId(_wandelbots_nova_api_v2.TrajectoryExecutionApi);
55
- this.trajectoryCaching = this.withCellId(_wandelbots_nova_api_v2.TrajectoryCachingApi);
56
- this.application = this.withCellId(_wandelbots_nova_api_v2.ApplicationApi);
57
- this.applicationGlobal = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.ApplicationApi);
58
- this.jogging = this.withCellId(_wandelbots_nova_api_v2.JoggingApi);
59
- this.kinematics = this.withCellId(_wandelbots_nova_api_v2.KinematicsApi);
60
- this.busInputsOutputs = this.withCellId(_wandelbots_nova_api_v2.BUSInputsOutputsApi);
61
- this.virtualController = this.withCellId(_wandelbots_nova_api_v2.VirtualControllerApi);
62
- this.virtualControllerBehavior = this.withCellId(_wandelbots_nova_api_v2.VirtualControllerBehaviorApi);
63
- this.virtualControllerIOs = this.withCellId(_wandelbots_nova_api_v2.VirtualControllerInputsOutputsApi);
64
- this.storeObject = this.withCellId(_wandelbots_nova_api_v2.StoreObjectApi);
65
- this.storeCollisionComponents = this.withCellId(_wandelbots_nova_api_v2.StoreCollisionComponentsApi);
66
- this.storeCollisionSetups = this.withCellId(_wandelbots_nova_api_v2.StoreCollisionSetupsApi);
67
- this.program = this.withCellId(_wandelbots_nova_api_v2.ProgramApi);
68
- this.license = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.LicenseApi);
69
- this.novaCloud = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.NOVACloudApi);
70
- this.robotConfigurations = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.RobotConfigurationsApi);
71
- this.version = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.VersionApi);
72
- this.session = this.withUnwrappedResponsesOnly(_wandelbots_nova_api_v2.SessionApi);
73
- }
74
- /**
75
- * Some TypeScript sorcery which alters the API class methods so you don't
76
- * have to pass the cell id to every single one, and de-encapsulates the
77
- * response data
78
- */
79
- withCellId(ApiConstructor) {
80
- const apiClient = new ApiConstructor({
81
- ...this.opts,
82
- isJsonMime: (mime) => {
83
- return mime === "application/json";
84
- }
85
- }, this.opts.basePath ?? "", this.opts.axiosInstance ?? axios.default.create());
86
- for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient))) if (key !== "constructor" && typeof apiClient[key] === "function") {
87
- const originalFunction = apiClient[key];
88
- apiClient[key] = (...args) => {
89
- return originalFunction.apply(apiClient, [this.cellId, ...args]).then((res) => res.data);
90
- };
91
- }
92
- return apiClient;
93
- }
94
- /**
95
- * As withCellId, but only does the response unwrapping
96
- */
97
- withUnwrappedResponsesOnly(ApiConstructor) {
98
- const apiClient = new ApiConstructor({
99
- ...this.opts,
100
- isJsonMime: (mime) => {
101
- return mime === "application/json";
102
- }
103
- }, this.opts.basePath ?? "", this.opts.axiosInstance ?? axios.default.create());
104
- for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient))) if (key !== "constructor" && typeof apiClient[key] === "function") {
105
- const originalFunction = apiClient[key];
106
- apiClient[key] = (...args) => {
107
- return originalFunction.apply(apiClient, args).then((res) => res.data);
108
- };
109
- }
110
- return apiClient;
111
- }
112
- };
113
- //#endregion
114
- //#region src/lib/mock/getCurrentRobotControllerState.ts
115
- const getCurrentRobotControllerState = {
116
- method: "GET",
117
- path: "/cells/:cellId/controllers/:controllerId/state",
118
- handle() {
119
- return {
120
- mode: "MODE_CONTROL",
121
- last_error: [],
122
- timestamp: "2025-10-16T09:19:26.634534092Z",
123
- sequence_number: 1054764,
124
- controller: "mock-ur5e",
125
- operation_mode: "OPERATION_MODE_AUTO",
126
- safety_state: "SAFETY_STATE_NORMAL",
127
- velocity_override: 100,
128
- motion_groups: [{
129
- timestamp: "2025-10-16T09:19:26.634534092Z",
130
- sequence_number: 1054764,
131
- motion_group: "0@mock-ur5e",
132
- controller: "mock-ur5e",
133
- joint_position: [
134
- 1.487959623336792,
135
- -1.8501918315887451,
136
- 1.8003005981445312,
137
- 6.034560203552246,
138
- 1.4921919107437134,
139
- 1.593459963798523
140
- ],
141
- joint_limit_reached: { limit_reached: [
142
- false,
143
- false,
144
- false,
145
- false,
146
- false,
147
- false
148
- ] },
149
- joint_torque: [],
150
- joint_current: [
151
- 0,
152
- 0,
153
- 0,
154
- 0,
155
- 0,
156
- 0
157
- ],
158
- flange_pose: {
159
- position: [
160
- 107.6452433732927,
161
- -409.0402987746852,
162
- 524.2402132330305
163
- ],
164
- orientation: [
165
- .9874434028353319,
166
- -.986571714997442,
167
- 1.3336589451098142
168
- ]
169
- },
170
- tcp: "Flange",
171
- tcp_pose: {
172
- position: [
173
- 107.6452433732927,
174
- -409.0402987746852,
175
- 524.2402132330305
176
- ],
177
- orientation: [
178
- .9874434028353319,
179
- -.986571714997442,
180
- 1.3336589451098142
181
- ]
182
- },
183
- payload: "",
184
- coordinate_system: "",
185
- standstill: true
186
- }]
187
- };
188
- }
189
- };
190
- //#endregion
191
- //#region src/lib/mock/getMotionGroupDescription.ts
192
- const getMotionGroupDescription = {
193
- method: "GET",
194
- path: "/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description",
195
- handle() {
196
- return {
197
- motion_group_model: "UniversalRobots_UR5e",
198
- mounting: {
199
- position: [
200
- 0,
201
- 0,
202
- 0
203
- ],
204
- orientation: [
205
- 0,
206
- 0,
207
- 0
208
- ]
209
- },
210
- tcps: { Flange: {
211
- name: "Default-Flange",
212
- pose: {
213
- position: [
214
- 0,
215
- 0,
216
- 0
217
- ],
218
- orientation: [
219
- 0,
220
- 0,
221
- 0
222
- ]
223
- }
224
- } },
225
- payloads: { "FPay-0": {
226
- name: "FPay-0",
227
- payload: 0,
228
- center_of_mass: [
229
- 0,
230
- 0,
231
- 0
232
- ],
233
- moment_of_inertia: [
234
- 0,
235
- 0,
236
- 0
237
- ]
238
- } },
239
- cycle_time: 8,
240
- dh_parameters: [
241
- {
242
- alpha: 1.5707963267948966,
243
- d: 162.25
244
- },
245
- { a: -425 },
246
- { a: -392.2 },
247
- {
248
- alpha: 1.5707963267948966,
249
- d: 133.3
250
- },
251
- {
252
- alpha: -1.5707963267948966,
253
- d: 99.7
254
- },
255
- { d: 99.6 }
256
- ],
257
- operation_limits: {
258
- auto_limits: {
259
- joints: [
260
- {
261
- position: {
262
- lower_limit: -6.283185307179586,
263
- upper_limit: 6.283185307179586
264
- },
265
- velocity: 3.34159255027771,
266
- acceleration: 40,
267
- torque: 150
268
- },
269
- {
270
- position: {
271
- lower_limit: -6.283185307179586,
272
- upper_limit: 6.283185307179586
273
- },
274
- velocity: 3.34159255027771,
275
- acceleration: 40,
276
- torque: 150
277
- },
278
- {
279
- position: {
280
- lower_limit: -6.283185307179586,
281
- upper_limit: 6.283185307179586
282
- },
283
- velocity: 3.34159255027771,
284
- acceleration: 40,
285
- torque: 150
286
- },
287
- {
288
- position: {
289
- lower_limit: -6.283185307179586,
290
- upper_limit: 6.283185307179586
291
- },
292
- velocity: 3.34159255027771,
293
- acceleration: 40,
294
- torque: 28
295
- },
296
- {
297
- position: {
298
- lower_limit: -6.283185307179586,
299
- upper_limit: 6.283185307179586
300
- },
301
- velocity: 3.34159255027771,
302
- acceleration: 40,
303
- torque: 28
304
- },
305
- {
306
- position: {
307
- lower_limit: -6.283185307179586,
308
- upper_limit: 6.283185307179586
309
- },
310
- velocity: 3.34159255027771,
311
- acceleration: 40,
312
- torque: 28
313
- }
314
- ],
315
- tcp: { velocity: 5e3 },
316
- elbow: { velocity: 5e3 },
317
- flange: { velocity: 5e3 }
318
- },
319
- manual_limits: {
320
- joints: [
321
- {
322
- position: {
323
- lower_limit: -6.283185307179586,
324
- upper_limit: 6.283185307179586
325
- },
326
- velocity: 3.34159255027771,
327
- acceleration: 40,
328
- torque: 150
329
- },
330
- {
331
- position: {
332
- lower_limit: -6.283185307179586,
333
- upper_limit: 6.283185307179586
334
- },
335
- velocity: 3.34159255027771,
336
- acceleration: 40,
337
- torque: 150
338
- },
339
- {
340
- position: {
341
- lower_limit: -6.283185307179586,
342
- upper_limit: 6.283185307179586
343
- },
344
- velocity: 3.34159255027771,
345
- acceleration: 40,
346
- torque: 150
347
- },
348
- {
349
- position: {
350
- lower_limit: -6.283185307179586,
351
- upper_limit: 6.283185307179586
352
- },
353
- velocity: 3.34159255027771,
354
- acceleration: 40,
355
- torque: 28
356
- },
357
- {
358
- position: {
359
- lower_limit: -6.283185307179586,
360
- upper_limit: 6.283185307179586
361
- },
362
- velocity: 3.34159255027771,
363
- acceleration: 40,
364
- torque: 28
365
- },
366
- {
367
- position: {
368
- lower_limit: -6.283185307179586,
369
- upper_limit: 6.283185307179586
370
- },
371
- velocity: 3.34159255027771,
372
- acceleration: 40,
373
- torque: 28
374
- }
375
- ],
376
- tcp: { velocity: 5e3 }
377
- },
378
- manual_t1_limits: {
379
- joints: [
380
- {
381
- position: {
382
- lower_limit: -6.283185307179586,
383
- upper_limit: 6.283185307179586
384
- },
385
- velocity: 3.34159255027771,
386
- acceleration: 40,
387
- torque: 150
388
- },
389
- {
390
- position: {
391
- lower_limit: -6.283185307179586,
392
- upper_limit: 6.283185307179586
393
- },
394
- velocity: 3.34159255027771,
395
- acceleration: 40,
396
- torque: 150
397
- },
398
- {
399
- position: {
400
- lower_limit: -6.283185307179586,
401
- upper_limit: 6.283185307179586
402
- },
403
- velocity: 3.34159255027771,
404
- acceleration: 40,
405
- torque: 150
406
- },
407
- {
408
- position: {
409
- lower_limit: -6.283185307179586,
410
- upper_limit: 6.283185307179586
411
- },
412
- velocity: 3.34159255027771,
413
- acceleration: 40,
414
- torque: 28
415
- },
416
- {
417
- position: {
418
- lower_limit: -6.283185307179586,
419
- upper_limit: 6.283185307179586
420
- },
421
- velocity: 3.34159255027771,
422
- acceleration: 40,
423
- torque: 28
424
- },
425
- {
426
- position: {
427
- lower_limit: -6.283185307179586,
428
- upper_limit: 6.283185307179586
429
- },
430
- velocity: 3.34159255027771,
431
- acceleration: 40,
432
- torque: 28
433
- }
434
- ],
435
- tcp: { velocity: 5e3 }
436
- },
437
- manual_t2_limits: {
438
- joints: [
439
- {
440
- position: {
441
- lower_limit: -6.283185307179586,
442
- upper_limit: 6.283185307179586
443
- },
444
- velocity: 3.34159255027771,
445
- acceleration: 40,
446
- torque: 150
447
- },
448
- {
449
- position: {
450
- lower_limit: -6.283185307179586,
451
- upper_limit: 6.283185307179586
452
- },
453
- velocity: 3.34159255027771,
454
- acceleration: 40,
455
- torque: 150
456
- },
457
- {
458
- position: {
459
- lower_limit: -6.283185307179586,
460
- upper_limit: 6.283185307179586
461
- },
462
- velocity: 3.34159255027771,
463
- acceleration: 40,
464
- torque: 150
465
- },
466
- {
467
- position: {
468
- lower_limit: -6.283185307179586,
469
- upper_limit: 6.283185307179586
470
- },
471
- velocity: 3.34159255027771,
472
- acceleration: 40,
473
- torque: 28
474
- },
475
- {
476
- position: {
477
- lower_limit: -6.283185307179586,
478
- upper_limit: 6.283185307179586
479
- },
480
- velocity: 3.34159255027771,
481
- acceleration: 40,
482
- torque: 28
483
- },
484
- {
485
- position: {
486
- lower_limit: -6.283185307179586,
487
- upper_limit: 6.283185307179586
488
- },
489
- velocity: 3.34159255027771,
490
- acceleration: 40,
491
- torque: 28
492
- }
493
- ],
494
- tcp: { velocity: 5e3 }
495
- }
496
- },
497
- serial_number: "WBVirtualRobot"
498
- };
499
- }
500
- };
501
- //#endregion
502
- //#region src/lib/mock/getMotionGroupKinematicModel.ts
503
- const getMotionGroupKinematicModel = {
504
- method: "GET",
505
- path: "/motion-group-models/:motionGroupModel/kinematic",
506
- handle() {
507
- return {
508
- dh_parameters: [
509
- {
510
- alpha: 1.5707963267948966,
511
- theta: 0,
512
- a: 0,
513
- d: 162.25,
514
- reverse_rotation_direction: false
515
- },
516
- {
517
- alpha: 0,
518
- theta: 0,
519
- a: -425,
520
- d: 0,
521
- reverse_rotation_direction: false
522
- },
523
- {
524
- alpha: 0,
525
- theta: 0,
526
- a: -392.2,
527
- d: 0,
528
- reverse_rotation_direction: false
529
- },
530
- {
531
- alpha: 1.5707963267948966,
532
- theta: 0,
533
- a: 0,
534
- d: 133.3,
535
- reverse_rotation_direction: false
536
- },
537
- {
538
- alpha: -1.5707963267948966,
539
- theta: 0,
540
- a: 0,
541
- d: 99.7,
542
- reverse_rotation_direction: false
543
- },
544
- {
545
- alpha: 0,
546
- theta: 0,
547
- a: 0,
548
- d: 99.6,
549
- reverse_rotation_direction: false
550
- }
551
- ],
552
- inverse_solver: "Universalrobots"
553
- };
554
- }
555
- };
556
- //#endregion
557
- //#region src/lib/mock/getRobotController.ts
558
- const getRobotController = {
559
- method: "GET",
560
- path: "/cells/:cellId/controllers/:controllerId",
561
- handle() {
562
- return {
563
- configuration: {
564
- initial_joint_position: "[0,-1.571,-1.571,-1.571,1.571,-1.571,0]",
565
- kind: "VirtualController",
566
- manufacturer: "universalrobots",
567
- type: "universalrobots-ur5e"
568
- },
569
- name: "mock-ur5"
570
- };
571
- }
572
- };
573
- //#endregion
574
- //#region src/lib/mock/listCoordinateSystems.ts
575
- const listCoordinateSystems = {
576
- method: "GET",
577
- path: "/cells/:cellId/controllers/:controllerId/coordinate-systems",
578
- handle() {
579
- return [{
580
- coordinate_system: "",
581
- name: "world",
582
- reference_coordinate_system: "",
583
- position: [
584
- 0,
585
- 0,
586
- 0
587
- ],
588
- orientation: [
589
- 0,
590
- 0,
591
- 0
592
- ],
593
- orientation_type: "ROTATION_VECTOR"
594
- }, {
595
- coordinate_system: "CS-0",
596
- name: "Default-CS",
597
- reference_coordinate_system: "",
598
- position: [
599
- 0,
600
- 0,
601
- 0
602
- ],
603
- orientation: [
604
- 0,
605
- 0,
606
- 0
607
- ],
608
- orientation_type: "ROTATION_VECTOR"
609
- }];
610
- }
611
- };
612
- //#endregion
613
- //#region src/lib/mock/listRobotControllers.ts
614
- const listRobotControllers = {
615
- method: "GET",
616
- path: "/cells/:cellId/controllers",
617
- handle() {
618
- return ["mock-ur5e"];
619
- }
620
- };
621
- //#endregion
622
- //#region src/lib/mock/MockNovaInstance.ts
623
- /**
624
- * Ultra-simplified mock Nova server for testing stuff
625
- */
626
- var MockNovaInstance = class {
627
- connections = [];
628
- async handleAPIRequest(config) {
629
- const apiHandlers = [
630
- listRobotControllers,
631
- getRobotController,
632
- getMotionGroupDescription,
633
- getCurrentRobotControllerState,
634
- listCoordinateSystems,
635
- getMotionGroupKinematicModel
636
- ];
637
- const method = config.method?.toUpperCase() || "GET";
638
- if (!config.url) throw new Error("No url sent with request");
639
- const path = config.url.split("?")[0] ?? config.url;
640
- for (const handler of apiHandlers) {
641
- const match = path_to_regexp.match(handler.path)(path);
642
- if (method === handler.method && match) {
643
- const json = handler.handle();
644
- return {
645
- status: 200,
646
- statusText: "Success",
647
- data: JSON.stringify(json),
648
- headers: {},
649
- config,
650
- request: { responseURL: config.url }
651
- };
652
- }
653
- }
654
- throw new axios.AxiosError(`No mock handler matched this request: ${method} ${path}`, "404", config);
655
- }
656
- handleWebsocketConnection(socket) {
657
- this.connections.push(socket);
658
- setTimeout(() => {
659
- socket.dispatchEvent(new Event("open"));
660
- console.log("Websocket connection opened from", socket.url);
661
- if (socket.url.includes("/state-stream")) socket.dispatchEvent(new MessageEvent("message", { data: JSON.stringify(defaultMotionState) }));
662
- if (socket.url.includes("/execution/jogging")) socket.dispatchEvent(new MessageEvent("message", { data: JSON.stringify({ result: {
663
- message: "string",
664
- kind: "INITIALIZE_RECEIVED"
665
- } }) }));
666
- }, 10);
667
- }
668
- handleWebsocketMessage(socket, message) {
669
- console.log(`Received message on ${socket.url}`, message);
670
- }
671
- };
672
- const defaultMotionState = { result: {
673
- motion_group: "0@universalrobots-ur5e",
674
- controller: "universalrobots-ur5e",
675
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
676
- sequence_number: 1,
677
- joint_position: [
678
- 1.1699999570846558,
679
- -1.5700000524520874,
680
- 1.3600000143051147,
681
- 1.0299999713897705,
682
- 1.2899999618530273,
683
- 1.2799999713897705
684
- ],
685
- joint_limit_reached: { limit_reached: [
686
- false,
687
- false,
688
- false,
689
- false,
690
- false,
691
- false
692
- ] },
693
- standstill: false,
694
- flange_pose: {
695
- position: [
696
- 1.3300010259703043,
697
- -409.2680714682808,
698
- 531.0203477065281
699
- ],
700
- orientation: [
701
- 1.7564919306270736,
702
- -1.7542521568325058,
703
- .7326972590614671
704
- ]
705
- },
706
- tcp_pose: {
707
- position: [
708
- 1.3300010259703043,
709
- -409.2680714682808,
710
- 531.0203477065281
711
- ],
712
- orientation: [
713
- 1.7564919306270736,
714
- -1.7542521568325058,
715
- .7326972590614671
716
- ]
717
- },
718
- description_revision: 0
719
- } };
720
- //#endregion
721
- //#region src/lib/deprecated/v2/NovaClient.ts
722
- /**
723
- * Client for connecting to a Nova instance and controlling robots.
724
- * @deprecated Use `Nova` from `@wandelbots/nova-js/v2` instead.
725
- */
726
- var NovaClient = class {
727
- api;
728
- config;
729
- mock;
730
- instanceUrl;
731
- authPromise = null;
732
- accessToken = null;
733
- constructor(config) {
734
- const cellId = config.cellId ?? "cell";
735
- this.config = {
736
- cellId,
737
- ...config
738
- };
739
- this.accessToken = config.accessToken || require_context.availableStorage.getString("wbjs.access_token") || null;
740
- if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
741
- this.instanceUrl = require_converters.parseNovaInstanceUrl(this.config.instanceUrl);
742
- const axiosInstance = axios.default.create({
743
- baseURL: new URL("/api/v2", this.instanceUrl).href,
744
- headers: require_context.isLocalhostDev ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
745
- });
746
- axiosInstance.interceptors.request.use(async (request) => {
747
- if (!request.headers.Authorization) {
748
- if (this.accessToken) request.headers.Authorization = `Bearer ${this.accessToken}`;
749
- else if (this.config.username && this.config.password) request.headers.Authorization = `Basic ${btoa(`${config.username}:${config.password}`)}`;
750
- }
751
- return request;
752
- });
753
- if (typeof window !== "undefined") axiosInstance.interceptors.response.use((r) => r, async (error) => {
754
- if ((0, axios.isAxiosError)(error)) {
755
- if (error.response?.status === 401) try {
756
- await this.renewAuthentication();
757
- if (error.config) {
758
- if (this.accessToken) error.config.headers.Authorization = `Bearer ${this.accessToken}`;
759
- else delete error.config.headers.Authorization;
760
- return axiosInstance.request(error.config);
761
- }
762
- } catch (err) {
763
- return Promise.reject(err);
764
- }
765
- else if (error.response?.status === 503) {
766
- if ((await fetch(window.location.href)).status === 503) return require_context.guardedPageReload("503_server_unavailable");
767
- }
768
- }
769
- return Promise.reject(error);
770
- });
771
- this.api = new NovaCellAPIClient(cellId, {
772
- ...config,
773
- basePath: new URL("/api/v2", this.instanceUrl).href,
774
- isJsonMime: (mime) => {
775
- return mime === "application/json";
776
- },
777
- baseOptions: {
778
- ...this.mock ? { adapter: (config) => {
779
- return this.mock.handleAPIRequest(config);
780
- } } : {},
781
- ...config.baseOptions
782
- },
783
- axiosInstance
784
- });
785
- }
786
- async renewAuthentication() {
787
- if (this.authPromise) return;
788
- const storedToken = require_context.availableStorage.getString("wbjs.access_token");
789
- if (storedToken && this.accessToken !== storedToken) {
790
- this.accessToken = storedToken;
791
- return;
792
- }
793
- this.authPromise = require_context.loginWithAuth0(this.instanceUrl);
794
- try {
795
- this.accessToken = await this.authPromise;
796
- if (this.accessToken) require_context.availableStorage.setString("wbjs.access_token", this.accessToken);
797
- else require_context.availableStorage.delete("wbjs.access_token");
798
- } finally {
799
- this.authPromise = null;
800
- }
801
- }
802
- makeWebsocketURL(path) {
803
- const url = new URL(new URL(`/api/v2/cells/${this.config.cellId}/${path.replace(/^\/+/, "")}`, this.instanceUrl).href);
804
- url.protocol = url.protocol.replace("http", "ws");
805
- url.protocol = url.protocol.replace("https", "wss");
806
- if (this.accessToken) url.searchParams.append("token", this.accessToken);
807
- else if (this.config.username && this.config.password) {
808
- url.username = this.config.username;
809
- url.password = this.config.password;
810
- }
811
- return url.toString();
812
- }
813
- /**
814
- * Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.
815
- * If you explicitly want to reconnect an existing websocket, call `reconnect`
816
- * on the returned object.
817
- */
818
- openReconnectingWebsocket(path) {
819
- return new require_context.AutoReconnectingWebsocket(this.makeWebsocketURL(path), { mock: this.mock });
820
- }
821
- };
822
- //#endregion
823
- //#region src/lib/deprecated/v2/wandelscriptUtils.ts
824
- /**
825
- * Convert a Pose object representing a motion group position
826
- * into a string which represents that pose in Wandelscript.
827
- * @deprecated Wandelscript usage is deprecated; switching to Python is recommended.
828
- */
829
- function poseToWandelscriptString(pose) {
830
- const position = [
831
- pose.position?.[0] ?? 0,
832
- pose.position?.[1] ?? 0,
833
- pose.position?.[2] ?? 0
834
- ];
835
- const orientation = [
836
- pose.orientation?.[0] ?? 0,
837
- pose.orientation?.[1] ?? 0,
838
- pose.orientation?.[2] ?? 0
839
- ];
840
- const positionValues = position.map((v) => v.toFixed(1));
841
- const rotationValues = orientation.map((v) => v.toFixed(4));
842
- return `(${positionValues.concat(rotationValues).join(", ")})`;
843
- }
844
- //#endregion
845
- //#region src/lib/NovaAPIClient.ts
846
- function unwrap(ApiConstructor, opts) {
847
- const apiClient = new ApiConstructor({
848
- ...opts,
849
- isJsonMime: (mime) => mime === "application/json"
850
- }, opts.basePath ?? "", opts.axiosInstance ?? axios.default.create());
851
- for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient))) if (key !== "constructor" && typeof apiClient[key] === "function") {
852
- const originalFunction = apiClient[key];
853
- apiClient[key] = (...args) => originalFunction.apply(apiClient, args).then((res) => res.data);
854
- }
855
- return apiClient;
856
- }
857
- /**
858
- * API client providing type-safe access to all the endpoints of a NOVA
859
- * instance.
860
- */
861
- var NovaAPIClient = class {
862
- opts;
863
- application;
864
- busIOs;
865
- cell;
866
- controller;
867
- controllerIOs;
868
- jogging;
869
- kinematics;
870
- license;
871
- motionGroup;
872
- motionGroupModels;
873
- novaCloud;
874
- program;
875
- robotConfigurations;
876
- session;
877
- storeCollisionComponents;
878
- storeCollisionSetups;
879
- storeObject;
880
- system;
881
- trajectoryCaching;
882
- trajectoryExecution;
883
- trajectoryPlanning;
884
- version;
885
- virtualController;
886
- virtualControllerBehavior;
887
- virtualControllerIOs;
888
- constructor(opts) {
889
- this.opts = opts;
890
- this.application = unwrap(_wandelbots_nova_api_v2.ApplicationApi, opts);
891
- this.busIOs = unwrap(_wandelbots_nova_api_v2.BUSInputsOutputsApi, opts);
892
- this.cell = unwrap(_wandelbots_nova_api_v2.CellApi, opts);
893
- this.controller = unwrap(_wandelbots_nova_api_v2.ControllerApi, opts);
894
- this.controllerIOs = unwrap(_wandelbots_nova_api_v2.ControllerInputsOutputsApi, opts);
895
- this.jogging = unwrap(_wandelbots_nova_api_v2.JoggingApi, opts);
896
- this.kinematics = unwrap(_wandelbots_nova_api_v2.KinematicsApi, opts);
897
- this.license = unwrap(_wandelbots_nova_api_v2.LicenseApi, opts);
898
- this.motionGroup = unwrap(_wandelbots_nova_api_v2.MotionGroupApi, opts);
899
- this.motionGroupModels = unwrap(_wandelbots_nova_api_v2.MotionGroupModelsApi, opts);
900
- this.novaCloud = unwrap(_wandelbots_nova_api_v2.NOVACloudApi, opts);
901
- this.program = unwrap(_wandelbots_nova_api_v2.ProgramApi, opts);
902
- this.robotConfigurations = unwrap(_wandelbots_nova_api_v2.RobotConfigurationsApi, opts);
903
- this.session = unwrap(_wandelbots_nova_api_v2.SessionApi, opts);
904
- this.storeCollisionComponents = unwrap(_wandelbots_nova_api_v2.StoreCollisionComponentsApi, opts);
905
- this.storeCollisionSetups = unwrap(_wandelbots_nova_api_v2.StoreCollisionSetupsApi, opts);
906
- this.storeObject = unwrap(_wandelbots_nova_api_v2.StoreObjectApi, opts);
907
- this.system = unwrap(_wandelbots_nova_api_v2.SystemApi, opts);
908
- this.trajectoryCaching = unwrap(_wandelbots_nova_api_v2.TrajectoryCachingApi, opts);
909
- this.trajectoryExecution = unwrap(_wandelbots_nova_api_v2.TrajectoryExecutionApi, opts);
910
- this.trajectoryPlanning = unwrap(_wandelbots_nova_api_v2.TrajectoryPlanningApi, opts);
911
- this.version = unwrap(_wandelbots_nova_api_v2.VersionApi, opts);
912
- this.virtualController = unwrap(_wandelbots_nova_api_v2.VirtualControllerApi, opts);
913
- this.virtualControllerBehavior = unwrap(_wandelbots_nova_api_v2.VirtualControllerBehaviorApi, opts);
914
- this.virtualControllerIOs = unwrap(_wandelbots_nova_api_v2.VirtualControllerInputsOutputsApi, opts);
915
- }
916
- };
917
- //#endregion
918
- //#region src/lib/Nova.ts
919
- /**
920
- *
921
- * Client for connecting to a NOVA instance and controlling robots.
922
- */
923
- var Nova = class {
924
- api;
925
- config;
926
- mock;
927
- instanceUrl;
928
- authPromise = null;
929
- accessToken = null;
930
- constructor(config) {
931
- this.config = config;
932
- this.accessToken = config.accessToken || require_context.availableStorage.getString("wbjs.access_token") || null;
933
- if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
934
- this.instanceUrl = require_converters.parseNovaInstanceUrl(this.config.instanceUrl);
935
- const axiosInstance = axios.default.create({
936
- baseURL: new URL("/api/v2", this.instanceUrl).href,
937
- headers: require_context.isLocalhostDev ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
938
- });
939
- axiosInstance.interceptors.request.use(async (request) => {
940
- if (!request.headers.Authorization) {
941
- if (this.accessToken) request.headers.Authorization = `Bearer ${this.accessToken}`;
942
- }
943
- return request;
944
- });
945
- if (typeof window !== "undefined") axiosInstance.interceptors.response.use((r) => r, async (error) => {
946
- if ((0, axios.isAxiosError)(error)) {
947
- if (error.response?.status === 401) try {
948
- await this.renewAuthentication();
949
- if (error.config) {
950
- if (this.accessToken) error.config.headers.Authorization = `Bearer ${this.accessToken}`;
951
- else delete error.config.headers.Authorization;
952
- return axiosInstance.request(error.config);
953
- }
954
- } catch (err) {
955
- return Promise.reject(err);
956
- }
957
- else if (error.response?.status === 403 && !error.config?.url?.split(/[?#]/)[0]?.endsWith("/session")) {
958
- let redirectToAccessDenied = false;
959
- try {
960
- const session = await this.api.session.getSession();
961
- if (session.session_id !== "default" && session.capabilities.length === 0) redirectToAccessDenied = true;
962
- } catch (sessionError) {
963
- if ((0, axios.isAxiosError)(sessionError) && sessionError.response?.status === 403) redirectToAccessDenied = true;
964
- }
965
- if (redirectToAccessDenied) {
966
- window.location.href = this.instanceUrl.href;
967
- return new Promise(() => {});
968
- }
969
- } else if (error.response?.status === 503) {
970
- if ((await fetch(window.location.href)).status === 503) return require_context.guardedPageReload("503_server_unavailable");
971
- }
972
- }
973
- return Promise.reject(error);
974
- });
975
- this.api = new NovaAPIClient({
976
- ...config,
977
- basePath: new URL("/api/v2", this.instanceUrl).href,
978
- isJsonMime: (mime) => {
979
- return mime === "application/json";
980
- },
981
- baseOptions: {
982
- ...this.mock ? { adapter: (config) => {
983
- if (!this.mock) throw new Error("Mock adapter used without a mock instance");
984
- return this.mock.handleAPIRequest(config);
985
- } } : {},
986
- ...config.baseOptions
987
- },
988
- axiosInstance
989
- });
990
- }
991
- async renewAuthentication() {
992
- if (this.authPromise) return;
993
- const storedToken = require_context.availableStorage.getString("wbjs.access_token");
994
- if (storedToken && this.accessToken !== storedToken) {
995
- this.accessToken = storedToken;
996
- return;
997
- }
998
- this.authPromise = require_context.loginWithAuth0(this.instanceUrl);
999
- try {
1000
- this.accessToken = await this.authPromise;
1001
- if (this.accessToken) require_context.availableStorage.setString("wbjs.access_token", this.accessToken);
1002
- else require_context.availableStorage.delete("wbjs.access_token");
1003
- } finally {
1004
- this.authPromise = null;
1005
- }
1006
- }
1007
- makeWebsocketURL(path) {
1008
- const url = new URL(`/api/v2/${path.replace(/^\/+/, "")}`, this.instanceUrl);
1009
- url.protocol = url.protocol.replace("http", "ws");
1010
- url.protocol = url.protocol.replace("https", "wss");
1011
- if (this.accessToken) url.searchParams.append("token", this.accessToken);
1012
- return url.toString();
1013
- }
1014
- /**
1015
- * Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.
1016
- * If you explicitly want to reconnect an existing websocket, call `reconnect`
1017
- * on the returned object.
1018
- */
1019
- openReconnectingWebsocket(path) {
1020
- return new require_context.AutoReconnectingWebsocket(this.makeWebsocketURL(path), { mock: this.mock });
1021
- }
1022
- };
1023
- //#endregion
1024
- exports.Nova = Nova;
1025
- exports.NovaAPIClient = NovaAPIClient;
1026
- exports.NovaCellAPIClient = NovaCellAPIClient;
1027
- exports.NovaClient = NovaClient;
1028
- exports.poseToWandelscriptString = poseToWandelscriptString;
1029
- Object.keys(_wandelbots_nova_api_v2).forEach(function(k) {
1030
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1031
- enumerable: true,
1032
- get: function() {
1033
- return _wandelbots_nova_api_v2[k];
1034
- }
1035
- });
1036
- });
1037
-
1038
- //# sourceMappingURL=index.cjs.map