roboto-js 1.1.6 → 1.1.8

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.
@@ -107,21 +107,22 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
107
107
  return _context2.abrupt("return", this._handleError(response));
108
108
  case 7:
109
109
  this.iac_session = response.data;
110
+ this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
110
111
  // update axios instance headers with authtoken
111
112
  this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
112
113
  if (typeof localStorage != 'undefined') {
113
114
  localStorage.setItem('authtoken', response.data.authToken);
114
115
  }
115
116
  return _context2.abrupt("return", response.data);
116
- case 13:
117
- _context2.prev = 13;
117
+ case 14:
118
+ _context2.prev = 14;
118
119
  _context2.t0 = _context2["catch"](0);
119
120
  this._handleError(_context2.t0);
120
- case 16:
121
+ case 17:
121
122
  case "end":
122
123
  return _context2.stop();
123
124
  }
124
- }, _callee2, this, [[0, 13]]);
125
+ }, _callee2, this, [[0, 14]]);
125
126
  }));
126
127
  function login(_x) {
127
128
  return _login.apply(this, arguments);
@@ -149,6 +150,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
149
150
  case 6:
150
151
  // Clear the iac_session and remove the auth token from axios headers
151
152
  this.iac_session = null;
153
+ this.currentUser = null;
152
154
  if (this.axios.defaults.headers.common['authtoken']) {
153
155
  delete this.axios.defaults.headers.common['authtoken'];
154
156
  }
@@ -160,15 +162,15 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
160
162
 
161
163
  // Return some kind of success response or the response from the server
162
164
  return _context3.abrupt("return", response.data);
163
- case 12:
164
- _context3.prev = 12;
165
+ case 13:
166
+ _context3.prev = 13;
165
167
  _context3.t0 = _context3["catch"](0);
166
168
  this._handleError(_context3.t0);
167
- case 15:
169
+ case 16:
168
170
  case "end":
169
171
  return _context3.stop();
170
172
  }
171
- }, _callee3, this, [[0, 12]]);
173
+ }, _callee3, this, [[0, 13]]);
172
174
  }));
173
175
  function logout() {
174
176
  return _logout.apply(this, arguments);
@@ -179,34 +181,42 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
179
181
  key: "loadCurrentUser",
180
182
  value: function () {
181
183
  var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
182
- var params, _response$data, response, userData, User;
184
+ var response;
183
185
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
184
186
  while (1) switch (_context4.prev = _context4.next) {
185
187
  case 0:
186
- // TODO - get the actual user from the session
187
- params = {
188
- id: 'superuser_tom'
189
- };
190
- _context4.prev = 1;
191
- _context4.next = 4;
192
- return this.axios.post('/user_service/loadUser', [params]);
193
- case 4:
188
+ _context4.prev = 0;
189
+ if (!this.currentUser) {
190
+ _context4.next = 3;
191
+ break;
192
+ }
193
+ return _context4.abrupt("return", this.currentUser);
194
+ case 3:
195
+ if (!this.authtoken) {
196
+ _context4.next = 10;
197
+ break;
198
+ }
199
+ _context4.next = 6;
200
+ return this.refreshAuthToken(this.authtoken);
201
+ case 6:
194
202
  response = _context4.sent;
195
- userData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.user;
196
- User = new _rbt_user["default"]({
197
- id: userData.id
203
+ this.currentUser = new _rbt_user["default"]({
204
+ id: response.user.id
198
205
  }, this.axios);
199
- User.setData(userData);
200
- return _context4.abrupt("return", User);
201
- case 11:
202
- _context4.prev = 11;
203
- _context4.t0 = _context4["catch"](1);
204
- return _context4.abrupt("return", this._handleError(_context4.t0));
206
+ this.currentUser.setData(response.user);
207
+ return _context4.abrupt("return", this.currentUser);
208
+ case 10:
209
+ this.currentUser = null;
210
+ return _context4.abrupt("return", null);
205
211
  case 14:
212
+ _context4.prev = 14;
213
+ _context4.t0 = _context4["catch"](0);
214
+ return _context4.abrupt("return", this._handleError(_context4.t0));
215
+ case 17:
206
216
  case "end":
207
217
  return _context4.stop();
208
218
  }
209
- }, _callee4, this, [[1, 11]]);
219
+ }, _callee4, this, [[0, 14]]);
210
220
  }));
