roboto-js 1.4.6 → 1.4.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.
@@ -193,23 +193,71 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
193
193
  return login;
194
194
  }())
195
195
  }, {
196
- key: "logout",
196
+ key: "loginWithOauth",
197
197
  value: function () {
198
- var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
198
+ var _loginWithOauth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(userData) {
199
199
  var response;
200
200
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
201
201
  while (1) switch (_context4.prev = _context4.next) {
202
202
  case 0:
203
203
  _context4.prev = 0;
204
- _context4.next = 3;
204
+ debugger;
205
+ _context4.next = 4;
206
+ return this.post('/registerOrSigninOauth', userData);
207
+ case 4:
208
+ response = _context4.sent;
209
+ if (!(response.ok === false)) {
210
+ _context4.next = 7;
211
+ break;
212
+ }
213
+ return _context4.abrupt("return", this._handleError(response));
214
+ case 7:
215
+ this.iac_session = response;
216
+ this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
217
+ // update axios instance headers with authtoken
218
+ this.axios.defaults.headers.common['authtoken'] = response.authToken;
219
+ this.authtoken = response.authToken;
220
+ if (!this.localStorageAdaptor) {
221
+ _context4.next = 14;
222
+ break;
223
+ }
224
+ _context4.next = 14;
225
+ return this.localStorageAdaptor.setItem('authtoken', response.authToken);
226
+ case 14:
227
+ return _context4.abrupt("return", response);
228
+ case 17:
229
+ _context4.prev = 17;
230
+ _context4.t0 = _context4["catch"](0);
231
+ this._handleError(_context4.t0);
232
+ case 20:
233
+ case "end":
234
+ return _context4.stop();
235
+ }
236
+ }, _callee4, this, [[0, 17]]);
237
+ }));
238
+ function loginWithOauth(_x3) {
239
+ return _loginWithOauth.apply(this, arguments);
240
+ }
241
+ return loginWithOauth;
242
+ }()
243
+ }, {
244
+ key: "logout",
245
+ value: function () {
246
+ var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
247
+ var response;
248
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
249
+ while (1) switch (_context5.prev = _context5.next) {
250
+ case 0:
251
+ _context5.prev = 0;
252
+ _context5.next = 3;
205
253
  return this.axios.post('/user_service/logoutUser');
206
254
  case 3:
207
- response = _context4.sent;
255
+ response = _context5.sent;
208
256
  if (!(response.data.ok === false)) {
209
- _context4.next = 6;
257
+ _context5.next = 6;
210
258
  break;
211
259
  }
212
- return _context4.abrupt("return", this._handleError(response));
260
+ return _context5.abrupt("return", this._handleError(response));
213
261
  case 6:
214
262
  // Clear the iac_session and remove the auth token from axios headers
215
263
  this.iac_session = null;
@@ -221,22 +269,22 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
221
269
 
222
270
  // Clear localStorage if it's being used
223
271
  if (!this.localStorageAdaptor) {
224
- _context4.next = 13;
272
+ _context5.next = 13;
225
273
  break;
226
274
  }
227
- _context4.next = 13;
275
+ _context5.next = 13;
228
276
  return this.localStorageAdaptor.removeItem('authtoken');
229
277
  case 13:
230
- return _context4.abrupt("return", response.data);
278
+ return _context5.abrupt("return", response.data);
231
279
  case 16:
232
- _context4.prev = 16;
233
- _context4.t0 = _context4["catch"](0);
234
- this._handleError(_context4.t0);
280
+ _context5.prev = 16;
281
+ _context5.t0 = _context5["catch"](0);
282
+ this._handleError(_context5.t0);
235
283
  case 19:
236
284
  case "end":
237
- return _context4.stop();
285
+ return _context5.stop();
238
286
  }
239
- }, _callee4, this, [[0, 16]]);
287
+ }, _callee5, this, [[0, 16]]);
240
288
  }));
