roboto-js 1.1.5 → 1.1.6
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 +81 -62
- package/dist/cjs/rbt_api.cjs +199 -162
- package/dist/esm/index.js +81 -62
- package/dist/esm/rbt_api.js +199 -162
- package/package.json +1 -1
- package/src/index.js +6 -0
- package/src/rbt_api.js +20 -6
package/dist/esm/rbt_api.js
CHANGED
|
@@ -214,30 +214,67 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
214
214
|
return loadCurrentUser;
|
|
215
215
|
}()
|
|
216
216
|
}, {
|
|
217
|
-
key: "
|
|
217
|
+
key: "loadUser",
|
|
218
218
|
value: function () {
|
|
219
|
-
var
|
|
220
|
-
var response;
|
|
219
|
+
var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(userId) {
|
|
220
|
+
var params, _response$data2, response, userData, User;
|
|
221
221
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
222
222
|
while (1) switch (_context5.prev = _context5.next) {
|
|
223
223
|
case 0:
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
params = {
|
|
225
|
+
id: userId
|
|
226
|
+
};
|
|
227
|
+
_context5.prev = 1;
|
|
228
|
+
_context5.next = 4;
|
|
229
|
+
return this.axios.post('/user_service/loadUser', [params]);
|
|
230
|
+
case 4:
|
|
231
|
+
response = _context5.sent;
|
|
232
|
+
userData = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.user;
|
|
233
|
+
User = new _rbt_user["default"]({
|
|
234
|
+
id: userData.id
|
|
235
|
+
}, this.axios);
|
|
236
|
+
User.setData(userData);
|
|
237
|
+
return _context5.abrupt("return", User);
|
|
238
|
+
case 11:
|
|
239
|
+
_context5.prev = 11;
|
|
240
|
+
_context5.t0 = _context5["catch"](1);
|
|
241
|
+
return _context5.abrupt("return", this._handleError(_context5.t0));
|
|
242
|
+
case 14:
|
|
243
|
+
case "end":
|
|
244
|
+
return _context5.stop();
|
|
245
|
+
}
|
|
246
|
+
}, _callee5, this, [[1, 11]]);
|
|
247
|
+
}));
|
|
248
|
+
function loadUser(_x2) {
|
|
249
|
+
return _loadUser.apply(this, arguments);
|
|
250
|
+
}
|
|
251
|
+
return loadUser;
|
|
252
|
+
}()
|
|
253
|
+
}, {
|
|
254
|
+
key: "refreshAuthToken",
|
|
255
|
+
value: function () {
|
|
256
|
+
var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(authtoken) {
|
|
257
|
+
var response;
|
|
258
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
259
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
260
|
+
case 0:
|
|
261
|
+
_context6.prev = 0;
|
|
262
|
+
_context6.next = 3;
|
|
226
263
|
return this.axios.post('/user_service/refreshAuthToken', [authtoken]);
|
|
227
264
|
case 3:
|
|
228
|
-
response =
|
|
229
|
-
return
|
|
265
|
+
response = _context6.sent;
|
|
266
|
+
return _context6.abrupt("return", response.data);
|
|
230
267
|
case 7:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
this._handleError(
|
|
268
|
+
_context6.prev = 7;
|
|
269
|
+
_context6.t0 = _context6["catch"](0);
|
|
270
|
+
this._handleError(_context6.t0);
|
|
234
271
|
case 10:
|
|
235
272
|
case "end":
|
|
236
|
-
return
|
|
273
|
+
return _context6.stop();
|
|
237
274
|
}
|
|
238
|
-
},
|
|
275
|
+
}, _callee6, this, [[0, 7]]);
|
|
239
276
|
}));
|
|
240
|
-
function refreshAuthToken(
|
|
277
|
+
function refreshAuthToken(_x3) {
|
|
241
278
|
return _refreshAuthToken.apply(this, arguments);
|
|
242
279
|
}
|
|
243
280
|
return refreshAuthToken;
|
|
@@ -252,35 +289,35 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
252
289
|
}, {
|
|
253
290
|
key: "registerUser",
|
|
254
291
|
value: function () {
|
|
255
|
-
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
292
|
+
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
256
293
|
var dataHash,
|
|
257
294
|
response,
|
|
258
295
|
record,
|
|
259
|
-
|
|
260
|
-
return _regeneratorRuntime().wrap(function
|
|
261
|
-
while (1) switch (
|
|
296
|
+
_args7 = arguments;
|
|
297
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
298
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
262
299
|
case 0:
|
|
263
|
-
dataHash =
|
|
264
|
-
|
|
265
|
-
|
|
300
|
+
dataHash = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
301
|
+
_context7.prev = 1;
|
|
302
|
+
_context7.next = 4;
|
|
266
303
|
return this.axios.post('/user_service/registerUser', [dataHash]);
|
|
267
304
|
case 4:
|
|
268
|
-
response =
|
|
305
|
+
response = _context7.sent;
|
|
269
306
|
record = response.data;
|
|
270
307
|
if (dataHash) {
|
|
271
308
|
record.data = dataHash;
|
|
272
309
|
}
|
|
273
|
-
return
|
|
310
|
+
return _context7.abrupt("return", new _rbt_user["default"](record, this.axios));
|
|
274
311
|
case 10:
|
|
275
|
-
|
|
276
|
-
|
|
312
|
+
_context7.prev = 10;
|
|
313
|
+
_context7.t0 = _context7["catch"](1);
|
|
277
314
|
debugger;
|
|
278
|
-
return
|
|
315
|
+
return _context7.abrupt("return", this._handleError(_context7.t0));
|
|
279
316
|
case 14:
|
|
280
317
|
case "end":
|
|
281
|
-
return
|
|
318
|
+
return _context7.stop();
|
|
282
319
|
}
|
|
283
|
-
},
|
|
320
|
+
}, _callee7, this, [[1, 10]]);
|
|
284
321
|
}));
|
|
285
322
|
function registerUser() {
|
|
286
323
|
return _registerUser.apply(this, arguments);
|
|
@@ -297,32 +334,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
297
334
|
}, {
|
|
298
335
|
key: "createFile",
|
|
299
336
|
value: function () {
|
|
300
|
-
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
337
|
+
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(dataHash) {
|
|
301
338
|
var response, record;
|
|
302
|
-
return _regeneratorRuntime().wrap(function
|
|
303
|
-
while (1) switch (
|
|
339
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
340
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
304
341
|
case 0:
|
|
305
|
-
|
|
306
|
-
|
|
342
|
+
_context8.prev = 0;
|
|
343
|
+
_context8.next = 3;
|
|
307
344
|
return this.axios.post('/object_service/createObject', ['<@filekit.file>', dataHash]);
|
|
308
345
|
case 3:
|
|
309
|
-
response =
|
|
346
|
+
response = _context8.sent;
|
|
310
347
|
record = response.data;
|
|
311
348
|
if (dataHash) {
|
|
312
349
|
record.data = dataHash;
|
|
313
350
|
}
|
|
314
|
-
return
|
|
351
|
+
return _context8.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
|
|
315
352
|
case 9:
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return
|
|
353
|
+
_context8.prev = 9;
|
|
354
|
+
_context8.t0 = _context8["catch"](0);
|
|
355
|
+
return _context8.abrupt("return", this._handleError(_context8.t0));
|
|
319
356
|
case 12:
|
|
320
357
|
case "end":
|
|
321
|
-
return
|
|
358
|
+
return _context8.stop();
|
|
322
359
|
}
|
|
323
|
-
},
|
|
360
|
+
}, _callee8, this, [[0, 9]]);
|
|
324
361
|
}));
|
|
325
|
-
function createFile(
|
|
362
|
+
function createFile(_x4) {
|
|
326
363
|
return _createFile.apply(this, arguments);
|
|
327
364
|
}
|
|
328
365
|
return createFile;
|
|
@@ -337,38 +374,38 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
337
374
|
}, {
|
|
338
375
|
key: "create",
|
|
339
376
|
value: function () {
|
|
340
|
-
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
377
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(type) {
|
|
341
378
|
var dataHash,
|
|
342
379
|
response,
|
|
343
380
|
record,
|
|
344
|
-
|
|
345
|
-
return _regeneratorRuntime().wrap(function
|
|
346
|
-
while (1) switch (
|
|
381
|
+
_args9 = arguments;
|
|
382
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
383
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
347
384
|
case 0:
|
|
348
|
-
dataHash =
|
|
349
|
-
|
|
350
|
-
|
|
385
|
+
dataHash = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {};
|
|
386
|
+
_context9.prev = 1;
|
|
387
|
+
_context9.next = 4;
|
|
351
388
|
return this.axios.post('/object_service/createObject', [type, dataHash]);
|
|
352
389
|
case 4:
|
|
353
|
-
response =
|
|
390
|
+
response = _context9.sent;
|
|
354
391
|
record = response.data;
|
|
355
392
|
if (dataHash) {
|
|
356
393
|
record.data = dataHash;
|
|
357
394
|
}
|
|
358
|
-
return
|
|
395
|
+
return _context9.abrupt("return", new _rbt_object["default"](record, this.axios, {
|
|
359
396
|
isNew: true
|
|
360
397
|
}));
|
|
361
398
|
case 10:
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return
|
|
399
|
+
_context9.prev = 10;
|
|
400
|
+
_context9.t0 = _context9["catch"](1);
|
|
401
|
+
return _context9.abrupt("return", this._handleError(_context9.t0));
|
|
365
402
|
case 13:
|
|
366
403
|
case "end":
|
|
367
|
-
return
|
|
404
|
+
return _context9.stop();
|
|
368
405
|
}
|
|
369
|
-
},
|
|
406
|
+
}, _callee9, this, [[1, 10]]);
|
|
370
407
|
}));
|
|
371
|
-
function create(
|
|
408
|
+
function create(_x5) {
|
|
372
409
|
return _create.apply(this, arguments);
|
|
373
410
|
}
|
|
374
411
|
return create;
|
|
@@ -404,19 +441,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
404
441
|
}, {
|
|
405
442
|
key: "query",
|
|
406
443
|
value: function () {
|
|
407
|
-
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
444
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(type) {
|
|
408
445
|
var _this = this;
|
|
409
446
|
var params,
|
|
410
447
|
defaultOrderBy,
|
|
411
448
|
defaultLimit,
|
|
412
449
|
mergedParams,
|
|
413
450
|
response,
|
|
414
|
-
|
|
415
|
-
return _regeneratorRuntime().wrap(function
|
|
416
|
-
while (1) switch (
|
|
451
|
+
_args10 = arguments;
|
|
452
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
453
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
417
454
|
case 0:
|
|
418
|
-
params =
|
|
419
|
-
|
|
455
|
+
params = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
|
|
456
|
+
_context10.prev = 1;
|
|
420
457
|
params.type = type;
|
|
421
458
|
|
|
422
459
|
// Default ordering and pagination
|
|
@@ -433,15 +470,15 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
433
470
|
}
|
|
434
471
|
}; // Merge defaults with provided params
|
|
435
472
|
mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params);
|
|
436
|
-
|
|
473
|
+
_context10.next = 8;
|
|
437
474
|
return this.axios.post('/object_service/queryObjects', [mergedParams]);
|
|
438
475
|
case 8:
|
|
439
|
-
response =
|
|
476
|
+
response = _context10.sent;
|
|
440
477
|
if (!(response.data.ok === false)) {
|
|
441
|
-
|
|
478
|
+
_context10.next = 11;
|
|
442
479
|
break;
|
|
443
480
|
}
|
|
444
|
-
return
|
|
481
|
+
return _context10.abrupt("return", this._handleError(response));
|
|
445
482
|
case 11:
|
|
446
483
|
// Process items into RbtObject instances
|
|
447
484
|
if (Array.isArray(response.data.items)) {
|
|
@@ -451,18 +488,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
451
488
|
});
|
|
452
489
|
});
|
|
453
490
|
}
|
|
454
|
-
return
|
|
491
|
+
return _context10.abrupt("return", response.data.items);
|
|
455
492
|
case 15:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
return
|
|
493
|
+
_context10.prev = 15;
|
|
494
|
+
_context10.t0 = _context10["catch"](1);
|
|
495
|
+
return _context10.abrupt("return", this._handleError(_context10.t0));
|
|
459
496
|
case 18:
|
|
460
497
|
case "end":
|
|
461
|
-
return
|
|
498
|
+
return _context10.stop();
|
|
462
499
|
}
|
|
463
|
-
},
|
|
500
|
+
}, _callee10, this, [[1, 15]]);
|
|
464
501
|
}));
|
|
465
|
-
function query(
|
|
502
|
+
function query(_x6) {
|
|
466
503
|
return _query.apply(this, arguments);
|
|
467
504
|
}
|
|
468
505
|
return query;
|
|
@@ -478,47 +515,47 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
478
515
|
}, {
|
|
479
516
|
key: "load",
|
|
480
517
|
value: function () {
|
|
481
|
-
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
518
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type, ids) {
|
|
482
519
|
var params,
|
|
483
520
|
mergedParams,
|
|
484
521
|
res,
|
|
485
|
-
|
|
486
|
-
return _regeneratorRuntime().wrap(function
|
|
487
|
-
while (1) switch (
|
|
522
|
+
_args11 = arguments;
|
|
523
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
524
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
488
525
|
case 0:
|
|
489
|
-
params =
|
|
490
|
-
|
|
526
|
+
params = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
527
|
+
_context11.prev = 1;
|
|
491
528
|
if (!Array.isArray(ids)) {
|
|
492
|
-
|
|
529
|
+
_context11.next = 7;
|
|
493
530
|
break;
|
|
494
531
|
}
|
|
495
532
|
mergedParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
496
533
|
where: "id IN (" + ids.join(',') + ")"
|
|
497
534
|
});
|
|
498
|
-
return
|
|
535
|
+
return _context11.abrupt("return", this.query(type, mergedParams));
|
|
499
536
|
case 7:
|
|
500
537
|
mergedParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
501
538
|
where: "id=" + ids
|
|
502
539
|
});
|
|
503
|
-
|
|
540
|
+
_context11.next = 10;
|
|
504
541
|
return this.query(type, mergedParams);
|
|
505
542
|
case 10:
|
|
506
|
-
res =
|
|
507
|
-
return
|
|
543
|
+
res = _context11.sent;
|
|
544
|
+
return _context11.abrupt("return", res[0]);
|
|
508
545
|
case 12:
|
|
509
|
-
|
|
546
|
+
_context11.next = 17;
|
|
510
547
|
break;
|
|
511
548
|
case 14:
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
return
|
|
549
|
+
_context11.prev = 14;
|
|
550
|
+
_context11.t0 = _context11["catch"](1);
|
|
551
|
+
return _context11.abrupt("return", this._handleError(_context11.t0));
|
|
515
552
|
case 17:
|
|
516
553
|
case "end":
|
|
517
|
-
return
|
|
554
|
+
return _context11.stop();
|
|
518
555
|
}
|
|
519
|
-
},
|
|
556
|
+
}, _callee11, this, [[1, 14]]);
|
|
520
557
|
}));
|
|
521
|
-
function load(
|
|
558
|
+
function load(_x7, _x8) {
|
|
522
559
|
return _load.apply(this, arguments);
|
|
523
560
|
}
|
|
524
561
|
return load;
|
|
@@ -539,7 +576,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
539
576
|
}, {
|
|
540
577
|
key: "runTask",
|
|
541
578
|
value: function () {
|
|
542
|
-
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
579
|
+
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
543
580
|
var params,
|
|
544
581
|
callbacks,
|
|
545
582
|
onProgress,
|
|
@@ -551,20 +588,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
551
588
|
status,
|
|
552
589
|
message,
|
|
553
590
|
output,
|
|
554
|
-
|
|
555
|
-
return _regeneratorRuntime().wrap(function
|
|
556
|
-
while (1) switch (
|
|
591
|
+
_args12 = arguments;
|
|
592
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
593
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
557
594
|
case 0:
|
|
558
|
-
params =
|
|
559
|
-
callbacks =
|
|
595
|
+
params = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
|
|
596
|
+
callbacks = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
560
597
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
|
|
561
|
-
|
|
562
|
-
|
|
598
|
+
_context12.prev = 3;
|
|
599
|
+
_context12.next = 6;
|
|
563
600
|
return this.post('http://localhost:3004/runChain', params);
|
|
564
601
|
case 6:
|
|
565
|
-
response =
|
|
602
|
+
response = _context12.sent;
|
|
566
603
|
if (response) {
|
|
567
|
-
|
|
604
|
+
_context12.next = 9;
|
|
568
605
|
break;
|
|
569
606
|
}
|
|
570
607
|
throw new Error('Invalid server response');
|
|
@@ -572,7 +609,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
572
609
|
// Validate response structure
|
|
573
610
|
ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
|
|
574
611
|
if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
|
|
575
|
-
|
|
612
|
+
_context12.next = 12;
|
|
576
613
|
break;
|
|
577
614
|
}
|
|
578
615
|
throw new Error('Invalid response structure');
|
|
@@ -590,7 +627,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
590
627
|
console.log('Finish (request) ', response);
|
|
591
628
|
onFinish(response);
|
|
592
629
|
}
|
|
593
|
-
return
|
|
630
|
+
return _context12.abrupt("return", {
|
|
594
631
|
ok: ok,
|
|
595
632
|
jobId: jobId,
|
|
596
633
|
status: status,
|
|
@@ -598,24 +635,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
598
635
|
output: output
|
|
599
636
|
});
|
|
600
637
|
case 18:
|
|
601
|
-
|
|
602
|
-
|
|
638
|
+
_context12.prev = 18;
|
|
639
|
+
_context12.t0 = _context12["catch"](3);
|
|
603
640
|
if (typeof onError === 'function') {
|
|
604
|
-
onError(
|
|
641
|
+
onError(_context12.t0);
|
|
605
642
|
} else {
|
|
606
|
-
console.error('Error in runTask:',
|
|
643
|
+
console.error('Error in runTask:', _context12.t0);
|
|
607
644
|
}
|
|
608
|
-
return
|
|
645
|
+
return _context12.abrupt("return", {
|
|
609
646
|
ok: false,
|
|
610
647
|
jobId: null,
|
|
611
648
|
status: 'ERROR',
|
|
612
|
-
error:
|
|
649
|
+
error: _context12.t0.message
|
|
613
650
|
});
|
|
614
651
|
case 22:
|
|
615
652
|
case "end":
|
|
616
|
-
return
|
|
653
|
+
return _context12.stop();
|
|
617
654
|
}
|
|
618
|
-
},
|
|
655
|
+
}, _callee12, this, [[3, 18]]);
|
|
619
656
|
}));
|
|
620
657
|
function runTask() {
|
|
621
658
|
return _runTask.apply(this, arguments);
|
|
@@ -635,26 +672,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
635
672
|
}, {
|
|
636
673
|
key: "pollTaskProgress",
|
|
637
674
|
value: function () {
|
|
638
|
-
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
675
|
+
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(jobId, callbacks) {
|
|
639
676
|
var _this2 = this;
|
|
640
677
|
var onProgress, onError, onFinish, checkProgress;
|
|
641
|
-
return _regeneratorRuntime().wrap(function
|
|
642
|
-
while (1) switch (
|
|
678
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
679
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
643
680
|
case 0:
|
|
644
681
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
|
|
645
|
-
|
|
682
|
+
_context14.prev = 1;
|
|
646
683
|
checkProgress = /*#__PURE__*/function () {
|
|
647
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
684
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
648
685
|
var response;
|
|
649
|
-
return _regeneratorRuntime().wrap(function
|
|
650
|
-
while (1) switch (
|
|
686
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
687
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
651
688
|
case 0:
|
|
652
|
-
|
|
689
|
+
_context13.next = 2;
|
|
653
690
|
return _this2.get("http://localhost:3004/pollChainProgress", {
|
|
654
691
|
jobId: jobId
|
|
655
692
|
});
|
|
656
693
|
case 2:
|
|
657
|
-
response =
|
|
694
|
+
response = _context13.sent;
|
|
658
695
|
// If the task is still in progress, start polling for updates
|
|
659
696
|
if (response.status === 'DONE' && onFinish) {
|
|
660
697
|
// Provide the current progress to the callback function
|
|
@@ -677,28 +714,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
677
714
|
}
|
|
678
715
|
case 7:
|
|
679
716
|
case "end":
|
|
680
|
-
return
|
|
717
|
+
return _context13.stop();
|
|
681
718
|
}
|
|
682
|
-
},
|
|
719
|
+
}, _callee13);
|
|
683
720
|
}));
|
|
684
721
|
return function checkProgress() {
|
|
685
722
|
return _ref2.apply(this, arguments);
|
|
686
723
|
};
|
|
687
724
|
}();
|
|
688
725
|
checkProgress();
|
|
689
|
-
|
|
726
|
+
_context14.next = 9;
|
|
690
727
|
break;
|
|
691
728
|
case 6:
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
return
|
|
729
|
+
_context14.prev = 6;
|
|
730
|
+
_context14.t0 = _context14["catch"](1);
|
|
731
|
+
return _context14.abrupt("return", this._handleError(_context14.t0));
|
|
695
732
|
case 9:
|
|
696
733
|
case "end":
|
|
697
|
-
return
|
|
734
|
+
return _context14.stop();
|
|
698
735
|
}
|
|
699
|
-
},
|
|
736
|
+
}, _callee14, this, [[1, 6]]);
|
|
700
737
|
}));
|
|
701
|
-
function pollTaskProgress(
|
|
738
|
+
function pollTaskProgress(_x9, _x10) {
|
|
702
739
|
return _pollTaskProgress.apply(this, arguments);
|
|
703
740
|
}
|
|
704
741
|
return pollTaskProgress;
|
|
@@ -717,45 +754,45 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
717
754
|
}, {
|
|
718
755
|
key: "get",
|
|
719
756
|
value: function () {
|
|
720
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
757
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(endpoint) {
|
|
721
758
|
var params,
|
|
722
759
|
headers,
|
|
723
760
|
response,
|
|
724
|
-
|
|
725
|
-
return _regeneratorRuntime().wrap(function
|
|
726
|
-
while (1) switch (
|
|
761
|
+
_args15 = arguments;
|
|
762
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
763
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
727
764
|
case 0:
|
|
728
|
-
params =
|
|
729
|
-
|
|
765
|
+
params = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
|
|
766
|
+
_context15.prev = 1;
|
|
730
767
|
// Add the authToken to the headers
|
|
731
768
|
headers = {
|
|
732
769
|
authtoken: this.authtoken
|
|
733
770
|
}; // Make the GET request using Axios
|
|
734
|
-
|
|
771
|
+
_context15.next = 5;
|
|
735
772
|
return this.axios.get(endpoint, {
|
|
736
773
|
params: params,
|
|
737
774
|
headers: headers
|
|
738
775
|
});
|
|
739
776
|
case 5:
|
|
740
|
-
response =
|
|
777
|
+
response = _context15.sent;
|
|
741
778
|
if (!(response.data.ok === false)) {
|
|
742
|
-
|
|
779
|
+
_context15.next = 8;
|
|
743
780
|
break;
|
|
744
781
|
}
|
|
745
|
-
return
|
|
782
|
+
return _context15.abrupt("return", this._handleError(response));
|
|
746
783
|
case 8:
|
|
747
|
-
return
|
|
784
|
+
return _context15.abrupt("return", response.data);
|
|
748
785
|
case 11:
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
return
|
|
786
|
+
_context15.prev = 11;
|
|
787
|
+
_context15.t0 = _context15["catch"](1);
|
|
788
|
+
return _context15.abrupt("return", this._handleError(_context15.t0));
|
|
752
789
|
case 14:
|
|
753
790
|
case "end":
|
|
754
|
-
return
|
|
791
|
+
return _context15.stop();
|
|
755
792
|
}
|
|
756
|
-
},
|
|
793
|
+
}, _callee15, this, [[1, 11]]);
|
|
757
794
|
}));
|
|
758
|
-
function get(
|
|
795
|
+
function get(_x11) {
|
|
759
796
|
return _get.apply(this, arguments);
|
|
760
797
|
}
|
|
761
798
|
return get;
|
|
@@ -775,44 +812,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
775
812
|
}, {
|
|
776
813
|
key: "post",
|
|
777
814
|
value: function () {
|
|
778
|
-
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
815
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(endpoint) {
|
|
779
816
|
var data,
|
|
780
817
|
headers,
|
|
781
818
|
response,
|
|
782
|
-
|
|
783
|
-
return _regeneratorRuntime().wrap(function
|
|
784
|
-
while (1) switch (
|
|
819
|
+
_args16 = arguments;
|
|
820
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
821
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
785
822
|
case 0:
|
|
786
|
-
data =
|
|
787
|
-
|
|
823
|
+
data = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
|
|
824
|
+
_context16.prev = 1;
|
|
788
825
|
// Add the authToken to the headers
|
|
789
826
|
headers = {
|
|
790
827
|
authtoken: this.authtoken
|
|
791
828
|
}; // Make the POST request using Axios
|
|
792
|
-
|
|
829
|
+
_context16.next = 5;
|
|
793
830
|
return this.axios.post(endpoint, data, {
|
|
794
831
|
headers: headers
|
|
795
832
|
});
|
|
796
833
|
case 5:
|
|
797
|
-
response =
|
|
834
|
+
response = _context16.sent;
|
|
798
835
|
if (!(response.data.ok === false)) {
|
|
799
|
-
|
|
836
|
+
_context16.next = 8;
|
|
800
837
|
break;
|
|
801
838
|
}
|
|
802
|
-
return
|
|
839
|
+
return _context16.abrupt("return", this._handleError(response));
|
|
803
840
|
case 8:
|
|
804
|
-
return
|
|
841
|
+
return _context16.abrupt("return", response.data);
|
|
805
842
|
case 11:
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
return
|
|
843
|
+
_context16.prev = 11;
|
|
844
|
+
_context16.t0 = _context16["catch"](1);
|
|
845
|
+
return _context16.abrupt("return", this._handleError(_context16.t0));
|
|
809
846
|
case 14:
|
|
810
847
|
case "end":
|
|
811
|
-
return
|
|
848
|
+
return _context16.stop();
|
|
812
849
|
}
|
|
813
|
-
},
|
|
850
|
+
}, _callee16, this, [[1, 11]]);
|
|
814
851
|
}));
|
|
815
|
-
function post(
|
|
852
|
+
function post(_x12) {
|
|
816
853
|
return _post.apply(this, arguments);
|
|
817
854
|
}
|
|
818
855
|
return post;
|