211
221
  function loadCurrentUser() {
212
222
  return _loadCurrentUser.apply(this, arguments);
@@ -214,38 +224,76 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
214
224
  return loadCurrentUser;
215
225
  }()
216
226
  }, {
217
- key: "loadUser",
227
+ key: "confirmUserEmail",
218
228
  value: function () {
219
- var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(userId) {
220
- var params, _response$data2, response, userData, User;
229
+ var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(confirmCode) {
230
+ var params, response;
221
231
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
222
232
  while (1) switch (_context5.prev = _context5.next) {
223
233
  case 0:
224
234
  params = {
225
- id: userId
235
+ emailConfirmCode: confirmCode
226
236
  };
227
237
  _context5.prev = 1;
228
238
  _context5.next = 4;
229
- return this.axios.post('/user_service/loadUser', [params]);
239
+ return this.axios.post('/user_service/confirmUserEmail', [params]);
230
240
  case 4:
231
241
  response = _context5.sent;
232
- userData = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.user;
242
+ if (!(response.data.ok === false)) {
243
+ _context5.next = 7;
244
+ break;
245
+ }
246
+ return _context5.abrupt("return", this._handleError(response));
247
+ case 7:
248
+ return _context5.abrupt("return", response.data);
249
+ case 10:
250
+ _context5.prev = 10;
251
+ _context5.t0 = _context5["catch"](1);
252
+ return _context5.abrupt("return", this._handleError(_context5.t0));
253
+ case 13:
254
+ case "end":
255
+ return _context5.stop();
256
+ }
257
+ }, _callee5, this, [[1, 10]]);
258
+ }));
259
+ function confirmUserEmail(_x2) {
260
+ return _confirmUserEmail.apply(this, arguments);
261
+ }
262
+ return confirmUserEmail;
263
+ }()
264
+ }, {
265
+ key: "loadUser",
266
+ value: function () {
267
+ var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) {
268
+ var params, _response$data, response, userData, User;
269
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
270
+ while (1) switch (_context6.prev = _context6.next) {
271
+ case 0:
272
+ params = {
273
+ id: userId
274
+ };
275
+ _context6.prev = 1;
276
+ _context6.next = 4;
277
+ return this.axios.post('/user_service/loadUser', [params]);
278
+ case 4:
279
+ response = _context6.sent;
280
+ userData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.user;
233
281
  User = new _rbt_user["default"]({
234
282
  id: userData.id
235
283
  }, this.axios);
236
284
  User.setData(userData);
237
- return _context5.abrupt("return", User);
285
+ return _context6.abrupt("return", User);
238
286
  case 11:
239
- _context5.prev = 11;
240
- _context5.t0 = _context5["catch"](1);
241
- return _context5.abrupt("return", this._handleError(_context5.t0));
287
+ _context6.prev = 11;
288
+ _context6.t0 = _context6["catch"](1);
289
+ return _context6.abrupt("return", this._handleError(_context6.t0));
242
290
  case 14:
243
291
  case "end":
244
- return _context5.stop();
292
+ return _context6.stop();
245
293
  }
246
- }, _callee5, this, [[1, 11]]);
294
+ }, _callee6, this, [[1, 11]]);
247
295
  }));
248
- function loadUser(_x2) {
296
+ function loadUser(_x3) {
249
297
  return _loadUser.apply(this, arguments);
250
298
  }
251
299
  return loadUser;
@@ -253,28 +301,29 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
253
301
  }, {
254
302
  key: "refreshAuthToken",
255
303
  value: function () {
256
- var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(authtoken) {
304
+ var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(authtoken) {
257
305
  var response;
258
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
259
- while (1) switch (_context6.prev = _context6.next) {
306
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
307
+ while (1) switch (_context7.prev = _context7.next) {
260
308
  case 0:
261
- _context6.prev = 0;
262
- _context6.next = 3;
309
+ _context7.prev = 0;
310
+ _context7.next = 3;
263
311
  return this.axios.post('/user_service/refreshAuthToken', [authtoken]);
264
312
  case 3:
265
- response = _context6.sent;
266
- return _context6.abrupt("return", response.data);
267
- case 7:
268
- _context6.prev = 7;
269
- _context6.t0 = _context6["catch"](0);
270
- this._handleError(_context6.t0);
271
- case 10:
313
+ response = _context7.sent;
314
+ debugger;
315
+ return _context7.abrupt("return", response.data);
316
+ case 8:
317
+ _context7.prev = 8;
318
+ _context7.t0 = _context7["catch"](0);
319
+ this._handleError(_context7.t0);
320
+ case 11:
272
321
  case "end":
273
- return _context6.stop();
322
+ return _context7.stop();
274
323
  }
275
- }, _callee6, this, [[0, 7]]);
324
+ }, _callee7, this, [[0, 8]]);
276
325
  }));
