roboto-js 1.3.11 → 1.3.12

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.
@@ -277,27 +277,46 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
277
277
  return _createFile.apply(this, arguments);
278
278
  }
279
279
  return createFile;
280
+ }()
281
+ }, {
282
+ key: "loadFile",
283
+ value: function () {
284
+ var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(id) {
285
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
286
+ while (1) switch (_context10.prev = _context10.next) {
287
+ case 0:
288
+ return _context10.abrupt("return", this.api.loadFile(id));
289
+ case 1:
290
+ case "end":
291
+ return _context10.stop();
292
+ }
293
+ }, _callee10, this);
294
+ }));
295
+ function loadFile(_x5) {
296
+ return _loadFile.apply(this, arguments);
297
+ }
298
+ return loadFile;
280
299
  }() //
281
300
  //
282
301
  //
283
302
  }, {
284
303
  key: "create",
285
304
  value: function () {
286
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
305
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
287
306
  var data,
288
- _args10 = arguments;
289
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
290
- while (1) switch (_context10.prev = _context10.next) {
307
+ _args11 = arguments;
308
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
309
+ while (1) switch (_context11.prev = _context11.next) {
291
310
  case 0:
292
- data = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
293
- return _context10.abrupt("return", this.api.create(params, data));
311
+ data = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
312
+ return _context11.abrupt("return", this.api.create(params, data));
294
313
  case 2:
295
314
  case "end":
296
- return _context10.stop();
315
+ return _context11.stop();
297
316
  }
298
- }, _callee10, this);
317
+ }, _callee11, this);
299
318
  }));
300
- function create(_x5) {
319
+ function create(_x6) {
301
320
  return _create.apply(this, arguments);
302
321
  }
303
322
  return create;
@@ -305,18 +324,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
305
324
  }, {
306
325
  key: "load",
307
326
  value: function () {
308
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type, ids, options) {
309
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
310
- while (1) switch (_context11.prev = _context11.next) {
327
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type, ids, options) {
328
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
329
+ while (1) switch (_context12.prev = _context12.next) {
311
330
  case 0:
312
- return _context11.abrupt("return", this.api.load(type, ids, options));
331
+ return _context12.abrupt("return", this.api.load(type, ids, options));
313
332
  case 1:
314
333
  case "end":
315
- return _context11.stop();
334
+ return _context12.stop();
316
335
  }
317
- }, _callee11, this);
336
+ }, _callee12, this);
318
337
  }));
319
- function load(_x6, _x7, _x8) {
338
+ function load(_x7, _x8, _x9) {
320
339
  return _load.apply(this, arguments);
321
340
  }
322
341
  return load;
@@ -324,18 +343,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
324
343
  }, {
325
344
  key: "query",
326
345
  value: function () {
327
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type, params) {
328
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
329
- while (1) switch (_context12.prev = _context12.next) {
346
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(type, params) {
347
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
348
+ while (1) switch (_context13.prev = _context13.next) {
330
349
  case 0:
331
- return _context12.abrupt("return", this.api.query(type, params));
350
+ return _context13.abrupt("return", this.api.query(type, params));
332
351
  case 1:
333
352
  case "end":
334
- return _context12.stop();
353
+ return _context13.stop();
335
354
  }
336
- }, _callee12, this);
355
+ }, _callee13, this);
337
356
  }));
338
- function query(_x9, _x10) {
357
+ function query(_x10, _x11) {
339
358
  return _query.apply(this, arguments);
340
359
  }
341
360
  return query;
@@ -345,18 +364,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
345
364
  }, {
346
365
  key: "runTask",
347
366
  value: function () {
348
- var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params, callbacks) {
349
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
350
- while (1) switch (_context13.prev = _context13.next) {
367
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params, callbacks) {
368
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
369
+ while (1) switch (_context14.prev = _context14.next) {
351
370
  case 0:
352
- return _context13.abrupt("return", this.api.runTask(params, callbacks));
371
+ return _context14.abrupt("return", this.api.runTask(params, callbacks));
353
372
  case 1:
354
373
  case "end":
355
- return _context13.stop();
374
+ return _context14.stop();
356
375
  }
357
- }, _callee13, this);
376
+ }, _callee14, this);
358
377
  }));
