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