277
- function refreshAuthToken(_x3) {
326
+ function refreshAuthToken(_x4) {
278
327
  return _refreshAuthToken.apply(this, arguments);
279
328
  }
280
329
  return refreshAuthToken;
@@ -289,35 +338,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
289
338
  }, {
290
339
  key: "registerUser",
291
340
  value: function () {
292
- var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
341
+ var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
293
342
  var dataHash,
294
343
  response,
295
344
  record,
296
- _args7 = arguments;
297
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
298
- while (1) switch (_context7.prev = _context7.next) {
345
+ _args8 = arguments;
346
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
347
+ while (1) switch (_context8.prev = _context8.next) {
299
348
  case 0:
300
- dataHash = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
301
- _context7.prev = 1;
302
- _context7.next = 4;
349
+ dataHash = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
350
+ _context8.prev = 1;
351
+ _context8.next = 4;
303
352
  return this.axios.post('/user_service/registerUser', [dataHash]);
304
353
  case 4:
305
- response = _context7.sent;
354
+ response = _context8.sent;
306
355
  record = response.data;
307
- if (dataHash) {
308
- record.data = dataHash;
309
- }
310
- return _context7.abrupt("return", new _rbt_user["default"](record, this.axios));
311
- case 10:
312
- _context7.prev = 10;
313
- _context7.t0 = _context7["catch"](1);
356
+ return _context8.abrupt("return", new _rbt_user["default"](record, this.axios));
357
+ case 9:
358
+ _context8.prev = 9;
359
+ _context8.t0 = _context8["catch"](1);
314
360
  debugger;
315
- return _context7.abrupt("return", this._handleError(_context7.t0));
316
- case 14:
361
+ return _context8.abrupt("return", this._handleError(_context8.t0));
362
+ case 13:
317
363
  case "end":
318
- return _context7.stop();
364
+ return _context8.stop();
319
365
  }
320
- }, _callee7, this, [[1, 10]]);
366
+ }, _callee8, this, [[1, 9]]);
321
367
  }));
322
368
  function registerUser() {
323
369
  return _registerUser.apply(this, arguments);
@@ -334,32 +380,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
334
380
  }, {
335
381
  key: "createFile",
336
382
  value: function () {
337
- var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(dataHash) {
383
+ var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(dataHash) {
338
384
  var response, record;
339
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
340
- while (1) switch (_context8.prev = _context8.next) {
385
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
386
+ while (1) switch (_context9.prev = _context9.next) {
341
387
  case 0:
342
- _context8.prev = 0;
343
- _context8.next = 3;
388
+ _context9.prev = 0;
389
+ _context9.next = 3;
344
390
  return this.axios.post('/object_service/createObject', ['<@filekit.file>', dataHash]);
345
391
  case 3:
346
- response = _context8.sent;
392
+ response = _context9.sent;
347
393
  record = response.data;
348
394
  if (dataHash) {
349
395
  record.data = dataHash;
350
396
  }
351
- return _context8.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
397
+ return _context9.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
352
398
  case 9:
353
- _context8.prev = 9;
354
- _context8.t0 = _context8["catch"](0);
355
- return _context8.abrupt("return", this._handleError(_context8.t0));
399
+ _context9.prev = 9;
400
+ _context9.t0 = _context9["catch"](0);
401
+ return _context9.abrupt("return", this._handleError(_context9.t0));
356
402
  case 12:
357
403
  case "end":
358
- return _context8.stop();
404
+ return _context9.stop();
359
405
  }
360
- }, _callee8, this, [[0, 9]]);
406
+ }, _callee9, this, [[0, 9]]);
361
407
  }));