359
- function runTask(_x11, _x12) {
378
+ function runTask(_x12, _x13) {
360
379
  return _runTask.apply(this, arguments);
361
380
  }
362
381
  return runTask;
@@ -364,18 +383,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
364
383
  }, {
365
384
  key: "pollTaskProgress",
366
385
  value: function () {
367
- var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
368
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
369
- while (1) switch (_context14.prev = _context14.next) {
386
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
387
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
388
+ while (1) switch (_context15.prev = _context15.next) {
370
389
  case 0:
371
- return _context14.abrupt("return", this.api.pollTaskProgress(params));
390
+ return _context15.abrupt("return", this.api.pollTaskProgress(params));
372
391
  case 1:
373
392
  case "end":
374
- return _context14.stop();
393
+ return _context15.stop();
375
394
  }
376
- }, _callee14, this);
395
+ }, _callee15, this);
377
396
  }));
378
- function pollTaskProgress(_x13) {
397
+ function pollTaskProgress(_x14) {
379
398
  return _pollTaskProgress.apply(this, arguments);
380
399
  }
381
400
  return pollTaskProgress;
@@ -385,18 +404,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
385
404
  }, {
386
405
  key: "get",
387
406
  value: function () {
388
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(endpoint, params) {
389
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
390
- while (1) switch (_context15.prev = _context15.next) {
407
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(endpoint, params) {
408
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
409
+ while (1) switch (_context16.prev = _context16.next) {
391
410
  case 0:
392
- return _context15.abrupt("return", this.api.get(endpoint, params));
411
+ return _context16.abrupt("return", this.api.get(endpoint, params));
393
412
  case 1:
394
413
  case "end":
395
- return _context15.stop();
414
+ return _context16.stop();
396
415
  }
397
- }, _callee15, this);
416
+ }, _callee16, this);
398
417
  }));
399
- function get(_x14, _x15) {
418
+ function get(_x15, _x16) {
400
419
  return _get.apply(this, arguments);
401
420
  }
402
421
  return get;
@@ -404,18 +423,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
404
423
  }, {
405
424
  key: "post",
406
425
  value: function () {
407
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(endpoint, data) {
408
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
409
- while (1) switch (_context16.prev = _context16.next) {
426
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(endpoint, data) {
427
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
428
+ while (1) switch (_context17.prev = _context17.next) {
410
429
  case 0:
411
- return _context16.abrupt("return", this.api.post(endpoint, data));
430
+ return _context17.abrupt("return", this.api.post(endpoint, data));
412
431
  case 1:
413
432
  case "end":
414
- return _context16.stop();
433
+ return _context17.stop();
415
434
  }
416
- }, _callee16, this);
435
+ }, _callee17, this);
417
436
  }));
418
- function post(_x16, _x17) {
437
+ function post(_x17, _x18) {
419
438
  return _post.apply(this, arguments);
420
439
  }
421
440
  return post;
@@ -480,6 +480,39 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
480
480
  return _createFile.apply(this, arguments);
481
481
  }
482
482
  return createFile;
483
+ }())
484
+ }, {
485
+ key: "loadFile",
486
+ value: function () {
487
+ var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(id) {
488
+ var response, record;
489
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
490
+ while (1) switch (_context11.prev = _context11.next) {
491
+ case 0:
492
+ _context11.prev = 0;
493
+ _context11.next = 3;
494
+ return this.axios.post('/object_service/createObject', ['<@filekit.file>', id]);
495
+ case 3:
496
+ response = _context11.sent;
497
+ record = response.data;
498
+ if (dataHash) {
499
+ record.data = dataHash;
500
+ }
501
+ return _context11.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
502
+ case 9:
503
+ _context11.prev = 9;
504
+ _context11.t0 = _context11["catch"](0);
505
+ return _context11.abrupt("return", this._handleError(_context11.t0));
506
+ case 12:
507
+ case "end":
508
+ return _context11.stop();
509
+ }
510
+ }, _callee11, this, [[0, 9]]);
511
+ }));
512
+ function loadFile(_x7) {
513
+ return _loadFile.apply(this, arguments);
514
+ }
515
+ return loadFile;
483
516
  }()