241
289
  function logout() {
242
290
  return _logout.apply(this, arguments);
@@ -253,43 +301,43 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
253
301
  }, {
254
302
  key: "loadCurrentUser",
255
303
  value: function () {
256
- var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
304
+ var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
257
305
  var response;
258
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
259
- while (1) switch (_context5.prev = _context5.next) {
306
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
307
+ while (1) switch (_context6.prev = _context6.next) {
260
308
  case 0:
261
- _context5.prev = 0;
309
+ _context6.prev = 0;
262
310
  if (!this.currentUser) {
263
- _context5.next = 3;
311
+ _context6.next = 3;
264
312
  break;
265
313
  }
266
- return _context5.abrupt("return", this.currentUser);
314
+ return _context6.abrupt("return", this.currentUser);
267
315
  case 3:
268
316
  if (!this.authtoken) {
269
- _context5.next = 10;
317
+ _context6.next = 10;
270
318
  break;
271
319
  }
272
- _context5.next = 6;
320
+ _context6.next = 6;
273
321
  return this.refreshAuthToken(this.authtoken);
274
322
  case 6:
275
- response = _context5.sent;
323
+ response = _context6.sent;
276
324
  this.currentUser = new _rbt_user["default"]({
277
325
  id: response.user.id
278
326
  }, this.axios);
279
327
  this.currentUser.setData(response.user);
280
- return _context5.abrupt("return", this.currentUser);
328
+ return _context6.abrupt("return", this.currentUser);
281
329
  case 10:
282
330
  this.currentUser = null;
283
- return _context5.abrupt("return", null);
331
+ return _context6.abrupt("return", null);
284
332
  case 14:
285
- _context5.prev = 14;
286
- _context5.t0 = _context5["catch"](0);
287
- return _context5.abrupt("return", this._handleError(_context5.t0));
333
+ _context6.prev = 14;
334
+ _context6.t0 = _context6["catch"](0);
335
+ return _context6.abrupt("return", this._handleError(_context6.t0));
288
336
  case 17:
289
337
  case "end":
290
- return _context5.stop();
338
+ return _context6.stop();
291
339
  }
292
- }, _callee5, this, [[0, 14]]);
340
+ }, _callee6, this, [[0, 14]]);
293
341
  }));
294
342
  function loadCurrentUser() {
295
343
  return _loadCurrentUser.apply(this, arguments);
@@ -299,37 +347,37 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
299
347
  }, {
300
348
  key: "confirmUserEmail",
301
349
  value: function () {
302
- var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(confirmCode) {
350
+ var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(confirmCode) {
303
351
  var params, response;
304
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
305
- while (1) switch (_context6.prev = _context6.next) {
352
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
353
+ while (1) switch (_context7.prev = _context7.next) {
306
354
  case 0:
307
355
  params = {
308
356
  emailConfirmCode: confirmCode
309
357
  };
310
- _context6.prev = 1;
311
- _context6.next = 4;
358
+ _context7.prev = 1;
359
+ _context7.next = 4;
312
360
  return this.axios.post('/user_service/confirmUserEmail', [params]);
313
361
  case 4:
314
- response = _context6.sent;
362
+ response = _context7.sent;
315
363
  if (!(response.data.ok === false)) {
316
- _context6.next = 7;
364
+ _context7.next = 7;
317
365
  break;
318
366
  }
319
- return _context6.abrupt("return", this._handleError(response));
367
+ return _context7.abrupt("return", this._handleError(response));
320
368
  case 7:
321
- return _context6.abrupt("return", response.data);
369
+ return _context7.abrupt("return", response.data);
322
370
  case 10:
323
- _context6.prev = 10;
324
- _context6.t0 = _context6["catch"](1);
325
- return _context6.abrupt("return", this._handleError(_context6.t0));
371
+ _context7.prev = 10;
372
+ _context7.t0 = _context7["catch"](1);
373
+ return _context7.abrupt("return", this._handleError(_context7.t0));
326
374
  case 13:
327
375
  case "end":
328
- return _context6.stop();
376
+ return _context7.stop();
329
377
  }
330
- }, _callee6, this, [[1, 10]]);
378
+ }, _callee7, this, [[1, 10]]);
331
379
  }));
332
- function confirmUserEmail(_x3) {
380
+ function confirmUserEmail(_x4) {
333
381
  return _confirmUserEmail.apply(this, arguments);
334
382
  }
335
383
  return confirmUserEmail;
@@ -337,21 +385,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
337
385
  }, {
338
386
  key: "loadCurrentUserExtended",
339
387
  value: function () {
340
- var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
388
+ var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
341
389
  var currentUser;
342
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
343
- while (1) switch (_context7.prev = _context7.next) {
390
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
391
+ while (1) switch (_context8.prev = _context8.next) {
344
392
  case 0:
345
- _context7.next = 2;
393
+ _context8.next = 2;
346
394
  return this.loadCurrentUser();
347
395
  case 2:
348
- currentUser = _context7.sent;
349
- return _context7.abrupt("return", this.loadUser(currentUser.id));
396
+ currentUser = _context8.sent;
397
+ return _context8.abrupt("return", this.loadUser(currentUser.id));
350
398
  case 4:
351
399
  case "end":
352
- return _context7.stop();
400
+ return _context8.stop();
353
401
  }
354
- }, _callee7, this);
402
+ }, _callee8, this);
355
403
  }));
