roboto-js 1.4.24 → 1.4.26

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.
@@ -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' && onError) {
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,17 +1022,21 @@ 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') {
1028
1032
  onProgress(response);
1029
1033
  }
1030
1034
 
1031
- // Continue polling if the status is 'RUNNING'
1032
- if (['RUNNING'].includes(response.status)) {
1033
- setTimeout(checkProgress, 1000); // Poll every 2 seconds
1035
+ // Continue polling if the status is 'RUNNING' or STOPPING
1036
+ if (['RUNNING', 'STOPPING'].includes(response.status)) {
1037
+ setTimeout(checkProgress, 2000); // Poll every 2 seconds
1034
1038
  }
1035
- case 7:
1039
+ case 8:
1036
1040
  case "end":
1037
1041
  return _context20.stop();
1038
1042
  }
@@ -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' && onError) {
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,15 +529,19 @@ 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') {
534
539
  onProgress(response);
535
540
  }
536
541
 
537
- // Continue polling if the status is 'RUNNING'
538
- if (['RUNNING'].includes(response.status)) {
539
- setTimeout(checkProgress, 1000); // Poll every 2 seconds
542
+ // Continue polling if the status is 'RUNNING' or STOPPING
543
+ if (['RUNNING', 'STOPPING'].includes(response.status)) {
544
+ setTimeout(checkProgress, 2000); // Poll every 2 seconds
540
545
  }
541
546
  };
542
547
  checkProgress();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.4.24",
3
+ "version": "1.4.26",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
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' && onError){
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,15 +569,19 @@ 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'){
575
579
  onProgress(response);
576
580
  }
577
581
 
578
- // Continue polling if the status is 'RUNNING'
579
- if (['RUNNING'].includes(response.status)) {
580
- setTimeout(checkProgress, 1000); // Poll every 2 seconds
582
+ // Continue polling if the status is 'RUNNING' or STOPPING
583
+ if (['RUNNING','STOPPING'].includes(response.status)) {
584
+ setTimeout(checkProgress, 2000); // Poll every 2 seconds
581
585
  }
582
586
  };
583
587