484
517
  /**
485
518
  * Creates a new object of the given type.
@@ -488,42 +521,41 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
488
521
  * @param {Object} dataHash - The data for the new object.
489
522
  * @returns {Promise<RbtObject>} - The newly created object as an RbtObject.
490
523
  */
491
- )
492
524
  }, {
493
525
  key: "create",
494
526
  value: (function () {
495
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type) {
527
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type) {
496
528
  var dataHash,
497
529
  response,
498
530
  record,
499
- _args11 = arguments;
500
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
501
- while (1) switch (_context11.prev = _context11.next) {
531
+ _args12 = arguments;
532
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
533
+ while (1) switch (_context12.prev = _context12.next) {
502
534
  case 0:
503
- dataHash = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
504
- _context11.prev = 1;
505
- _context11.next = 4;
535
+ dataHash = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
536
+ _context12.prev = 1;
537
+ _context12.next = 4;
506
538
  return this.axios.post('/object_service/createObject', [type, dataHash]);
507
539
  case 4:
508
- response = _context11.sent;
540
+ response = _context12.sent;
509
541
  record = response.data;
510
542
  if (dataHash) {
511
543
  record.data = dataHash;
512
544
  }
513
- return _context11.abrupt("return", new _rbt_object["default"](record, this.axios, {
545
+ return _context12.abrupt("return", new _rbt_object["default"](record, this.axios, {
514
546
  isNew: true
515
547
  }));
516
548
  case 10:
517
- _context11.prev = 10;
518
- _context11.t0 = _context11["catch"](1);
519
- return _context11.abrupt("return", this._handleError(_context11.t0));
549
+ _context12.prev = 10;
550
+ _context12.t0 = _context12["catch"](1);
551
+ return _context12.abrupt("return", this._handleError(_context12.t0));
520
552
  case 13:
521
553
  case "end":
522
- return _context11.stop();
554
+ return _context12.stop();
523
555
  }
524
- }, _callee11, this, [[1, 10]]);
556
+ }, _callee12, this, [[1, 10]]);
525
557
  }));
526
- function create(_x7) {
558
+ function create(_x8) {
527
559
  return _create.apply(this, arguments);
528
560
  }
529
561
  return create;
@@ -560,19 +592,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
560
592
  }, {
561
593
  key: "query",
562
594
  value: (function () {
563
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type) {
595
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(type) {
564
596
  var _this = this;
565
597
  var params,
566
598
  defaultOrderBy,
567
599
  defaultLimit,
568
600
  mergedParams,
569
601
  response,
570
- _args12 = arguments;
571
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
572
- while (1) switch (_context12.prev = _context12.next) {
602
+ _args13 = arguments;
603
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
604
+ while (1) switch (_context13.prev = _context13.next) {
573
605
  case 0:
574
- params = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
575
- _context12.prev = 1;
606
+ params = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {};
607
+ _context13.prev = 1;
576
608
  params.type = type;
577
609
 
578
610
  // Default ordering and pagination
@@ -589,15 +621,15 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
589
621
  }
590
622
  }; // Merge defaults with provided params
591
623
  mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params);
592
- _context12.next = 8;
624
+ _context13.next = 8;
593
625
  return this.axios.post('/object_service/queryObjects', [mergedParams]);
594
626
  case 8:
595
- response = _context12.sent;
627
+ response = _context13.sent;
596
628
  if (!(response.data.ok === false)) {
597
- _context12.next = 11;
629
+ _context13.next = 11;
598
630
  break;
599
631
  }
600
- return _context12.abrupt("return", this._handleError(response));
632
+ return _context13.abrupt("return", this._handleError(response));
601
633
  case 11:
602
634
  // Process items into RbtObject instances
603
635
  if (Array.isArray(response.data.items)) {
@@ -607,18 +639,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
607
639
  });
608
640
  });