356
404
  function loadCurrentUserExtended() {
357
405
  return _loadCurrentUserExtended.apply(this, arguments);
@@ -361,36 +409,36 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
361
409
  }, {
362
410
  key: "loadUser",
363
411
  value: function () {
364
- var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(userId) {
412
+ var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(userId) {
365
413
  var params, _response$data, response, userData, User;
366
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
367
- while (1) switch (_context8.prev = _context8.next) {
414
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
415
+ while (1) switch (_context9.prev = _context9.next) {
368
416
  case 0:
369
417
  params = {
370
418
  id: userId
371
419
  };
372
- _context8.prev = 1;
373
- _context8.next = 4;
420
+ _context9.prev = 1;
421
+ _context9.next = 4;
374
422
  return this.axios.post('/user_service/loadUser', [params]);
375
423
  case 4:
376
- response = _context8.sent;
424
+ response = _context9.sent;
377
425
  userData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.user;
378
426
  User = new _rbt_user["default"]({
379
427
  id: userData.id
380
428
  }, this.axios);
381
429
  User.setData(userData);
382
- return _context8.abrupt("return", User);
430
+ return _context9.abrupt("return", User);
383
431
  case 11:
384
- _context8.prev = 11;
385
- _context8.t0 = _context8["catch"](1);
386
- return _context8.abrupt("return", this._handleError(_context8.t0));
432
+ _context9.prev = 11;
433
+ _context9.t0 = _context9["catch"](1);
434
+ return _context9.abrupt("return", this._handleError(_context9.t0));
387
435
  case 14:
388
436
  case "end":
389
- return _context8.stop();
437
+ return _context9.stop();
390
438
  }
391
- }, _callee8, this, [[1, 11]]);
439
+ }, _callee9, this, [[1, 11]]);
392
440
  }));
393
- function loadUser(_x4) {
441
+ function loadUser(_x5) {
394
442
  return _loadUser.apply(this, arguments);
395
443
  }
396
444
  return loadUser;
@@ -398,29 +446,29 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
398
446
  }, {
399
447
  key: "refreshAuthToken",
400
448
  value: function () {
401
- var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(authtoken) {
449
+ var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(authtoken) {
402
450
  var response;
403
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
404
- while (1) switch (_context9.prev = _context9.next) {
451
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
452
+ while (1) switch (_context10.prev = _context10.next) {
405
453
  case 0:
406
- _context9.prev = 0;
407
- _context9.next = 3;
454
+ _context10.prev = 0;
455
+ _context10.next = 3;
408
456
  return this.axios.post('/user_service/refreshAuthToken', [authtoken]);
409
457
  case 3:
410
- response = _context9.sent;
458
+ response = _context10.sent;
411
459
  debugger;
412
- return _context9.abrupt("return", response.data);
460
+ return _context10.abrupt("return", response.data);
413
461
  case 8:
414
- _context9.prev = 8;
415
- _context9.t0 = _context9["catch"](0);
416
- this._handleError(_context9.t0);
462
+ _context10.prev = 8;
463
+ _context10.t0 = _context10["catch"](0);
464
+ this._handleError(_context10.t0);
417
465
  case 11:
418
466
  case "end":
419
- return _context9.stop();
467
+ return _context10.stop();
420
468
  }
421
- }, _callee9, this, [[0, 8]]);
469
+ }, _callee10, this, [[0, 8]]);
422
470
  }));