362
- function createFile(_x4) {
408
+ function createFile(_x5) {
363
409
  return _createFile.apply(this, arguments);
364
410
  }
365
411
  return createFile;
@@ -374,38 +420,38 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
374
420
  }, {
375
421
  key: "create",
376
422
  value: function () {
377
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(type) {
423
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(type) {
378
424
  var dataHash,
379
425
  response,
380
426
  record,
381
- _args9 = arguments;
382
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
383
- while (1) switch (_context9.prev = _context9.next) {
427
+ _args10 = arguments;
428
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
429
+ while (1) switch (_context10.prev = _context10.next) {
384
430
  case 0:
385
- dataHash = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {};
386
- _context9.prev = 1;
387
- _context9.next = 4;
431
+ dataHash = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
432
+ _context10.prev = 1;
433
+ _context10.next = 4;
388
434
  return this.axios.post('/object_service/createObject', [type, dataHash]);
389
435
  case 4:
390
- response = _context9.sent;
436
+ response = _context10.sent;
391
437
  record = response.data;
392
438
  if (dataHash) {
393
439
  record.data = dataHash;
394
440
  }
395
- return _context9.abrupt("return", new _rbt_object["default"](record, this.axios, {
441
+ return _context10.abrupt("return", new _rbt_object["default"](record, this.axios, {
396
442
  isNew: true
397
443
  }));
398
444
  case 10:
399
- _context9.prev = 10;
400
- _context9.t0 = _context9["catch"](1);
401
- return _context9.abrupt("return", this._handleError(_context9.t0));
445
+ _context10.prev = 10;
446
+ _context10.t0 = _context10["catch"](1);
447
+ return _context10.abrupt("return", this._handleError(_context10.t0));
402
448
  case 13:
403
449
  case "end":
404
- return _context9.stop();
450
+ return _context10.stop();
405
451
  }
406
- }, _callee9, this, [[1, 10]]);
452
+ }, _callee10, this, [[1, 10]]);
407
453
  }));
408
- function create(_x5) {
454
+ function create(_x6) {
409
455
  return _create.apply(this, arguments);
410
456
  }
411
457
  return create;
@@ -441,19 +487,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
441
487
  }, {
442
488
  key: "query",
443
489
  value: function () {
444
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(type) {
490
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type) {
445
491
  var _this = this;
446
492
  var params,
447
493
  defaultOrderBy,
448
494
  defaultLimit,
449
495
  mergedParams,
450
496
  response,
451
- _args10 = arguments;
452
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
453
- while (1) switch (_context10.prev = _context10.next) {
497
+ _args11 = arguments;
498
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
499
+ while (1) switch (_context11.prev = _context11.next) {
454
500
  case 0:
455
- params = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
456
- _context10.prev = 1;
501
+ params = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
502
+ _context11.prev = 1;
457
503
  params.type = type;
458
504
 
459
505
  // Default ordering and pagination
@@ -470,15 +516,15 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
470
516
  }
471
517
  }; // Merge defaults with provided params
472
518
  mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params);
473
- _context10.next = 8;
519
+ _context11.next = 8;
474
520
  return this.axios.post('/object_service/queryObjects', [mergedParams]);
475
521
  case 8:
476
- response = _context10.sent;
522
+ response = _context11.sent;
477
523
  if (!(response.data.ok === false)) {
478
- _context10.next = 11;
524
+ _context11.next = 11;
479
525
  break;
480
526
  }
481
- return _context10.abrupt("return", this._handleError(response));
527
+ return _context11.abrupt("return", this._handleError(response));
482
528
  case 11:
483
529
  // Process items into RbtObject instances
484
530
  if (Array.isArray(response.data.items)) {
@@ -488,18 +534,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
488
534
  });
489
535
  });
490
536
  }
491
- return _context10.abrupt("return", response.data.items);
537
+ return _context11.abrupt("return", response.data.items);
492
538
  case 15:
493
- _context10.prev = 15;
494
- _context10.t0 = _context10["catch"](1);
495
- return _context10.abrupt("return", this._handleError(_context10.t0));
539
+ _context11.prev = 15;
540
+ _context11.t0 = _context11["catch"](1);
541
+ return _context11.abrupt("return", this._handleError(_context11.t0));
496
542
  case 18:
497
543
  case "end":