609
641
  }
610
- return _context12.abrupt("return", response.data.items);
642
+ return _context13.abrupt("return", response.data.items);
611
643
  case 15:
612
- _context12.prev = 15;
613
- _context12.t0 = _context12["catch"](1);
614
- return _context12.abrupt("return", this._handleError(_context12.t0));
644
+ _context13.prev = 15;
645
+ _context13.t0 = _context13["catch"](1);
646
+ return _context13.abrupt("return", this._handleError(_context13.t0));
615
647
  case 18:
616
648
  case "end":
617
- return _context12.stop();
649
+ return _context13.stop();
618
650
  }
619
- }, _callee12, this, [[1, 15]]);
651
+ }, _callee13, this, [[1, 15]]);
620
652
  }));
621
- function query(_x8) {
653
+ function query(_x9) {
622
654
  return _query.apply(this, arguments);
623
655
  }
624
656
  return query;
@@ -635,47 +667,47 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
635
667
  }, {
636
668
  key: "load",
637
669
  value: (function () {
638
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(type, ids) {
670
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(type, ids) {
639
671
  var params,
640
672
  mergedParams,
641
673
  res,
642
- _args13 = arguments;
643
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
644
- while (1) switch (_context13.prev = _context13.next) {
674
+ _args14 = arguments;
675
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
676
+ while (1) switch (_context14.prev = _context14.next) {
645
677
  case 0:
646
- params = _args13.length > 2 && _args13[2] !== undefined ? _args13[2] : {};
647
- _context13.prev = 1;
678
+ params = _args14.length > 2 && _args14[2] !== undefined ? _args14[2] : {};
679
+ _context14.prev = 1;
648
680
  if (!Array.isArray(ids)) {
649
- _context13.next = 7;
681
+ _context14.next = 7;
650
682
  break;
651
683
  }
652
684
  mergedParams = _objectSpread(_objectSpread({}, params), {}, {
653
685
  where: "id IN (" + ids.join(',') + ")"
654
686
  });
655
- return _context13.abrupt("return", this.query(type, mergedParams));
687
+ return _context14.abrupt("return", this.query(type, mergedParams));
656
688
  case 7:
657
689
  mergedParams = _objectSpread(_objectSpread({}, params), {}, {
658
690
  where: "id=" + ids
659
691
  });
660
- _context13.next = 10;
692
+ _context14.next = 10;
661
693
  return this.query(type, mergedParams);
662
694
  case 10:
663
- res = _context13.sent;
664
- return _context13.abrupt("return", res[0]);
695
+ res = _context14.sent;
696
+ return _context14.abrupt("return", res[0]);
665
697
  case 12:
666
- _context13.next = 17;
698
+ _context14.next = 17;
667
699
  break;
668
700
  case 14:
669
- _context13.prev = 14;
670
- _context13.t0 = _context13["catch"](1);
671
- return _context13.abrupt("return", this._handleError(_context13.t0));
701
+ _context14.prev = 14;
702
+ _context14.t0 = _context14["catch"](1);
703
+ return _context14.abrupt("return", this._handleError(_context14.t0));
672
704
  case 17:
673
705
  case "end":
674
- return _context13.stop();
706
+ return _context14.stop();
675
707
  }
676
- }, _callee13, this, [[1, 14]]);
708
+ }, _callee14, this, [[1, 14]]);
677
709
  }));