423
- function refreshAuthToken(_x5) {
471
+ function refreshAuthToken(_x6) {
424
472
  return _refreshAuthToken.apply(this, arguments);
425
473
  }
426
474
  return refreshAuthToken;
@@ -435,32 +483,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
435
483
  }, {
436
484
  key: "registerUser",
437
485
  value: (function () {
438
- var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
486
+ var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
439
487
  var dataHash,
440
488
  response,
441
489
  record,
442
- _args10 = arguments;
443
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
444
- while (1) switch (_context10.prev = _context10.next) {
490
+ _args11 = arguments;
491
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
492
+ while (1) switch (_context11.prev = _context11.next) {
445
493
  case 0:
446
- dataHash = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
447
- _context10.prev = 1;
448
- _context10.next = 4;
494
+ dataHash = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
495
+ _context11.prev = 1;
496
+ _context11.next = 4;
449
497
  return this.axios.post('/user_service/registerUser', [dataHash]);
450
498
  case 4:
451
- response = _context10.sent;
499
+ response = _context11.sent;
452
500
  record = response.data;
453
- return _context10.abrupt("return", new _rbt_user["default"](record, this.axios));
501
+ return _context11.abrupt("return", new _rbt_user["default"](record, this.axios));
454
502
  case 9:
455
- _context10.prev = 9;
456
- _context10.t0 = _context10["catch"](1);
503
+ _context11.prev = 9;
504
+ _context11.t0 = _context11["catch"](1);
457
505
  debugger;
458
- return _context10.abrupt("return", this._handleError(_context10.t0));
506
+ return _context11.abrupt("return", this._handleError(_context11.t0));
459
507
  case 13:
460
508
  case "end":
461
- return _context10.stop();
509
+ return _context11.stop();
462
510
  }
463
- }, _callee10, this, [[1, 9]]);
511
+ }, _callee11, this, [[1, 9]]);
464
512
  }));
465
513
  function registerUser() {
466
514
  return _registerUser.apply(this, arguments);
@@ -478,32 +526,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
478
526
  }, {
479
527
  key: "createFile",
480
528
  value: (function () {
481
- var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(dataHash) {
529
+ var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(dataHash) {
482
530
  var response, record;
483
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
484
- while (1) switch (_context11.prev = _context11.next) {
531
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
532
+ while (1) switch (_context12.prev = _context12.next) {
485
533
  case 0:
486
- _context11.prev = 0;
487
- _context11.next = 3;
534
+ _context12.prev = 0;
535
+ _context12.next = 3;
488
536
  return this.axios.post('/object_service/createObject', ['<@filekit.file>', dataHash]);
489
537
  case 3:
490
- response = _context11.sent;
538
+ response = _context12.sent;
491
539
  record = response.data;
492
540
  if (dataHash) {
493
541
  record.data = dataHash;
494
542
  }
495
- return _context11.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
543
+ return _context12.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
496
544
  case 9:
497
- _context11.prev = 9;
498
- _context11.t0 = _context11["catch"](0);
499
- return _context11.abrupt("return", this._handleError(_context11.t0));
545
+ _context12.prev = 9;
546
+ _context12.t0 = _context12["catch"](0);
547
+ return _context12.abrupt("return", this._handleError(_context12.t0));
500
548
  case 12:
501
549
  case "end":
502
- return _context11.stop();
550
+ return _context12.stop();
503
551
  }
504
- }, _callee11, this, [[0, 9]]);
552
+ }, _callee12, this, [[0, 9]]);
505
553
  }));
506
- function createFile(_x6) {
554
+ function createFile(_x7) {
507
555
  return _createFile.apply(this, arguments);
508
556
  }
509
557
  return createFile;
@@ -511,35 +559,35 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
511
559
  }, {
512
560
  key: "loadFile",
513
561
  value: function () {
514
- var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(id) {
562
+ var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(id) {
515
563
  var response, record;
516
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
517
- while (1) switch (_context12.prev = _context12.next) {
564
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
565
+ while (1) switch (_context13.prev = _context13.next) {
518
566
  case 0:
519
- _context12.prev = 0;
520
- _context12.next = 3;
567
+ _context13.prev = 0;
568
+ _context13.next = 3;
521
569
  return this.load('<@filekit.file>', id);
522
570
  case 3:
523
- response = _context12.sent;
571
+ response = _context13.sent;
524
572
  if (response) {
525
- _context12.next = 6;
573
+ _context13.next = 6;
526
574
  break;
527
575
  }
528
- return _context12.abrupt("return", null);
576
+ return _context13.abrupt("return", null);
529
577
  case 6:
530
578
  record = response.toRecord();
531
- return _context12.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
579
+ return _context13.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
532
580
  case 10:
533
- _context12.prev = 10;
534
- _context12.t0 = _context12["catch"](0);
535
- return _context12.abrupt("return", this._handleError(_context12.t0));
581
+ _context13.prev = 10;
582
+ _context13.t0 = _context13["catch"](0);
583
+ return _context13.abrupt("return", this._handleError(_context13.t0));
536
584
  case 13:
537
585
  case "end":
538
- return _context12.stop();
586
+ return _context13.stop();
539
587
  }
540
- }, _callee12, this, [[0, 10]]);
588
+ }, _callee13, this, [[0, 10]]);
541
589
  }));
