roboto-js 1.4.23 → 1.4.25
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 +37 -18
- package/dist/cjs/rbt_api.cjs +9 -5
- package/dist/esm/index.js +3 -0
- package/dist/esm/rbt_api.js +7 -2
- package/package.json +1 -1
- package/src/index.js +3 -0
- package/src/rbt_api.js +7 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -429,20 +429,39 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
429
429
|
return runTask;
|
|
430
430
|
}()
|
|
431
431
|
}, {
|
|
432
|
-
key: "
|
|
432
|
+
key: "stopJob",
|
|
433
433
|
value: function () {
|
|
434
|
-
var
|
|
434
|
+
var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params, callbacks) {
|
|
435
435
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
436
436
|
while (1) switch (_context17.prev = _context17.next) {
|
|
437
437
|
case 0:
|
|
438
|
-
return _context17.abrupt("return", this.api.
|
|
438
|
+
return _context17.abrupt("return", this.api.stopJob(params, callbacks));
|
|
439
439
|
case 1:
|
|
440
440
|
case "end":
|
|
441
441
|
return _context17.stop();
|
|
442
442
|
}
|
|
443
443
|
}, _callee17, this);
|
|
444
444
|
}));
|
|
445
|
-
function
|
|
445
|
+
function stopJob(_x15, _x16) {
|
|
446
|
+
return _stopJob.apply(this, arguments);
|
|
447
|
+
}
|
|
448
|
+
return stopJob;
|
|
449
|
+
}()
|
|
450
|
+
}, {
|
|
451
|
+
key: "pollTaskProgress",
|
|
452
|
+
value: function () {
|
|
453
|
+
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
454
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
455
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
456
|
+
case 0:
|
|
457
|
+
return _context18.abrupt("return", this.api.pollTaskProgress(params));
|
|
458
|
+
case 1:
|
|
459
|
+
case "end":
|
|
460
|
+
return _context18.stop();
|
|
461
|
+
}
|
|
462
|
+
}, _callee18, this);
|
|
463
|
+
}));
|
|
464
|
+
function pollTaskProgress(_x17) {
|
|
446
465
|
return _pollTaskProgress.apply(this, arguments);
|
|
447
466
|
}
|
|
448
467
|
return pollTaskProgress;
|
|
@@ -452,18 +471,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
452
471
|
}, {
|
|
453
472
|
key: "get",
|
|
454
473
|
value: function () {
|
|
455
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
456
|
-
return _regeneratorRuntime().wrap(function
|
|
457
|
-
while (1) switch (
|
|
474
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(endpoint, params) {
|
|
475
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
476
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
458
477
|
case 0:
|
|
459
|
-
return
|
|
478
|
+
return _context19.abrupt("return", this.api.get(endpoint, params));
|
|
460
479
|
case 1:
|
|
461
480
|
case "end":
|
|
462
|
-
return
|
|
481
|
+
return _context19.stop();
|
|
463
482
|
}
|
|
464
|
-
},
|
|
483
|
+
}, _callee19, this);
|
|
465
484
|
}));
|
|
466
|
-
function get(
|
|
485
|
+
function get(_x18, _x19) {
|
|
467
486
|
return _get.apply(this, arguments);
|
|
468
487
|
}
|
|
469
488
|
return get;
|
|
@@ -471,18 +490,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
471
490
|
}, {
|
|
472
491
|
key: "post",
|
|
473
492
|
value: function () {
|
|
474
|
-
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
475
|
-
return _regeneratorRuntime().wrap(function
|
|
476
|
-
while (1) switch (
|
|
493
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(endpoint, data) {
|
|
494
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
495
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
477
496
|
case 0:
|
|
478
|
-
return
|
|
497
|
+
return _context20.abrupt("return", this.api.post(endpoint, data));
|
|
479
498
|
case 1:
|
|
480
499
|
case "end":
|
|
481
|
-
return
|
|
500
|
+
return _context20.stop();
|
|
482
501
|
}
|
|
483
|
-
},
|
|
502
|
+
}, _callee20, this);
|
|
484
503
|
}));
|
|
485
|
-
function post(
|
|
504
|
+
function post(_x20, _x21) {
|
|
486
505
|
return _post.apply(this, arguments);
|
|
487
506
|
}
|
|
488
507
|
return post;
|
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -898,7 +898,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
898
898
|
// Provide the current progress to the callback function
|
|
899
899
|
onError(response);
|
|
900
900
|
}
|
|
901
|
-
if (status === 'STOPPED' &&
|
|
901
|
+
if (status === 'STOPPED' && onStopped) {
|
|
902
902
|
// Provide the current progress to the callback function
|
|
903
903
|
onStopped(response);
|
|
904
904
|
}
|
|
@@ -994,11 +994,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
994
994
|
value: (function () {
|
|
995
995
|
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(jobId, callbacks) {
|
|
996
996
|
var _this2 = this;
|
|
997
|
-
var onProgress, onError, onDone, checkProgress;
|
|
997
|
+
var onProgress, onError, onStopped, onDone, checkProgress;
|
|
998
998
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
999
999
|
while (1) switch (_context21.prev = _context21.next) {
|
|
1000
1000
|
case 0:
|
|
1001
|
-
onProgress = callbacks.onProgress, onError = callbacks.onError, onDone = callbacks.onDone;
|
|
1001
|
+
onProgress = callbacks.onProgress, onError = callbacks.onError, onStopped = callbacks.onStopped, onDone = callbacks.onDone;
|
|
1002
1002
|
_context21.prev = 1;
|
|
1003
1003
|
checkProgress = /*#__PURE__*/function () {
|
|
1004
1004
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
@@ -1022,6 +1022,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1022
1022
|
// Provide the current progress to the callback function
|
|
1023
1023
|
onError(response);
|
|
1024
1024
|
}
|
|
1025
|
+
if (response.status === 'STOPPED' && onStopped) {
|
|
1026
|
+
// Provide the current progress to the callback function
|
|
1027
|
+
onStopped(response);
|
|
1028
|
+
}
|
|
1025
1029
|
|
|
1026
1030
|
// Provide the current progress to the callback function
|
|
1027
1031
|
if (response.status == 'RUNNING') {
|
|
@@ -1030,9 +1034,9 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1030
1034
|
|
|
1031
1035
|
// Continue polling if the status is 'RUNNING'
|
|
1032
1036
|
if (['RUNNING'].includes(response.status)) {
|
|
1033
|
-
setTimeout(checkProgress,
|
|
1037
|
+
setTimeout(checkProgress, 2000); // Poll every 2 seconds
|
|
1034
1038
|
}
|
|
1035
|
-
case
|
|
1039
|
+
case 8:
|
|
1036
1040
|
case "end":
|
|
1037
1041
|
return _context20.stop();
|
|
1038
1042
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -131,6 +131,9 @@ export default class Roboto {
|
|
|
131
131
|
async runTask(params, callbacks) {
|
|
132
132
|
return this.api.runTask(params, callbacks);
|
|
133
133
|
}
|
|
134
|
+
async stopJob(params, callbacks) {
|
|
135
|
+
return this.api.stopJob(params, callbacks);
|
|
136
|
+
}
|
|
134
137
|
async pollTaskProgress(params) {
|
|
135
138
|
return this.api.pollTaskProgress(params);
|
|
136
139
|
}
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -453,7 +453,7 @@ export default class RbtApi {
|
|
|
453
453
|
// Provide the current progress to the callback function
|
|
454
454
|
onError(response);
|
|
455
455
|
}
|
|
456
|
-
if (status === 'STOPPED' &&
|
|
456
|
+
if (status === 'STOPPED' && onStopped) {
|
|
457
457
|
// Provide the current progress to the callback function
|
|
458
458
|
onStopped(response);
|
|
459
459
|
}
|
|
@@ -510,6 +510,7 @@ export default class RbtApi {
|
|
|
510
510
|
const {
|
|
511
511
|
onProgress,
|
|
512
512
|
onError,
|
|
513
|
+
onStopped,
|
|
513
514
|
onDone
|
|
514
515
|
} = callbacks;
|
|
515
516
|
try {
|
|
@@ -528,6 +529,10 @@ export default class RbtApi {
|
|
|
528
529
|
// Provide the current progress to the callback function
|
|
529
530
|
onError(response);
|
|
530
531
|
}
|
|
532
|
+
if (response.status === 'STOPPED' && onStopped) {
|
|
533
|
+
// Provide the current progress to the callback function
|
|
534
|
+
onStopped(response);
|
|
535
|
+
}
|
|
531
536
|
|
|
532
537
|
// Provide the current progress to the callback function
|
|
533
538
|
if (response.status == 'RUNNING') {
|
|
@@ -536,7 +541,7 @@ export default class RbtApi {
|
|
|
536
541
|
|
|
537
542
|
// Continue polling if the status is 'RUNNING'
|
|
538
543
|
if (['RUNNING'].includes(response.status)) {
|
|
539
|
-
setTimeout(checkProgress,
|
|
544
|
+
setTimeout(checkProgress, 2000); // Poll every 2 seconds
|
|
540
545
|
}
|
|
541
546
|
};
|
|
542
547
|
checkProgress();
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -154,6 +154,9 @@ export default class Roboto{
|
|
|
154
154
|
async runTask(params, callbacks){
|
|
155
155
|
return this.api.runTask(params, callbacks);
|
|
156
156
|
}
|
|
157
|
+
async stopJob(params, callbacks){
|
|
158
|
+
return this.api.stopJob(params, callbacks);
|
|
159
|
+
}
|
|
157
160
|
|
|
158
161
|
async pollTaskProgress(params){
|
|
159
162
|
return this.api.pollTaskProgress(params);
|
package/src/rbt_api.js
CHANGED
|
@@ -501,7 +501,7 @@ export default class RbtApi {
|
|
|
501
501
|
// Provide the current progress to the callback function
|
|
502
502
|
onError(response);
|
|
503
503
|
}
|
|
504
|
-
if (status === 'STOPPED' &&
|
|
504
|
+
if (status === 'STOPPED' && onStopped){
|
|
505
505
|
// Provide the current progress to the callback function
|
|
506
506
|
onStopped(response);
|
|
507
507
|
}
|
|
@@ -554,7 +554,7 @@ export default class RbtApi {
|
|
|
554
554
|
* the task is completed or an error occurs.
|
|
555
555
|
*/
|
|
556
556
|
async pollTaskProgress(jobId, callbacks) {
|
|
557
|
-
const { onProgress, onError, onDone } = callbacks;
|
|
557
|
+
const { onProgress, onError, onStopped, onDone } = callbacks;
|
|
558
558
|
try {
|
|
559
559
|
const checkProgress = async () => {
|
|
560
560
|
const response = await this.get(`/task_service/pollChainProgress`, { jobId: jobId });
|
|
@@ -569,6 +569,10 @@ export default class RbtApi {
|
|
|
569
569
|
// Provide the current progress to the callback function
|
|
570
570
|
onError(response);
|
|
571
571
|
}
|
|
572
|
+
if (response.status === 'STOPPED' && onStopped){
|
|
573
|
+
// Provide the current progress to the callback function
|
|
574
|
+
onStopped(response);
|
|
575
|
+
}
|
|
572
576
|
|
|
573
577
|
// Provide the current progress to the callback function
|
|
574
578
|
if(response.status == 'RUNNING'){
|
|
@@ -577,7 +581,7 @@ export default class RbtApi {
|
|
|
577
581
|
|
|
578
582
|
// Continue polling if the status is 'RUNNING'
|
|
579
583
|
if (['RUNNING'].includes(response.status)) {
|
|
580
|
-
setTimeout(checkProgress,
|
|
584
|
+
setTimeout(checkProgress, 2000); // Poll every 2 seconds
|
|
581
585
|
}
|
|
582
586
|
};
|
|
583
587
|
|