678
- function load(_x9, _x10) {
710
+ function load(_x10, _x11) {
679
711
  return _load.apply(this, arguments);
680
712
  }
681
713
  return load;
@@ -697,7 +729,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
697
729
  }, {
698
730
  key: "runTask",
699
731
  value: (function () {
700
- var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
732
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
701
733
  var params,
702
734
  callbacks,
703
735
  onProgress,
@@ -709,20 +741,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
709
741
  status,
710
742
  message,
711
743
  output,
712
- _args14 = arguments;
713
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
714
- while (1) switch (_context14.prev = _context14.next) {
744
+ _args15 = arguments;
745
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
746
+ while (1) switch (_context15.prev = _context15.next) {
715
747
  case 0:
716
- params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
717
- callbacks = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
748
+ params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
749
+ callbacks = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
718
750
  onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
719
- _context14.prev = 3;
720
- _context14.next = 6;
751
+ _context15.prev = 3;
752
+ _context15.next = 6;
721
753
  return this.post('/task_service/runChain', params);
722
754
  case 6:
723
- response = _context14.sent;
755
+ response = _context15.sent;
724
756
  if (response) {
725
- _context14.next = 9;
757
+ _context15.next = 9;
726
758
  break;
727
759
  }
728
760
  throw new Error('Invalid server response');
@@ -730,7 +762,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
730
762
  // Validate response structure
731
763
  ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
732
764
  if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
733
- _context14.next = 12;
765
+ _context15.next = 12;
734
766
  break;
735
767
  }
736
768
  throw new Error('Invalid response structure');
@@ -748,7 +780,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
748
780
  console.log('Finish (request) ', response);
749
781
  onFinish(response);
750
782
  }
751
- return _context14.abrupt("return", {
783
+ return _context15.abrupt("return", {
752
784
  ok: ok,
753
785
  jobId: jobId,
754
786
  status: status,
@@ -756,24 +788,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
756
788
  output: output
757
789
  });
758
790
  case 18:
759
- _context14.prev = 18;
760
- _context14.t0 = _context14["catch"](3);
791
+ _context15.prev = 18;
792
+ _context15.t0 = _context15["catch"](3);
761
793
  if (typeof onError === 'function') {
762
- onError(_context14.t0);
794
+ onError(_context15.t0);
763
795
  } else {
764
- console.error('Error in runTask:', _context14.t0);
796
+ console.error('Error in runTask:', _context15.t0);
765
797
  }
766
- return _context14.abrupt("return", {
798
+ return _context15.abrupt("return", {
767
799
  ok: false,
768
800
  jobId: null,
769
801
  status: 'ERROR',
770
- error: _context14.t0.message
802
+ error: _context15.t0.message
771
803
  });
772
804
  case 22:
773
805
  case "end":
774
- return _context14.stop();
806
+ return _context15.stop();
775
807
  }
776
- }, _callee14, this, [[3, 18]]);
808
+ }, _callee15, this, [[3, 18]]);
777
809
  }));
778
810
  function runTask() {
779
811
  return _runTask.apply(this, arguments);
@@ -794,26 +826,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
794
826
  }, {
795
827
  key: "pollTaskProgress",
796
828
  value: (function () {
797
- var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(jobId, callbacks) {
829
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(jobId, callbacks) {
798
830
  var _this2 = this;
799
831
  var onProgress, onError, onFinish, checkProgress;
800
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
801
- while (1) switch (_context16.prev = _context16.next) {
832
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
833
+ while (1) switch (_context17.prev = _context17.next) {
802
834
  case 0:
803
835
  onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
804
- _context16.prev = 1;
836
+ _context17.prev = 1;
805
837
  checkProgress = /*#__PURE__*/function () {
806
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
838
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
807
839
  var response;
808
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
809
- while (1) switch (_context15.prev = _context15.next) {
840
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
841
+ while (1) switch (_context16.prev = _context16.next) {
810
842
  case 0:
811
- _context15.next = 2;
843
+ _context16.next = 2;
812
844
  return _this2.get("/task_service/pollChainProgress", {
813
845
  jobId: jobId
814
846
  });
815
847
  case 2:
816
- response = _context15.sent;
848
+ response = _context16.sent;
817
849
  // If the task is still in progress, start polling for updates
818
850
  if (response.status === 'DONE' && onFinish) {
819
851
  // Provide the current progress to the callback function
@@ -836,28 +868,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
836
868
  }
837
869
  case 7:
838
870
  case "end":
839
- return _context15.stop();
871
+ return _context16.stop();
840
872
  }
841
- }, _callee15);
873
+ }, _callee16);
842
874
  }));
843
875
  return function checkProgress() {
844
876
  return _ref2.apply(this, arguments);
845
877
  };
846
878
  }();
847
879
  checkProgress();
848
- _context16.next = 9;
880
+ _context17.next = 9;
849
881
  break;
850
882
  case 6:
851
- _context16.prev = 6;
852
- _context16.t0 = _context16["catch"](1);
853
- return _context16.abrupt("return", this._handleError(_context16.t0));
883
+ _context17.prev = 6;
884
+ _context17.t0 = _context17["catch"](1);
885
+ return _context17.abrupt("return", this._handleError(_context17.t0));
854
886
  case 9:
855
887
  case "end":
856
- return _context16.stop();
888
+ return _context17.stop();
857
889
  }