542
- function loadFile(_x7) {
590
+ function loadFile(_x8) {
543
591
  return _loadFile.apply(this, arguments);
544
592
  }
545
593
  return loadFile;
@@ -554,38 +602,38 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
554
602
  }, {
555
603
  key: "create",
556
604
  value: (function () {
557
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(type) {
605
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(type) {
558
606
  var dataHash,
559
607
  response,
560
608
  record,
561
- _args13 = arguments;
562
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
563
- while (1) switch (_context13.prev = _context13.next) {
609
+ _args14 = arguments;
610
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
611
+ while (1) switch (_context14.prev = _context14.next) {
564
612
  case 0:
565
- dataHash = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {};
566
- _context13.prev = 1;
567
- _context13.next = 4;
613
+ dataHash = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
614
+ _context14.prev = 1;
615
+ _context14.next = 4;
568
616
  return this.axios.post('/object_service/createObject', [type, dataHash]);
569
617
  case 4:
570
- response = _context13.sent;
618
+ response = _context14.sent;
571
619
  record = response.data;
572
620
  if (dataHash) {
573
621
  record.data = dataHash;
574
622
  }
575
- return _context13.abrupt("return", new _rbt_object["default"](record, this.axios, {
623
+ return _context14.abrupt("return", new _rbt_object["default"](record, this.axios, {
576
624
  isNew: true
577
625
  }));
578
626
  case 10:
579
- _context13.prev = 10;
580
- _context13.t0 = _context13["catch"](1);
581
- return _context13.abrupt("return", this._handleError(_context13.t0));
627
+ _context14.prev = 10;
628
+ _context14.t0 = _context14["catch"](1);
629
+ return _context14.abrupt("return", this._handleError(_context14.t0));
582
630
  case 13:
583
631
  case "end":
584
- return _context13.stop();
632
+ return _context14.stop();
585
633
  }
586
- }, _callee13, this, [[1, 10]]);
634
+ }, _callee14, this, [[1, 10]]);
587
635
  }));
588
- function create(_x8) {
636
+ function create(_x9) {
589
637
  return _create.apply(this, arguments);
590
638
  }
591
639
  return create;
@@ -622,19 +670,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
622
670
  }, {
623
671
  key: "query",
624
672
  value: (function () {
625
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(type) {
673
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(type) {
626
674
  var _this = this;
627
675
  var params,
628
676
  defaultOrderBy,
629
677
  defaultLimit,
630
678
  mergedParams,
631
679
  response,
632
- _args14 = arguments;
633
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
634
- while (1) switch (_context14.prev = _context14.next) {
680
+ _args15 = arguments;
681
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
682
+ while (1) switch (_context15.prev = _context15.next) {
635
683
  case 0:
636
- params = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
637
- _context14.prev = 1;
684
+ params = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
685
+ _context15.prev = 1;
638
686
  params.type = type;
639
687
 
640
688
  // Default ordering and pagination
@@ -651,15 +699,15 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
651
699
  }
652
700
  }; // Merge defaults with provided params
653
701
  mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params);
654
- _context14.next = 8;
702
+ _context15.next = 8;
655
703
  return this.axios.post('/object_service/queryObjects', [mergedParams]);
656
704
  case 8:
657
- response = _context14.sent;
705
+ response = _context15.sent;
658
706
  if (!(response.data.ok === false)) {
659
- _context14.next = 11;
707
+ _context15.next = 11;
660
708
  break;
661
709
  }
662
- return _context14.abrupt("return", this._handleError(response));
710
+ return _context15.abrupt("return", this._handleError(response));
663
711
  case 11:
664
712
  // Process items into RbtObject instances
665
713
  if (Array.isArray(response.data.items)) {
@@ -669,18 +717,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
669
717
  });
670
718
  });
671
719
  }
672
- return _context14.abrupt("return", response.data.items);
720
+ return _context15.abrupt("return", response.data.items);
673
721
  case 15:
674
- _context14.prev = 15;
675
- _context14.t0 = _context14["catch"](1);
676
- return _context14.abrupt("return", this._handleError(_context14.t0));
722
+ _context15.prev = 15;
723
+ _context15.t0 = _context15["catch"](1);
724
+ return _context15.abrupt("return", this._handleError(_context15.t0));
677
725
  case 18:
678
726
  case "end":
679
- return _context14.stop();
727
+ return _context15.stop();
680
728
  }
681
- }, _callee14, this, [[1, 15]]);
729
+ }, _callee15, this, [[1, 15]]);
682
730
  }));