498
- return _context10.stop();
544
+ return _context11.stop();
499
545
  }
500
- }, _callee10, this, [[1, 15]]);
546
+ }, _callee11, this, [[1, 15]]);
501
547
  }));
502
- function query(_x6) {
548
+ function query(_x7) {
503
549
  return _query.apply(this, arguments);
504
550
  }
505
551
  return query;
@@ -515,47 +561,47 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
515
561
  }, {
516
562
  key: "load",
517
563
  value: function () {
518
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type, ids) {
564
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type, ids) {
519
565
  var params,
520
566
  mergedParams,
521
567
  res,
522
- _args11 = arguments;
523
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
524
- while (1) switch (_context11.prev = _context11.next) {
568
+ _args12 = arguments;
569
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
570
+ while (1) switch (_context12.prev = _context12.next) {
525
571
  case 0:
526
- params = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
527
- _context11.prev = 1;
572
+ params = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : {};
573
+ _context12.prev = 1;
528
574
  if (!Array.isArray(ids)) {
529
- _context11.next = 7;
575
+ _context12.next = 7;
530
576
  break;
531
577
  }
532
578
  mergedParams = _objectSpread(_objectSpread({}, params), {}, {
533
579
  where: "id IN (" + ids.join(',') + ")"
534
580
  });
535
- return _context11.abrupt("return", this.query(type, mergedParams));
581
+ return _context12.abrupt("return", this.query(type, mergedParams));
536
582
  case 7:
537
583
  mergedParams = _objectSpread(_objectSpread({}, params), {}, {
538
584
  where: "id=" + ids
539
585
  });
540
- _context11.next = 10;
586
+ _context12.next = 10;
541
587
  return this.query(type, mergedParams);
542
588
  case 10:
543
- res = _context11.sent;
544
- return _context11.abrupt("return", res[0]);
589
+ res = _context12.sent;
590
+ return _context12.abrupt("return", res[0]);
545
591
  case 12:
546
- _context11.next = 17;
592
+ _context12.next = 17;
547
593
  break;
548
594
  case 14:
549
- _context11.prev = 14;
550
- _context11.t0 = _context11["catch"](1);
551
- return _context11.abrupt("return", this._handleError(_context11.t0));
595
+ _context12.prev = 14;
596
+ _context12.t0 = _context12["catch"](1);
597
+ return _context12.abrupt("return", this._handleError(_context12.t0));
552
598
  case 17:
553
599
  case "end":
554
- return _context11.stop();
600
+ return _context12.stop();
555
601
  }
556
- }, _callee11, this, [[1, 14]]);
602
+ }, _callee12, this, [[1, 14]]);
557
603
  }));
558
- function load(_x7, _x8) {
604
+ function load(_x8, _x9) {
559
605
  return _load.apply(this, arguments);
560
606
  }
561
607
  return load;
@@ -576,7 +622,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
576
622
  }, {
577
623
  key: "runTask",
578
624
  value: function () {
579
- var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
625
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
580
626
  var params,
581
627
  callbacks,
582
628
  onProgress,
@@ -588,20 +634,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
588
634
  status,
589
635
  message,
590
636
  output,
591
- _args12 = arguments;
592
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
593
- while (1) switch (_context12.prev = _context12.next) {
637
+ _args13 = arguments;
638
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
639
+ while (1) switch (_context13.prev = _context13.next) {
594
640
  case 0:
595
- params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
596
- callbacks = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
641
+ params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
642
+ callbacks = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {};
597
643
  onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
598
- _context12.prev = 3;
599
- _context12.next = 6;
644
+ _context13.prev = 3;
645
+ _context13.next = 6;
600
646
  return this.post('http://localhost:3004/runChain', params);
601
647
  case 6:
602
- response = _context12.sent;
648
+ response = _context13.sent;
603
649
  if (response) {
604
- _context12.next = 9;
650
+ _context13.next = 9;
605
651
  break;
606
652
  }
607
653
  throw new Error('Invalid server response');
@@ -609,7 +655,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
609
655
  // Validate response structure
610
656
  ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
611
657
  if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
612
- _context12.next = 12;
658
+ _context13.next = 12;
613
659
  break;
614
660
  }
615
661
  throw new Error('Invalid response structure');
@@ -627,7 +673,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
627
673
  console.log('Finish (request) ', response);
628
674
  onFinish(response);
629
675
  }
630
- return _context12.abrupt("return", {
676
+ return _context13.abrupt("return", {
631
677
  ok: ok,
632
678
  jobId: jobId,
633
679
  status: status,
@@ -635,24 +681,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
635
681
  output: output
636
682
  });
637
683
  case 18:
638
- _context12.prev = 18;
639
- _context12.t0 = _context12["catch"](3);
684
+ _context13.prev = 18;
685
+ _context13.t0 = _context13["catch"](3);
640
686
  if (typeof onError === 'function') {
641
- onError(_context12.t0);
687
+ onError(_context13.t0);
642
688
  } else {
643
- console.error('Error in runTask:', _context12.t0);
689
+ console.error('Error in runTask:', _context13.t0);
644
690
  }
645
- return _context12.abrupt("return", {
691
+ return _context13.abrupt("return", {
646
692
  ok: false,
647
693
  jobId: null,
648
694
  status: 'ERROR',
649
- error: _context12.t0.message
695
+ error: _context13.t0.message
650
696
  });
651
697
  case 22:
652
698
  case "end":
653
- return _context12.stop();
699
+ return _context13.stop();
654
700
  }
655
- }, _callee12, this, [[3, 18]]);
701
+ }, _callee13, this, [[3, 18]]);
656
702
  }));