858
- }, _callee16, this, [[1, 6]]);
890
+ }, _callee17, this, [[1, 6]]);
859
891
  }));
860
- function pollTaskProgress(_x11, _x12) {
892
+ function pollTaskProgress(_x12, _x13) {
861
893
  return _pollTaskProgress.apply(this, arguments);
862
894
  }
863
895
  return pollTaskProgress;
@@ -877,46 +909,46 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
877
909
  }, {
878
910
  key: "get",
879
911
  value: (function () {
880
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(endpoint) {
912
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(endpoint) {
881
913
  var params,
882
914
  headers,
883
915
  response,
884
- _args17 = arguments;
885
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
886
- while (1) switch (_context17.prev = _context17.next) {
916
+ _args18 = arguments;
917
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
918
+ while (1) switch (_context18.prev = _context18.next) {
887
919
  case 0:
888
- params = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
920
+ params = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
889
921
  debugger;
890
- _context17.prev = 2;
922
+ _context18.prev = 2;
891
923
  // Add the authToken to the headers
892
924
  headers = {
893
925
  authtoken: this.authtoken
894
926
  }; // Make the GET request using Axios
895
- _context17.next = 6;
927
+ _context18.next = 6;
896
928
  return this.axios.get(endpoint, {
897
929
  params: params,
898
930
  headers: headers
899
931
  });
900
932
  case 6:
901
- response = _context17.sent;
933
+ response = _context18.sent;
902
934
  if (!(response.data.ok === false)) {
903
- _context17.next = 9;
935
+ _context18.next = 9;
904
936
  break;
905
937
  }
906
- return _context17.abrupt("return", this._handleError(response));
938
+ return _context18.abrupt("return", this._handleError(response));
907
939
  case 9:
908
- return _context17.abrupt("return", response.data);
940
+ return _context18.abrupt("return", response.data);
909
941
  case 12:
910
- _context17.prev = 12;
911
- _context17.t0 = _context17["catch"](2);
912
- return _context17.abrupt("return", this._handleError(_context17.t0));
942
+ _context18.prev = 12;
943
+ _context18.t0 = _context18["catch"](2);
944
+ return _context18.abrupt("return", this._handleError(_context18.t0));
913
945
  case 15:
914
946
  case "end":
915
- return _context17.stop();
947
+ return _context18.stop();
916
948
  }
917
- }, _callee17, this, [[2, 12]]);
949
+ }, _callee18, this, [[2, 12]]);
918
950
  }));