683
- function query(_x9) {
731
+ function query(_x10) {
684
732
  return _query.apply(this, arguments);
685
733
  }
686
734
  return query;
@@ -697,47 +745,47 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
697
745
  }, {
698
746
  key: "load",
699
747
  value: (function () {
700
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(type, ids) {
748
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(type, ids) {
701
749
  var params,
702
750
  mergedParams,
703
751
  res,
704
- _args15 = arguments;
705
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
706
- while (1) switch (_context15.prev = _context15.next) {
752
+ _args16 = arguments;
753
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
754
+ while (1) switch (_context16.prev = _context16.next) {
707
755
  case 0:
708
- params = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
709
- _context15.prev = 1;
756
+ params = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
757
+ _context16.prev = 1;
710
758
  if (!Array.isArray(ids)) {
711
- _context15.next = 7;
759
+ _context16.next = 7;
712
760
  break;
713
761
  }
714
762
  mergedParams = _objectSpread(_objectSpread({}, params), {}, {
715
763
  where: "id IN (" + ids.join(',') + ")"
716
764
  });
717
- return _context15.abrupt("return", this.query(type, mergedParams));
765
+ return _context16.abrupt("return", this.query(type, mergedParams));
718
766
  case 7:
719
767
  mergedParams = _objectSpread(_objectSpread({}, params), {}, {
720
768
  where: "id=" + ids
721
769
  });
722
- _context15.next = 10;
770
+ _context16.next = 10;
723
771
  return this.query(type, mergedParams);
724
772
  case 10:
725
- res = _context15.sent;
726
- return _context15.abrupt("return", res[0]);
773
+ res = _context16.sent;
774
+ return _context16.abrupt("return", res[0]);
727
775
  case 12:
728
- _context15.next = 17;
776
+ _context16.next = 17;
729
777
  break;
730
778
  case 14:
731
- _context15.prev = 14;
732
- _context15.t0 = _context15["catch"](1);
733
- return _context15.abrupt("return", this._handleError(_context15.t0));
779
+ _context16.prev = 14;
780
+ _context16.t0 = _context16["catch"](1);
781
+ return _context16.abrupt("return", this._handleError(_context16.t0));
734
782
  case 17:
735
783
  case "end":
736
- return _context15.stop();
784
+ return _context16.stop();
737
785
  }
738
- }, _callee15, this, [[1, 14]]);
786
+ }, _callee16, this, [[1, 14]]);
739
787
  }));
740
- function load(_x10, _x11) {
788
+ function load(_x11, _x12) {
741
789
  return _load.apply(this, arguments);
742
790
  }
743
791
  return load;
@@ -759,7 +807,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
759
807
  }, {
760
808
  key: "runTask",
761
809
  value: (function () {
762
- var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
810
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
763
811
  var params,
764
812
  callbacks,
765
813
  onProgress,
@@ -771,20 +819,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
771
819
  status,
772
820
  message,
773
821
  output,
774
- _args16 = arguments;
775
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
776
- while (1) switch (_context16.prev = _context16.next) {
822
+ _args17 = arguments;
823
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
824
+ while (1) switch (_context17.prev = _context17.next) {
777
825
  case 0:
778
- params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
779
- callbacks = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
826
+ params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
827
+ callbacks = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
780
828
  onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
781
- _context16.prev = 3;
782
- _context16.next = 6;
829
+ _context17.prev = 3;
830
+ _context17.next = 6;
783
831
  return this.post('/task_service/runChain', params);
784
832
  case 6:
785
- response = _context16.sent;
833
+ response = _context17.sent;
786
834
  if (response) {
787
- _context16.next = 9;
835
+ _context17.next = 9;
788
836
  break;
789
837
  }
790
838
  throw new Error('Invalid server response');
@@ -792,7 +840,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
792
840
  // Validate response structure
793
841
  ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
794
842
  if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
795
- _context16.next = 12;
843
+ _context17.next = 12;
796
844
  break;
797
845
  }
798
846
  throw new Error('Invalid response structure');
@@ -810,7 +858,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
810
858
  console.log('Finish (request) ', response);
811
859
  onFinish(response);
812
860
  }
813
- return _context16.abrupt("return", {
861
+ return _context17.abrupt("return", {
814
862
  ok: ok,
815
863
  jobId: jobId,
816
864
  status: status,
@@ -818,24 +866,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
818
866
  output: output
819
867
  });
820
868
  case 18:
821
- _context16.prev = 18;
822
- _context16.t0 = _context16["catch"](3);
869
+ _context17.prev = 18;
870
+ _context17.t0 = _context17["catch"](3);
823
871
  if (typeof onError === 'function') {
824
- onError(_context16.t0);
872
+ onError(_context17.t0);
825
873
  } else {
826
- console.error('Error in runTask:', _context16.t0);
874
+ console.error('Error in runTask:', _context17.t0);
827
875
  }
828
- return _context16.abrupt("return", {
876
+ return _context17.abrupt("return", {
829
877
  ok: false,
830
878
  jobId: null,
831
879
  status: 'ERROR',
832
- error: _context16.t0.message
880
+ error: _context17.t0.message
833
881
  });
834
882
  case 22:
835
883
  case "end":
836
- return _context16.stop();
884
+ return _context17.stop();
837
885
  }
838
- }, _callee16, this, [[3, 18]]);
886
+ }, _callee17, this, [[3, 18]]);
839
887
  }));