657
703
  function runTask() {
658
704
  return _runTask.apply(this, arguments);
@@ -672,26 +718,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
672
718
  }, {
673
719
  key: "pollTaskProgress",
674
720
  value: function () {
675
- var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(jobId, callbacks) {
721
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(jobId, callbacks) {
676
722
  var _this2 = this;
677
723
  var onProgress, onError, onFinish, checkProgress;
678
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
679
- while (1) switch (_context14.prev = _context14.next) {
724
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
725
+ while (1) switch (_context15.prev = _context15.next) {
680
726
  case 0:
681
727
  onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
682
- _context14.prev = 1;
728
+ _context15.prev = 1;
683
729
  checkProgress = /*#__PURE__*/function () {
684
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
730
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
685
731
  var response;
686
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
687
- while (1) switch (_context13.prev = _context13.next) {
732
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
733
+ while (1) switch (_context14.prev = _context14.next) {
688
734
  case 0:
689
- _context13.next = 2;
735
+ _context14.next = 2;
690
736
  return _this2.get("http://localhost:3004/pollChainProgress", {
691
737
  jobId: jobId
692
738
  });
693
739
  case 2:
694
- response = _context13.sent;
740
+ response = _context14.sent;
695
741
  // If the task is still in progress, start polling for updates
696
742
  if (response.status === 'DONE' && onFinish) {
697
743
  // Provide the current progress to the callback function
@@ -714,28 +760,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
714
760
  }
715
761
  case 7:
716
762
  case "end":
717
- return _context13.stop();
763
+ return _context14.stop();
718
764
  }
719
- }, _callee13);
765
+ }, _callee14);
720
766
  }));
721
767
  return function checkProgress() {
722
768
  return _ref2.apply(this, arguments);
723
769
  };
724
770
  }();
725
771
  checkProgress();
726
- _context14.next = 9;
772
+ _context15.next = 9;
727
773
  break;
728
774
  case 6:
729
- _context14.prev = 6;
730
- _context14.t0 = _context14["catch"](1);
731
- return _context14.abrupt("return", this._handleError(_context14.t0));
775
+ _context15.prev = 6;
776
+ _context15.t0 = _context15["catch"](1);
777
+ return _context15.abrupt("return", this._handleError(_context15.t0));
732
778
  case 9:
733
779
  case "end":
734
- return _context14.stop();
780
+ return _context15.stop();
735
781
  }
736
- }, _callee14, this, [[1, 6]]);
782
+ }, _callee15, this, [[1, 6]]);
737
783
  }));