919
- function get(_x13) {
951
+ function get(_x14) {
920
952
  return _get.apply(this, arguments);
921
953
  }
922
954
  return get;
@@ -937,44 +969,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
937
969
  }, {
938
970
  key: "post",
939
971
  value: (function () {
940
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(endpoint) {
972
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(endpoint) {
941
973
  var data,
942
974
  headers,
943
975
  response,
944
- _args18 = arguments;
945
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
946
- while (1) switch (_context18.prev = _context18.next) {
976
+ _args19 = arguments;
977
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
978
+ while (1) switch (_context19.prev = _context19.next) {
947
979
  case 0:
948
- data = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
949
- _context18.prev = 1;
980
+ data = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
981
+ _context19.prev = 1;
950
982
  // Add the authToken to the headers
951
983
  headers = {
952
984
  authtoken: this.authtoken
953
985
  }; // Make the POST request using Axios
954
- _context18.next = 5;
986
+ _context19.next = 5;
955
987
  return this.axios.post(endpoint, data, {
956
988
  headers: headers
957
989
  });
958
990
  case 5:
959
- response = _context18.sent;
991
+ response = _context19.sent;
960
992
  if (!(response.data.ok === false)) {
961
- _context18.next = 8;
993
+ _context19.next = 8;
962
994
  break;
963
995
  }
964
- return _context18.abrupt("return", this._handleError(response));
996
+ return _context19.abrupt("return", this._handleError(response));
965
997
  case 8:
966
- return _context18.abrupt("return", response.data);
998
+ return _context19.abrupt("return", response.data);
967
999
  case 11:
968
- _context18.prev = 11;
969
- _context18.t0 = _context18["catch"](1);
970
- return _context18.abrupt("return", this._handleError(_context18.t0));
1000
+ _context19.prev = 11;
1001
+ _context19.t0 = _context19["catch"](1);
1002
+ return _context19.abrupt("return", this._handleError(_context19.t0));
971
1003
  case 14:
972
1004
  case "end":
973
- return _context18.stop();
1005
+ return _context19.stop();
974
1006
  }
975
- }, _callee18, this, [[1, 11]]);
1007
+ }, _callee19, this, [[1, 11]]);
976
1008
  }));
977
- function post(_x14) {
1009
+ function post(_x15) {
978
1010
  return _post.apply(this, arguments);
979
1011
  }
980
1012
  return post;
package/dist/esm/index.js CHANGED
@@ -96,6 +96,9 @@ export default class Roboto {
96
96
  async createFile(data = {}) {
97
97
  return this.api.createFile(data);
98
98
  }
99
+ async loadFile(id) {
100
+ return this.api.loadFile(id);
101
+ }
99
102
 
100
103
  //
101
104
  //
@@ -225,6 +225,19 @@ export default class RbtApi {
225
225
  return this._handleError(e);
226
226
  }
227
227
  }
228
+ async loadFile(id) {
229
+ //return this.create('<@filekit.file>', dataHash);
230
+ try {
231
+ const response = await this.axios.post('/object_service/createObject', ['<@filekit.file>', id]);
232
+ const record = response.data;
233
+ if (dataHash) {
234
+ record.data = dataHash;
235
+ }
236
+ return new RbtFile(record, this.axios, this.localDb);
237
+ } catch (e) {
238
+ return this._handleError(e);
239
+ }
240
+ }
228
241
 
229
242
  /**
230
243
  * Creates a new object of the given type.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/index.js CHANGED
@@ -110,6 +110,9 @@ export default class Roboto{
110
110
  async createFile(data={}){
111
111
  return this.api.createFile(data);
112
112
  }
113
+ async loadFile(id){
114
+ return this.api.loadFile(id);
115
+ }
113
116
 
114
117
  //
115
118
  //
package/src/rbt_api.js CHANGED
@@ -278,6 +278,24 @@ export default class RbtApi {
278
278
  }
279
279
  }
280
280
 
281
+ async loadFile(id){
282
+
283
+ //return this.create('<@filekit.file>', dataHash);
284
+ try {
285
+ const response = await this.axios.post('/object_service/createObject', ['<@filekit.file>', id]);
286
+ const record = response.data;
287
+
288
+ if(dataHash){
289
+ record.data = dataHash;
290
+ }
291
+ return new RbtFile(record, this.axios, this.localDb);
292
+
293
+ } catch (e) {
294
+ return this._handleError(e);
295
+ }
296
+
297
+ }
298
+
281
299
 
282
300
  /**
283
301
  * Creates a new object of the given type.