840
888
  function runTask() {
841
889
  return _runTask.apply(this, arguments);
@@ -856,26 +904,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
856
904
  }, {
857
905
  key: "pollTaskProgress",
858
906
  value: (function () {
859
- var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(jobId, callbacks) {
907
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(jobId, callbacks) {
860
908
  var _this2 = this;
861
909
  var onProgress, onError, onFinish, checkProgress;
862
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
863
- while (1) switch (_context18.prev = _context18.next) {
910
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
911
+ while (1) switch (_context19.prev = _context19.next) {
864
912
  case 0:
865
913
  onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
866
- _context18.prev = 1;
914
+ _context19.prev = 1;
867
915
  checkProgress = /*#__PURE__*/function () {
868
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
916
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
869
917
  var response;
870
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
871
- while (1) switch (_context17.prev = _context17.next) {
918
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
919
+ while (1) switch (_context18.prev = _context18.next) {
872
920
  case 0:
873
- _context17.next = 2;
921
+ _context18.next = 2;
874
922
  return _this2.get("/task_service/pollChainProgress", {
875
923
  jobId: jobId
876
924
  });
877
925
  case 2:
878
- response = _context17.sent;
926
+ response = _context18.sent;
879
927
  // If the task is still in progress, start polling for updates
880
928
  if (response.status === 'DONE' && onFinish) {
881
929
  // Provide the current progress to the callback function
@@ -898,28 +946,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
898
946
  }
899
947
  case 7:
900
948
  case "end":
901
- return _context17.stop();
949
+ return _context18.stop();
902
950
  }
903
- }, _callee17);
951
+ }, _callee18);
904
952
  }));
905
953
  return function checkProgress() {
906
954
  return _ref2.apply(this, arguments);
907
955
  };
908
956
  }();
909
957
  checkProgress();
910
- _context18.next = 9;
958
+ _context19.next = 9;
911
959
  break;
912
960
  case 6:
913
- _context18.prev = 6;
914
- _context18.t0 = _context18["catch"](1);
915
- return _context18.abrupt("return", this._handleError(_context18.t0));
961
+ _context19.prev = 6;
962
+ _context19.t0 = _context19["catch"](1);
963
+ return _context19.abrupt("return", this._handleError(_context19.t0));
916
964
  case 9:
917
965
  case "end":
918
- return _context18.stop();
966
+ return _context19.stop();
919
967
  }
920
- }, _callee18, this, [[1, 6]]);
968
+ }, _callee19, this, [[1, 6]]);
921
969
  }));
