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