roboto-js 1.3.10 → 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.
- package/dist/cjs/index.cjs +70 -51
- package/dist/cjs/rbt_api.cjs +155 -123
- package/dist/cjs/rbt_file.cjs +13 -29
- package/dist/esm/index.js +3 -0
- package/dist/esm/rbt_api.js +13 -0
- package/dist/esm/rbt_file.js +2 -2
- package/package.json +1 -1
- package/src/index.js +3 -0
- package/src/rbt_api.js +18 -0
- package/src/rbt_file.js +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -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
|
|
305
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
287
306
|
var data,
|
|
288
|
-
|
|
289
|
-
return _regeneratorRuntime().wrap(function
|
|
290
|
-
while (1) switch (
|
|
307
|
+
_args11 = arguments;
|
|
308
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
309
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
291
310
|
case 0:
|
|
292
|
-
data =
|
|
293
|
-
return
|
|
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
|
|
315
|
+
return _context11.stop();
|
|
297
316
|
}
|
|
298
|
-
},
|
|
317
|
+
}, _callee11, this);
|
|
299
318
|
}));
|
|
300
|
-
function create(
|
|
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
|
|
309
|
-
return _regeneratorRuntime().wrap(function
|
|
310
|
-
while (1) switch (
|
|
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
|
|
331
|
+
return _context12.abrupt("return", this.api.load(type, ids, options));
|
|
313
332
|
case 1:
|
|
314
333
|
case "end":
|
|
315
|
-
return
|
|
334
|
+
return _context12.stop();
|
|
316
335
|
}
|
|
317
|
-
},
|
|
336
|
+
}, _callee12, this);
|
|
318
337
|
}));
|
|
319
|
-
function load(
|
|
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
|
|
328
|
-
return _regeneratorRuntime().wrap(function
|
|
329
|
-
while (1) switch (
|
|
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
|
|
350
|
+
return _context13.abrupt("return", this.api.query(type, params));
|
|
332
351
|
case 1:
|
|
333
352
|
case "end":
|
|
334
|
-
return
|
|
353
|
+
return _context13.stop();
|
|
335
354
|
}
|
|
336
|
-
},
|
|
355
|
+
}, _callee13, this);
|
|
337
356
|
}));
|
|
338
|
-
function query(
|
|
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
|
|
349
|
-
return _regeneratorRuntime().wrap(function
|
|
350
|
-
while (1) switch (
|
|
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
|
|
371
|
+
return _context14.abrupt("return", this.api.runTask(params, callbacks));
|
|
353
372
|
case 1:
|
|
354
373
|
case "end":
|
|
355
|
-
return
|
|
374
|
+
return _context14.stop();
|
|
356
375
|
}
|
|
357
|
-
},
|
|
376
|
+
}, _callee14, this);
|
|
358
377
|
}));
|
|
359
|
-
function runTask(
|
|
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
|
|
368
|
-
return _regeneratorRuntime().wrap(function
|
|
369
|
-
while (1) switch (
|
|
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
|
|
390
|
+
return _context15.abrupt("return", this.api.pollTaskProgress(params));
|
|
372
391
|
case 1:
|
|
373
392
|
case "end":
|
|
374
|
-
return
|
|
393
|
+
return _context15.stop();
|
|
375
394
|
}
|
|
376
|
-
},
|
|
395
|
+
}, _callee15, this);
|
|
377
396
|
}));
|
|
378
|
-
function pollTaskProgress(
|
|
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
|
|
389
|
-
return _regeneratorRuntime().wrap(function
|
|
390
|
-
while (1) switch (
|
|
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
|
|
411
|
+
return _context16.abrupt("return", this.api.get(endpoint, params));
|
|
393
412
|
case 1:
|
|
394
413
|
case "end":
|
|
395
|
-
return
|
|
414
|
+
return _context16.stop();
|
|
396
415
|
}
|
|
397
|
-
},
|
|
416
|
+
}, _callee16, this);
|
|
398
417
|
}));
|
|
399
|
-
function get(
|
|
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
|
|
408
|
-
return _regeneratorRuntime().wrap(function
|
|
409
|
-
while (1) switch (
|
|
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
|
|
430
|
+
return _context17.abrupt("return", this.api.post(endpoint, data));
|
|
412
431
|
case 1:
|
|
413
432
|
case "end":
|
|
414
|
-
return
|
|
433
|
+
return _context17.stop();
|
|
415
434
|
}
|
|
416
|
-
},
|
|
435
|
+
}, _callee17, this);
|
|
417
436
|
}));
|
|
418
|
-
function post(
|
|
437
|
+
function post(_x17, _x18) {
|
|
419
438
|
return _post.apply(this, arguments);
|
|
420
439
|
}
|
|
421
440
|
return post;
|
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -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
|
|
527
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type) {
|
|
496
528
|
var dataHash,
|
|
497
529
|
response,
|
|
498
530
|
record,
|
|
499
|
-
|
|
500
|
-
return _regeneratorRuntime().wrap(function
|
|
501
|
-
while (1) switch (
|
|
531
|
+
_args12 = arguments;
|
|
532
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
533
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
502
534
|
case 0:
|
|
503
|
-
dataHash =
|
|
504
|
-
|
|
505
|
-
|
|
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 =
|
|
540
|
+
response = _context12.sent;
|
|
509
541
|
record = response.data;
|
|
510
542
|
if (dataHash) {
|
|
511
543
|
record.data = dataHash;
|
|
512
544
|
}
|
|
513
|
-
return
|
|
545
|
+
return _context12.abrupt("return", new _rbt_object["default"](record, this.axios, {
|
|
514
546
|
isNew: true
|
|
515
547
|
}));
|
|
516
548
|
case 10:
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
return
|
|
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
|
|
554
|
+
return _context12.stop();
|
|
523
555
|
}
|
|
524
|
-
},
|
|
556
|
+
}, _callee12, this, [[1, 10]]);
|
|
525
557
|
}));
|
|
526
|
-
function create(
|
|
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
|
|
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
|
-
|
|
571
|
-
return _regeneratorRuntime().wrap(function
|
|
572
|
-
while (1) switch (
|
|
602
|
+
_args13 = arguments;
|
|
603
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
604
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
573
605
|
case 0:
|
|
574
|
-
params =
|
|
575
|
-
|
|
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
|
-
|
|
624
|
+
_context13.next = 8;
|
|
593
625
|
return this.axios.post('/object_service/queryObjects', [mergedParams]);
|
|
594
626
|
case 8:
|
|
595
|
-
response =
|
|
627
|
+
response = _context13.sent;
|
|
596
628
|
if (!(response.data.ok === false)) {
|
|
597
|
-
|
|
629
|
+
_context13.next = 11;
|
|
598
630
|
break;
|
|
599
631
|
}
|
|
600
|
-
return
|
|
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
|
|
642
|
+
return _context13.abrupt("return", response.data.items);
|
|
611
643
|
case 15:
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
return
|
|
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
|
|
649
|
+
return _context13.stop();
|
|
618
650
|
}
|
|
619
|
-
},
|
|
651
|
+
}, _callee13, this, [[1, 15]]);
|
|
620
652
|
}));
|
|
621
|
-
function query(
|
|
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
|
|
670
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(type, ids) {
|
|
639
671
|
var params,
|
|
640
672
|
mergedParams,
|
|
641
673
|
res,
|
|
642
|
-
|
|
643
|
-
return _regeneratorRuntime().wrap(function
|
|
644
|
-
while (1) switch (
|
|
674
|
+
_args14 = arguments;
|
|
675
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
676
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
645
677
|
case 0:
|
|
646
|
-
params =
|
|
647
|
-
|
|
678
|
+
params = _args14.length > 2 && _args14[2] !== undefined ? _args14[2] : {};
|
|
679
|
+
_context14.prev = 1;
|
|
648
680
|
if (!Array.isArray(ids)) {
|
|
649
|
-
|
|
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
|
|
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
|
-
|
|
692
|
+
_context14.next = 10;
|
|
661
693
|
return this.query(type, mergedParams);
|
|
662
694
|
case 10:
|
|
663
|
-
res =
|
|
664
|
-
return
|
|
695
|
+
res = _context14.sent;
|
|
696
|
+
return _context14.abrupt("return", res[0]);
|
|
665
697
|
case 12:
|
|
666
|
-
|
|
698
|
+
_context14.next = 17;
|
|
667
699
|
break;
|
|
668
700
|
case 14:
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
return
|
|
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
|
|
706
|
+
return _context14.stop();
|
|
675
707
|
}
|
|
676
|
-
},
|
|
708
|
+
}, _callee14, this, [[1, 14]]);
|
|
677
709
|
}));
|
|
678
|
-
function load(
|
|
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
|
|
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
|
-
|
|
713
|
-
return _regeneratorRuntime().wrap(function
|
|
714
|
-
while (1) switch (
|
|
744
|
+
_args15 = arguments;
|
|
745
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
746
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
715
747
|
case 0:
|
|
716
|
-
params =
|
|
717
|
-
callbacks =
|
|
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
|
-
|
|
720
|
-
|
|
751
|
+
_context15.prev = 3;
|
|
752
|
+
_context15.next = 6;
|
|
721
753
|
return this.post('/task_service/runChain', params);
|
|
722
754
|
case 6:
|
|
723
|
-
response =
|
|
755
|
+
response = _context15.sent;
|
|
724
756
|
if (response) {
|
|
725
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
760
|
-
|
|
791
|
+
_context15.prev = 18;
|
|
792
|
+
_context15.t0 = _context15["catch"](3);
|
|
761
793
|
if (typeof onError === 'function') {
|
|
762
|
-
onError(
|
|
794
|
+
onError(_context15.t0);
|
|
763
795
|
} else {
|
|
764
|
-
console.error('Error in runTask:',
|
|
796
|
+
console.error('Error in runTask:', _context15.t0);
|
|
765
797
|
}
|
|
766
|
-
return
|
|
798
|
+
return _context15.abrupt("return", {
|
|
767
799
|
ok: false,
|
|
768
800
|
jobId: null,
|
|
769
801
|
status: 'ERROR',
|
|
770
|
-
error:
|
|
802
|
+
error: _context15.t0.message
|
|
771
803
|
});
|
|
772
804
|
case 22:
|
|
773
805
|
case "end":
|
|
774
|
-
return
|
|
806
|
+
return _context15.stop();
|
|
775
807
|
}
|
|
776
|
-
},
|
|
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
|
|
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
|
|
801
|
-
while (1) switch (
|
|
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
|
-
|
|
836
|
+
_context17.prev = 1;
|
|
805
837
|
checkProgress = /*#__PURE__*/function () {
|
|
806
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
838
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
807
839
|
var response;
|
|
808
|
-
return _regeneratorRuntime().wrap(function
|
|
809
|
-
while (1) switch (
|
|
840
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
841
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
810
842
|
case 0:
|
|
811
|
-
|
|
843
|
+
_context16.next = 2;
|
|
812
844
|
return _this2.get("/task_service/pollChainProgress", {
|
|
813
845
|
jobId: jobId
|
|
814
846
|
});
|
|
815
847
|
case 2:
|
|
816
|
-
response =
|
|
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
|
|
871
|
+
return _context16.stop();
|
|
840
872
|
}
|
|
841
|
-
},
|
|
873
|
+
}, _callee16);
|
|
842
874
|
}));
|
|
843
875
|
return function checkProgress() {
|
|
844
876
|
return _ref2.apply(this, arguments);
|
|
845
877
|
};
|
|
846
878
|
}();
|
|
847
879
|
checkProgress();
|
|
848
|
-
|
|
880
|
+
_context17.next = 9;
|
|
849
881
|
break;
|
|
850
882
|
case 6:
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
return
|
|
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
|
|
888
|
+
return _context17.stop();
|
|
857
889
|
}
|
|
858
|
-
},
|
|
890
|
+
}, _callee17, this, [[1, 6]]);
|
|
859
891
|
}));
|
|
860
|
-
function pollTaskProgress(
|
|
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
|
|
912
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(endpoint) {
|
|
881
913
|
var params,
|
|
882
914
|
headers,
|
|
883
915
|
response,
|
|
884
|
-
|
|
885
|
-
return _regeneratorRuntime().wrap(function
|
|
886
|
-
while (1) switch (
|
|
916
|
+
_args18 = arguments;
|
|
917
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
918
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
887
919
|
case 0:
|
|
888
|
-
params =
|
|
920
|
+
params = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
|
|
889
921
|
debugger;
|
|
890
|
-
|
|
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
|
-
|
|
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 =
|
|
933
|
+
response = _context18.sent;
|
|
902
934
|
if (!(response.data.ok === false)) {
|
|
903
|
-
|
|
935
|
+
_context18.next = 9;
|
|
904
936
|
break;
|
|
905
937
|
}
|
|
906
|
-
return
|
|
938
|
+
return _context18.abrupt("return", this._handleError(response));
|
|
907
939
|
case 9:
|
|
908
|
-
return
|
|
940
|
+
return _context18.abrupt("return", response.data);
|
|
909
941
|
case 12:
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
return
|
|
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
|
|
947
|
+
return _context18.stop();
|
|
916
948
|
}
|
|
917
|
-
},
|
|
949
|
+
}, _callee18, this, [[2, 12]]);
|
|
918
950
|
}));
|
|
919
|
-
function get(
|
|
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
|
|
972
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(endpoint) {
|
|
941
973
|
var data,
|
|
942
974
|
headers,
|
|
943
975
|
response,
|
|
944
|
-
|
|
945
|
-
return _regeneratorRuntime().wrap(function
|
|
946
|
-
while (1) switch (
|
|
976
|
+
_args19 = arguments;
|
|
977
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
978
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
947
979
|
case 0:
|
|
948
|
-
data =
|
|
949
|
-
|
|
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
|
-
|
|
986
|
+
_context19.next = 5;
|
|
955
987
|
return this.axios.post(endpoint, data, {
|
|
956
988
|
headers: headers
|
|
957
989
|
});
|
|
958
990
|
case 5:
|
|
959
|
-
response =
|
|
991
|
+
response = _context19.sent;
|
|
960
992
|
if (!(response.data.ok === false)) {
|
|
961
|
-
|
|
993
|
+
_context19.next = 8;
|
|
962
994
|
break;
|
|
963
995
|
}
|
|
964
|
-
return
|
|
996
|
+
return _context19.abrupt("return", this._handleError(response));
|
|
965
997
|
case 8:
|
|
966
|
-
return
|
|
998
|
+
return _context19.abrupt("return", response.data);
|
|
967
999
|
case 11:
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
return
|
|
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
|
|
1005
|
+
return _context19.stop();
|
|
974
1006
|
}
|
|
975
|
-
},
|
|
1007
|
+
}, _callee19, this, [[1, 11]]);
|
|
976
1008
|
}));
|
|
977
|
-
function post(
|
|
1009
|
+
function post(_x15) {
|
|
978
1010
|
return _post.apply(this, arguments);
|
|
979
1011
|
}
|
|
980
1012
|
return post;
|
package/dist/cjs/rbt_file.cjs
CHANGED
|
@@ -45,30 +45,14 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
45
45
|
}
|
|
46
46
|
_createClass(RbtFile, [{
|
|
47
47
|
key: "get",
|
|
48
|
-
value: function (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
get.toString = function () {
|
|
53
|
-
return _get.toString();
|
|
54
|
-
};
|
|
55
|
-
return get;
|
|
56
|
-
}(function (path) {
|
|
57
|
-
return get(this._data, path);
|
|
58
|
-
})
|
|
48
|
+
value: function get(path) {
|
|
49
|
+
return _lodash["default"].get(this._data, path);
|
|
50
|
+
}
|
|
59
51
|
}, {
|
|
60
52
|
key: "set",
|
|
61
|
-
value: function (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
set.toString = function () {
|
|
66
|
-
return _set.toString();
|
|
67
|
-
};
|
|
68
|
-
return set;
|
|
69
|
-
}(function (path, value) {
|
|
70
|
-
set(this._data, path, value);
|
|
71
|
-
})
|
|
53
|
+
value: function set(path, value) {
|
|
54
|
+
_lodash["default"].set(this._data, path, value);
|
|
55
|
+
}
|
|
72
56
|
}, {
|
|
73
57
|
key: "getData",
|
|
74
58
|
value: function getData() {
|
|
@@ -258,7 +242,7 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
258
242
|
}
|
|
259
243
|
}, _callee4);
|
|
260
244
|
}));
|
|
261
|
-
return function (
|
|
245
|
+
return function (_x2) {
|
|
262
246
|
return _ref.apply(this, arguments);
|
|
263
247
|
};
|
|
264
248
|
}();
|
|
@@ -290,7 +274,7 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
290
274
|
}
|
|
291
275
|
}, _callee5, this);
|
|
292
276
|
}));
|
|
293
|
-
function readAndStoreFile(
|
|
277
|
+
function readAndStoreFile(_x) {
|
|
294
278
|
return _readAndStoreFile.apply(this, arguments);
|
|
295
279
|
}
|
|
296
280
|
return readAndStoreFile;
|
|
@@ -340,7 +324,7 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
340
324
|
}
|
|
341
325
|
}, _callee6, this);
|
|
342
326
|
}));
|
|
343
|
-
function _storeChunkInIDB(
|
|
327
|
+
function _storeChunkInIDB(_x3, _x4, _x5) {
|
|
344
328
|
return _storeChunkInIDB2.apply(this, arguments);
|
|
345
329
|
}
|
|
346
330
|
return _storeChunkInIDB;
|
|
@@ -374,7 +358,7 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
374
358
|
}
|
|
375
359
|
}, _callee7, this);
|
|
376
360
|
}));
|
|
377
|
-
function _readFrameFromIDB(
|
|
361
|
+
function _readFrameFromIDB(_x6) {
|
|
378
362
|
return _readFrameFromIDB2.apply(this, arguments);
|
|
379
363
|
}
|
|
380
364
|
return _readFrameFromIDB;
|
|
@@ -492,7 +476,7 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
492
476
|
}
|
|
493
477
|
}, _callee9, this);
|
|
494
478
|
}));
|
|
495
|
-
function _uploadFrameToServer(
|
|
479
|
+
function _uploadFrameToServer(_x7, _x8, _x9, _x10) {
|
|
496
480
|
return _uploadFrameToServer2.apply(this, arguments);
|
|
497
481
|
}
|
|
498
482
|
return _uploadFrameToServer;
|
|
@@ -543,7 +527,7 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
543
527
|
}
|
|
544
528
|
}, _callee11);
|
|
545
529
|
}));
|
|
546
|
-
function _checkUploadStatusUntilDone(
|
|
530
|
+
function _checkUploadStatusUntilDone(_x11) {
|
|
547
531
|
return _checkUploadStatusUntilDone2.apply(this, arguments);
|
|
548
532
|
}
|
|
549
533
|
return _checkUploadStatusUntilDone;
|
|
@@ -579,7 +563,7 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
579
563
|
}
|
|
580
564
|
}, _callee12, this);
|
|
581
565
|
}));
|
|
582
|
-
function _uploadGetStatusUpdate(
|
|
566
|
+
function _uploadGetStatusUpdate(_x12) {
|
|
583
567
|
return _uploadGetStatusUpdate2.apply(this, arguments);
|
|
584
568
|
}
|
|
585
569
|
return _uploadGetStatusUpdate;
|
package/dist/esm/index.js
CHANGED
package/dist/esm/rbt_api.js
CHANGED
|
@@ -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/dist/esm/rbt_file.js
CHANGED
|
@@ -14,10 +14,10 @@ export default class RbtFile extends EventEmitter {
|
|
|
14
14
|
this.fileHeader = {};
|
|
15
15
|
}
|
|
16
16
|
get(path) {
|
|
17
|
-
return get(this._data, path);
|
|
17
|
+
return _.get(this._data, path);
|
|
18
18
|
}
|
|
19
19
|
set(path, value) {
|
|
20
|
-
set(this._data, path, value);
|
|
20
|
+
_.set(this._data, path, value);
|
|
21
21
|
}
|
|
22
22
|
getData() {
|
|
23
23
|
return {
|
package/package.json
CHANGED
package/src/index.js
CHANGED
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.
|
package/src/rbt_file.js
CHANGED
|
@@ -20,11 +20,11 @@ export default class RbtFile extends EventEmitter{
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
get(path) {
|
|
23
|
-
return get(this._data, path);
|
|
23
|
+
return _.get(this._data, path);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
set(path, value) {
|
|
27
|
-
set(this._data, path, value);
|
|
27
|
+
_.set(this._data, path, value);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
getData() {
|