922
- function pollTaskProgress(_x12, _x13) {
970
+ function pollTaskProgress(_x13, _x14) {
923
971
  return _pollTaskProgress.apply(this, arguments);
924
972
  }
925
973
  return pollTaskProgress;
@@ -939,46 +987,46 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
939
987
  }, {
940
988
  key: "get",
941
989
  value: (function () {
942
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(endpoint) {
990
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(endpoint) {
943
991
  var params,
944
992
  headers,
945
993
  response,
946
- _args19 = arguments;
947
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
948
- while (1) switch (_context19.prev = _context19.next) {
994
+ _args20 = arguments;
995
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
996
+ while (1) switch (_context20.prev = _context20.next) {
949
997
  case 0:
950
- params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
998
+ params = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
951
999
  debugger;
952
- _context19.prev = 2;
1000
+ _context20.prev = 2;
953
1001
  // Add the authToken to the headers
954
1002
  headers = {
955
1003
  authtoken: this.authtoken
956
1004
  }; // Make the GET request using Axios
957
- _context19.next = 6;
1005
+ _context20.next = 6;
958
1006
  return this.axios.get(endpoint, {
959
1007
  params: params,
960
1008
  headers: headers
961
1009
  });
962
1010
  case 6:
963
- response = _context19.sent;
1011
+ response = _context20.sent;
964
1012
  if (!(response.data.ok === false)) {
965
- _context19.next = 9;
1013
+ _context20.next = 9;
966
1014
  break;
967
1015
  }
968
- return _context19.abrupt("return", this._handleError(response));
1016
+ return _context20.abrupt("return", this._handleError(response));
969
1017
  case 9:
970
- return _context19.abrupt("return", response.data);
1018
+ return _context20.abrupt("return", response.data);
971
1019
  case 12:
972
- _context19.prev = 12;
973
- _context19.t0 = _context19["catch"](2);
974
- return _context19.abrupt("return", this._handleError(_context19.t0));
1020
+ _context20.prev = 12;
1021
+ _context20.t0 = _context20["catch"](2);
1022
+ return _context20.abrupt("return", this._handleError(_context20.t0));
975
1023
  case 15:
976
1024
  case "end":
977
- return _context19.stop();
1025
+ return _context20.stop();
978
1026
  }
979
- }, _callee19, this, [[2, 12]]);
1027
+ }, _callee20, this, [[2, 12]]);
980
1028
  }));
981
- function get(_x14) {
1029
+ function get(_x15) {
982
1030
  return _get.apply(this, arguments);
983
1031
  }
984
1032
  return get;
@@ -999,44 +1047,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
999
1047
  }, {
1000
1048
  key: "post",
1001
1049
  value: (function () {
1002
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(endpoint) {
1050
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(endpoint) {
1003
1051
  var data,
1004
1052
  headers,
1005
1053
  response,
1006
- _args20 = arguments;
1007
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1008
- while (1) switch (_context20.prev = _context20.next) {
1054
+ _args21 = arguments;
1055
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1056
+ while (1) switch (_context21.prev = _context21.next) {
1009
1057
  case 0:
1010
- data = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
1011
- _context20.prev = 1;
1058
+ data = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
1059
+ _context21.prev = 1;
1012
1060
  // Add the authToken to the headers
1013
1061
  headers = {
1014
1062
  authtoken: this.authtoken
1015
1063
  }; // Make the POST request using Axios
1016
- _context20.next = 5;
1064
+ _context21.next = 5;
1017
1065
  return this.axios.post(endpoint, data, {
1018
1066
  headers: headers
1019
1067
  });
1020
1068
  case 5:
1021
- response = _context20.sent;
1069
+ response = _context21.sent;
1022
1070
  if (!(response.data.ok === false)) {
1023
- _context20.next = 8;
1071
+ _context21.next = 8;
1024
1072
  break;
1025
1073
  }
1026
- return _context20.abrupt("return", this._handleError(response));
1074
+ return _context21.abrupt("return", this._handleError(response));
1027
1075
  case 8:
1028
- return _context20.abrupt("return", response.data);
1076
+ return _context21.abrupt("return", response.data);
1029
1077
  case 11:
1030
- _context20.prev = 11;
1031
- _context20.t0 = _context20["catch"](1);
1032
- return _context20.abrupt("return", this._handleError(_context20.t0));
1078
+ _context21.prev = 11;
1079
+ _context21.t0 = _context21["catch"](1);
1080
+ return _context21.abrupt("return", this._handleError(_context21.t0));
1033
1081
  case 14:
1034
1082
  case "end":
1035
- return _context20.stop();
1083
+ return _context21.stop();
1036
1084
  }
1037
- }, _callee20, this, [[1, 11]]);
1085
+ }, _callee21, this, [[1, 11]]);
1038
1086
  }));
1039
- function post(_x15) {
1087
+ function post(_x16) {
1040
1088
  return _post.apply(this, arguments);
1041
1089
  }
1042
1090
  return post;