738
- function pollTaskProgress(_x9, _x10) {
784
+ function pollTaskProgress(_x10, _x11) {
739
785
  return _pollTaskProgress.apply(this, arguments);
740
786
  }
741
787
  return pollTaskProgress;
@@ -754,45 +800,45 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
754
800
  }, {
755
801
  key: "get",
756
802
  value: function () {
757
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(endpoint) {
803
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(endpoint) {
758
804
  var params,
759
805
  headers,
760
806
  response,
761
- _args15 = arguments;
762
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
763
- while (1) switch (_context15.prev = _context15.next) {
807
+ _args16 = arguments;
808
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
809
+ while (1) switch (_context16.prev = _context16.next) {
764
810
  case 0:
765
- params = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
766
- _context15.prev = 1;
811
+ params = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
812
+ _context16.prev = 1;
767
813
  // Add the authToken to the headers
768
814
  headers = {
769
815
  authtoken: this.authtoken
770
816
  }; // Make the GET request using Axios
771
- _context15.next = 5;
817
+ _context16.next = 5;
772
818
  return this.axios.get(endpoint, {
773
819
  params: params,
774
820
  headers: headers
775
821
  });
776
822
  case 5:
777
- response = _context15.sent;
823
+ response = _context16.sent;
778
824
  if (!(response.data.ok === false)) {
779
- _context15.next = 8;
825
+ _context16.next = 8;
780
826
  break;
781
827
  }
782
- return _context15.abrupt("return", this._handleError(response));
828
+ return _context16.abrupt("return", this._handleError(response));
783
829
  case 8:
784
- return _context15.abrupt("return", response.data);
830
+ return _context16.abrupt("return", response.data);
785
831
  case 11:
786
- _context15.prev = 11;
787
- _context15.t0 = _context15["catch"](1);
788
- return _context15.abrupt("return", this._handleError(_context15.t0));
832
+ _context16.prev = 11;
833
+ _context16.t0 = _context16["catch"](1);
834
+ return _context16.abrupt("return", this._handleError(_context16.t0));
789
835
  case 14:
790
836
  case "end":
791
- return _context15.stop();
837
+ return _context16.stop();
792
838
  }
793
- }, _callee15, this, [[1, 11]]);
839
+ }, _callee16, this, [[1, 11]]);
794
840
  }));
795
- function get(_x11) {
841
+ function get(_x12) {
796
842
  return _get.apply(this, arguments);
797
843
  }
798
844
  return get;
@@ -812,44 +858,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
812
858
  }, {
813
859
  key: "post",
814
860
  value: function () {
815
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(endpoint) {
861
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(endpoint) {
816
862
  var data,
817
863
  headers,
818
864
  response,
819
- _args16 = arguments;
820
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
821
- while (1) switch (_context16.prev = _context16.next) {
865
+ _args17 = arguments;
866
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
867
+ while (1) switch (_context17.prev = _context17.next) {
822
868
  case 0:
823
- data = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
824
- _context16.prev = 1;
869
+ data = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
870
+ _context17.prev = 1;
825
871
  // Add the authToken to the headers
826
872
  headers = {
827
873
  authtoken: this.authtoken
828
874
  }; // Make the POST request using Axios
829
- _context16.next = 5;
875
+ _context17.next = 5;
830
876
  return this.axios.post(endpoint, data, {
831
877
  headers: headers
832
878
  });
833
879
  case 5:
834
- response = _context16.sent;
880
+ response = _context17.sent;
835
881
  if (!(response.data.ok === false)) {
836
- _context16.next = 8;
882
+ _context17.next = 8;
837
883
  break;
838
884
  }
839
- return _context16.abrupt("return", this._handleError(response));
885
+ return _context17.abrupt("return", this._handleError(response));
840
886
  case 8:
841
- return _context16.abrupt("return", response.data);
887
+ return _context17.abrupt("return", response.data);
842
888
  case 11:
843
- _context16.prev = 11;
844
- _context16.t0 = _context16["catch"](1);
845
- return _context16.abrupt("return", this._handleError(_context16.t0));
889
+ _context17.prev = 11;
890
+ _context17.t0 = _context17["catch"](1);
891
+ return _context17.abrupt("return", this._handleError(_context17.t0));
846
892
  case 14:
847
893
  case "end":
848
- return _context16.stop();
894
+ return _context17.stop();
849
895
  }
850
- }, _callee16, this, [[1, 11]]);
896
+ }, _callee17, this, [[1, 11]]);
851
897
  }));
852
- function post(_x12) {
898
+ function post(_x13) {
853
899
  return _post.apply(this, arguments);
854
900
  }
855
901
  return post;