roboto-js 1.4.50 → 1.5.1
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 +77 -58
- package/dist/cjs/rbt_api.cjs +184 -144
- package/dist/cjs/rbt_file.cjs +75 -423
- package/dist/esm/index.js +3 -0
- package/dist/esm/rbt_api.js +18 -0
- package/dist/esm/rbt_file.js +67 -170
- package/package.json +3 -2
- package/src/index.js +3 -0
- package/src/rbt_api.js +21 -0
- package/src/rbt_file.js +70 -208
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -679,6 +679,46 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
679
679
|
}
|
|
680
680
|
return loadFile;
|
|
681
681
|
}()
|
|
682
|
+
}, {
|
|
683
|
+
key: "loadFiles",
|
|
684
|
+
value: function () {
|
|
685
|
+
var _loadFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(ids) {
|
|
686
|
+
var _this = this;
|
|
687
|
+
var responses;
|
|
688
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
689
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
690
|
+
case 0:
|
|
691
|
+
_context15.prev = 0;
|
|
692
|
+
_context15.next = 3;
|
|
693
|
+
return this.load('<@filekit.file>', ids);
|
|
694
|
+
case 3:
|
|
695
|
+
responses = _context15.sent;
|
|
696
|
+
if (!(!responses || !Array.isArray(responses))) {
|
|
697
|
+
_context15.next = 6;
|
|
698
|
+
break;
|
|
699
|
+
}
|
|
700
|
+
return _context15.abrupt("return", []);
|
|
701
|
+
case 6:
|
|
702
|
+
return _context15.abrupt("return", responses.map(function (response) {
|
|
703
|
+
var record = response.toRecord();
|
|
704
|
+
return new _rbt_file["default"](record, _this.axios, _this.localDb);
|
|
705
|
+
}));
|
|
706
|
+
case 9:
|
|
707
|
+
_context15.prev = 9;
|
|
708
|
+
_context15.t0 = _context15["catch"](0);
|
|
709
|
+
this._handleError(_context15.t0); // Handle errors (log or process as needed)
|
|
710
|
+
return _context15.abrupt("return", []);
|
|
711
|
+
case 13:
|
|
712
|
+
case "end":
|
|
713
|
+
return _context15.stop();
|
|
714
|
+
}
|
|
715
|
+
}, _callee15, this, [[0, 9]]);
|
|
716
|
+
}));
|
|
717
|
+
function loadFiles(_x10) {
|
|
718
|
+
return _loadFiles.apply(this, arguments);
|
|
719
|
+
}
|
|
720
|
+
return loadFiles;
|
|
721
|
+
}()
|
|
682
722
|
/**
|
|
683
723
|
* Creates a new object of the given type.
|
|
684
724
|
*
|
|
@@ -689,40 +729,40 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
689
729
|
}, {
|
|
690
730
|
key: "create",
|
|
691
731
|
value: (function () {
|
|
692
|
-
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
732
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(type) {
|
|
693
733
|
var dataHash,
|
|
694
734
|
response,
|
|
695
735
|
record,
|
|
696
|
-
|
|
697
|
-
return _regeneratorRuntime().wrap(function
|
|
698
|
-
while (1) switch (
|
|
736
|
+
_args16 = arguments;
|
|
737
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
738
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
699
739
|
case 0:
|
|
700
|
-
dataHash =
|
|
701
|
-
|
|
740
|
+
dataHash = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
|
|
741
|
+
_context16.prev = 1;
|
|
702
742
|
debugger;
|
|
703
|
-
|
|
743
|
+
_context16.next = 5;
|
|
704
744
|
return this.axios.post('/object_service/createObject', [type, dataHash]);
|
|
705
745
|
case 5:
|
|
706
|
-
response =
|
|
746
|
+
response = _context16.sent;
|
|
707
747
|
record = response.data;
|
|
708
748
|
if (dataHash) {
|
|
709
749
|
record.data = dataHash;
|
|
710
750
|
}
|
|
711
751
|
debugger;
|
|
712
|
-
return
|
|
752
|
+
return _context16.abrupt("return", new _rbt_object["default"](record, this.axios, {
|
|
713
753
|
isNew: true
|
|
714
754
|
}));
|
|
715
755
|
case 12:
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
return
|
|
756
|
+
_context16.prev = 12;
|
|
757
|
+
_context16.t0 = _context16["catch"](1);
|
|
758
|
+
return _context16.abrupt("return", this._handleError(_context16.t0));
|
|
719
759
|
case 15:
|
|
720
760
|
case "end":
|
|
721
|
-
return
|
|
761
|
+
return _context16.stop();
|
|
722
762
|
}
|
|
723
|
-
},
|
|
763
|
+
}, _callee16, this, [[1, 12]]);
|
|
724
764
|
}));
|
|
725
|
-
function create(
|
|
765
|
+
function create(_x11) {
|
|
726
766
|
return _create.apply(this, arguments);
|
|
727
767
|
}
|
|
728
768
|
return create;
|
|
@@ -801,8 +841,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
801
841
|
}, {
|
|
802
842
|
key: "query",
|
|
803
843
|
value: (function () {
|
|
804
|
-
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
805
|
-
var
|
|
844
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(type) {
|
|
845
|
+
var _this2 = this;
|
|
806
846
|
var params,
|
|
807
847
|
defaultOrderBy,
|
|
808
848
|
defaultLimit,
|
|
@@ -812,12 +852,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
812
852
|
cacheEntry,
|
|
813
853
|
responsePromise,
|
|
814
854
|
processingPromise,
|
|
815
|
-
|
|
816
|
-
return _regeneratorRuntime().wrap(function
|
|
817
|
-
while (1) switch (
|
|
855
|
+
_args17 = arguments;
|
|
856
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
857
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
818
858
|
case 0:
|
|
819
|
-
params =
|
|
820
|
-
|
|
859
|
+
params = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
|
|
860
|
+
_context17.prev = 1;
|
|
821
861
|
//console.log('RBTAPI.query INIT', type, params);
|
|
822
862
|
params.type = type;
|
|
823
863
|
|
|
@@ -839,19 +879,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
839
879
|
_paramsKey = JSON.stringify(mergedParams);
|
|
840
880
|
cacheEntry = this.requestCache[_paramsKey];
|
|
841
881
|
if (!(cacheEntry && currentTime - cacheEntry.time < 10000)) {
|
|
842
|
-
|
|
882
|
+
_context17.next = 11;
|
|
843
883
|
break;
|
|
844
884
|
}
|
|
845
|
-
return
|
|
885
|
+
return _context17.abrupt("return", cacheEntry.val);
|
|
846
886
|
case 11:
|
|
847
887
|
// Create the response promise
|
|
848
888
|
responsePromise = this.axios.post('/object_service/queryObjects', [mergedParams]); // Cache the promise of processing data, not just the raw response
|
|
849
889
|
processingPromise = responsePromise.then(function (response) {
|
|
850
|
-
return
|
|
890
|
+
return _this2._processResponseData(response);
|
|
851
891
|
})["catch"](function (e) {
|
|
852
|
-
delete
|
|
892
|
+
delete _this2.requestCache[_paramsKey]; // Ensure cache cleanup on failure
|
|
853
893
|
//console.log('RBTAPI.query ERROR (Processing)', paramsKey, e);
|
|
854
|
-
return
|
|
894
|
+
return _this2._handleError(e);
|
|
855
895
|
}); // Store the promise of the processed data in the cache
|
|
856
896
|
this.requestCache[_paramsKey] = {
|
|
857
897
|
val: processingPromise,
|
|
@@ -859,23 +899,23 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
859
899
|
};
|
|
860
900
|
|
|
861
901
|
// Await the processing promise for this call to get processed data
|
|
862
|
-
|
|
902
|
+
_context17.next = 16;
|
|
863
903
|
return processingPromise;
|
|
864
904
|
case 16:
|
|
865
|
-
return
|
|
905
|
+
return _context17.abrupt("return", _context17.sent);
|
|
866
906
|
case 19:
|
|
867
|
-
|
|
868
|
-
|
|
907
|
+
_context17.prev = 19;
|
|
908
|
+
_context17.t0 = _context17["catch"](1);
|
|
869
909
|
delete this.requestCache[paramsKey]; // Ensure cache cleanup on error
|
|
870
910
|
//console.log('RBTAPI.query ERROR', paramsKey, e);
|
|
871
|
-
return
|
|
911
|
+
return _context17.abrupt("return", this._handleError(_context17.t0));
|
|
872
912
|
case 23:
|
|
873
913
|
case "end":
|
|
874
|
-
return
|
|
914
|
+
return _context17.stop();
|
|
875
915
|
}
|
|
876
|
-
},
|
|
916
|
+
}, _callee17, this, [[1, 19]]);
|
|
877
917
|
}));
|
|
878
|
-
function query(
|
|
918
|
+
function query(_x12) {
|
|
879
919
|
return _query.apply(this, arguments);
|
|
880
920
|
}
|
|
881
921
|
return query;
|
|
@@ -883,14 +923,14 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
883
923
|
}, {
|
|
884
924
|
key: "_processResponseData",
|
|
885
925
|
value: function _processResponseData(response) {
|
|
886
|
-
var
|
|
926
|
+
var _this3 = this;
|
|
887
927
|
if (response.data.ok === false) {
|
|
888
928
|
return this._handleError(response);
|
|
889
929
|
}
|
|
890
930
|
if (Array.isArray(response.data.items)) {
|
|
891
931
|
//console.log('RBTAPI.query RESPONSE PRE', response.data.items);
|
|
892
932
|
response.data.items = response.data.items.map(function (record) {
|
|
893
|
-
return new _rbt_object["default"](record,
|
|
933
|
+
return new _rbt_object["default"](record, _this3.axios, {
|
|
894
934
|
isNew: true
|
|
895
935
|
});
|
|
896
936
|
});
|
|
@@ -911,47 +951,47 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
911
951
|
}, {
|
|
912
952
|
key: "load",
|
|
913
953
|
value: (function () {
|
|
914
|
-
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
954
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(type, ids) {
|
|
915
955
|
var params,
|
|
916
956
|
mergedParams,
|
|
917
957
|
res,
|
|
918
|
-
|
|
919
|
-
return _regeneratorRuntime().wrap(function
|
|
920
|
-
while (1) switch (
|
|
958
|
+
_args18 = arguments;
|
|
959
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
960
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
921
961
|
case 0:
|
|
922
|
-
params =
|
|
923
|
-
|
|
962
|
+
params = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
963
|
+
_context18.prev = 1;
|
|
924
964
|
if (!Array.isArray(ids)) {
|
|
925
|
-
|
|
965
|
+
_context18.next = 7;
|
|
926
966
|
break;
|
|
927
967
|
}
|
|
928
968
|
mergedParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
929
969
|
where: "id IN (\"".concat(ids.join("\",\""), "\")")
|
|
930
970
|
});
|
|
931
|
-
return
|
|
971
|
+
return _context18.abrupt("return", this.query(type, mergedParams));
|
|
932
972
|
case 7:
|
|
933
973
|
mergedParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
934
974
|
where: "id=\"".concat(ids, "\"")
|
|
935
975
|
});
|
|
936
|
-
|
|
976
|
+
_context18.next = 10;
|
|
937
977
|
return this.query(type, mergedParams);
|
|
938
978
|
case 10:
|
|
939
|
-
res =
|
|
940
|
-
return
|
|
979
|
+
res = _context18.sent;
|
|
980
|
+
return _context18.abrupt("return", res[0]);
|
|
941
981
|
case 12:
|
|
942
|
-
|
|
982
|
+
_context18.next = 17;
|
|
943
983
|
break;
|
|
944
984
|
case 14:
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
return
|
|
985
|
+
_context18.prev = 14;
|
|
986
|
+
_context18.t0 = _context18["catch"](1);
|
|
987
|
+
return _context18.abrupt("return", this._handleError(_context18.t0));
|
|
948
988
|
case 17:
|
|
949
989
|
case "end":
|
|
950
|
-
return
|
|
990
|
+
return _context18.stop();
|
|
951
991
|
}
|
|
952
|
-
},
|
|
992
|
+
}, _callee18, this, [[1, 14]]);
|
|
953
993
|
}));
|
|
954
|
-
function load(
|
|
994
|
+
function load(_x13, _x14) {
|
|
955
995
|
return _load.apply(this, arguments);
|
|
956
996
|
}
|
|
957
997
|
return load;
|
|
@@ -978,7 +1018,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
978
1018
|
}, {
|
|
979
1019
|
key: "runTask",
|
|
980
1020
|
value: (function () {
|
|
981
|
-
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1021
|
+
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
982
1022
|
var params,
|
|
983
1023
|
callbacks,
|
|
984
1024
|
onProgress,
|
|
@@ -992,20 +1032,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
992
1032
|
status,
|
|
993
1033
|
message,
|
|
994
1034
|
output,
|
|
995
|
-
|
|
996
|
-
return _regeneratorRuntime().wrap(function
|
|
997
|
-
while (1) switch (
|
|
1035
|
+
_args19 = arguments;
|
|
1036
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1037
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
998
1038
|
case 0:
|
|
999
|
-
params =
|
|
1000
|
-
callbacks =
|
|
1039
|
+
params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
|
|
1040
|
+
callbacks = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
1001
1041
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onStopped = callbacks.onStopped, onWaiting = callbacks.onWaiting, onDone = callbacks.onDone;
|
|
1002
|
-
|
|
1003
|
-
|
|
1042
|
+
_context19.prev = 3;
|
|
1043
|
+
_context19.next = 6;
|
|
1004
1044
|
return this.post('/task_service/runChain', params);
|
|
1005
1045
|
case 6:
|
|
1006
|
-
response =
|
|
1046
|
+
response = _context19.sent;
|
|
1007
1047
|
if (response) {
|
|
1008
|
-
|
|
1048
|
+
_context19.next = 9;
|
|
1009
1049
|
break;
|
|
1010
1050
|
}
|
|
1011
1051
|
throw new Error('Invalid server response');
|
|
@@ -1013,7 +1053,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1013
1053
|
// Validate response structure
|
|
1014
1054
|
ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
|
|
1015
1055
|
if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
|
|
1016
|
-
|
|
1056
|
+
_context19.next = 12;
|
|
1017
1057
|
break;
|
|
1018
1058
|
}
|
|
1019
1059
|
throw new Error('Invalid response structure');
|
|
@@ -1039,7 +1079,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1039
1079
|
//console.log('Finish (request) ',response);
|
|
1040
1080
|
onDone(response);
|
|
1041
1081
|
}
|
|
1042
|
-
return
|
|
1082
|
+
return _context19.abrupt("return", {
|
|
1043
1083
|
ok: ok,
|
|
1044
1084
|
jobId: jobId,
|
|
1045
1085
|
status: status,
|
|
@@ -1047,24 +1087,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1047
1087
|
output: output
|
|
1048
1088
|
});
|
|
1049
1089
|
case 20:
|
|
1050
|
-
|
|
1051
|
-
|
|
1090
|
+
_context19.prev = 20;
|
|
1091
|
+
_context19.t0 = _context19["catch"](3);
|
|
1052
1092
|
if (typeof onError === 'function') {
|
|
1053
|
-
onError(
|
|
1093
|
+
onError(_context19.t0);
|
|
1054
1094
|
} else {
|
|
1055
|
-
console.error('Error in runTask:',
|
|
1095
|
+
console.error('Error in runTask:', _context19.t0);
|
|
1056
1096
|
}
|
|
1057
|
-
return
|
|
1097
|
+
return _context19.abrupt("return", {
|
|
1058
1098
|
ok: false,
|
|
1059
1099
|
jobId: null,
|
|
1060
1100
|
status: 'ERROR',
|
|
1061
|
-
error:
|
|
1101
|
+
error: _context19.t0.message
|
|
1062
1102
|
});
|
|
1063
1103
|
case 24:
|
|
1064
1104
|
case "end":
|
|
1065
|
-
return
|
|
1105
|
+
return _context19.stop();
|
|
1066
1106
|
}
|
|
1067
|
-
},
|
|
1107
|
+
}, _callee19, this, [[3, 20]]);
|
|
1068
1108
|
}));
|
|
1069
1109
|
function runTask() {
|
|
1070
1110
|
return _runTask.apply(this, arguments);
|
|
@@ -1074,37 +1114,37 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1074
1114
|
}, {
|
|
1075
1115
|
key: "stopJob",
|
|
1076
1116
|
value: function () {
|
|
1077
|
-
var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1117
|
+
var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1078
1118
|
var params,
|
|
1079
1119
|
callbacks,
|
|
1080
1120
|
response,
|
|
1081
|
-
|
|
1082
|
-
return _regeneratorRuntime().wrap(function
|
|
1083
|
-
while (1) switch (
|
|
1121
|
+
_args20 = arguments;
|
|
1122
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1123
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1084
1124
|
case 0:
|
|
1085
|
-
params =
|
|
1086
|
-
callbacks =
|
|
1087
|
-
|
|
1088
|
-
|
|
1125
|
+
params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
|
|
1126
|
+
callbacks = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
|
|
1127
|
+
_context20.prev = 2;
|
|
1128
|
+
_context20.next = 5;
|
|
1089
1129
|
return this.post('/task_service/stopJob', params);
|
|
1090
1130
|
case 5:
|
|
1091
|
-
response =
|
|
1131
|
+
response = _context20.sent;
|
|
1092
1132
|
if (response) {
|
|
1093
|
-
|
|
1133
|
+
_context20.next = 8;
|
|
1094
1134
|
break;
|
|
1095
1135
|
}
|
|
1096
1136
|
throw new Error('Invalid server response');
|
|
1097
1137
|
case 8:
|
|
1098
|
-
return
|
|
1138
|
+
return _context20.abrupt("return", true);
|
|
1099
1139
|
case 11:
|
|
1100
|
-
|
|
1101
|
-
|
|
1140
|
+
_context20.prev = 11;
|
|
1141
|
+
_context20.t0 = _context20["catch"](2);
|
|
1102
1142
|
throw 'Error in stopJob';
|
|
1103
1143
|
case 14:
|
|
1104
1144
|
case "end":
|
|
1105
|
-
return
|
|
1145
|
+
return _context20.stop();
|
|
1106
1146
|
}
|
|
1107
|
-
},
|
|
1147
|
+
}, _callee20, this, [[2, 11]]);
|
|
1108
1148
|
}));
|
|
1109
1149
|
function stopJob() {
|
|
1110
1150
|
return _stopJob.apply(this, arguments);
|
|
@@ -1124,26 +1164,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1124
1164
|
}, {
|
|
1125
1165
|
key: "pollTaskProgress",
|
|
1126
1166
|
value: (function () {
|
|
1127
|
-
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1128
|
-
var
|
|
1167
|
+
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(jobId, callbacks) {
|
|
1168
|
+
var _this4 = this;
|
|
1129
1169
|
var onProgress, onError, onStopped, onWaiting, onDone, _callbacks$pollingInt, pollingInterval, checkProgress;
|
|
1130
|
-
return _regeneratorRuntime().wrap(function
|
|
1131
|
-
while (1) switch (
|
|
1170
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1171
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1132
1172
|
case 0:
|
|
1133
1173
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onStopped = callbacks.onStopped, onWaiting = callbacks.onWaiting, onDone = callbacks.onDone, _callbacks$pollingInt = callbacks.pollingInterval, pollingInterval = _callbacks$pollingInt === void 0 ? 2000 : _callbacks$pollingInt;
|
|
1134
|
-
|
|
1174
|
+
_context22.prev = 1;
|
|
1135
1175
|
checkProgress = /*#__PURE__*/function () {
|
|
1136
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1176
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1137
1177
|
var response;
|
|
1138
|
-
return _regeneratorRuntime().wrap(function
|
|
1139
|
-
while (1) switch (
|
|
1178
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1179
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1140
1180
|
case 0:
|
|
1141
|
-
|
|
1142
|
-
return
|
|
1181
|
+
_context21.next = 2;
|
|
1182
|
+
return _this4.get("/task_service/pollChainProgress", {
|
|
1143
1183
|
jobId: jobId
|
|
1144
1184
|
});
|
|
1145
1185
|
case 2:
|
|
1146
|
-
response =
|
|
1186
|
+
response = _context21.sent;
|
|
1147
1187
|
// If the task is still in progress, start polling for updates
|
|
1148
1188
|
if (response.status === 'DONE' && onDone) {
|
|
1149
1189
|
// Provide the current progress to the callback function
|
|
@@ -1174,28 +1214,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1174
1214
|
}
|
|
1175
1215
|
case 9:
|
|
1176
1216
|
case "end":
|
|
1177
|
-
return
|
|
1217
|
+
return _context21.stop();
|
|
1178
1218
|
}
|
|
1179
|
-
},
|
|
1219
|
+
}, _callee21);
|
|
1180
1220
|
}));
|
|
1181
1221
|
return function checkProgress() {
|
|
1182
1222
|
return _ref2.apply(this, arguments);
|
|
1183
1223
|
};
|
|
1184
1224
|
}();
|
|
1185
1225
|
checkProgress();
|
|
1186
|
-
|
|
1226
|
+
_context22.next = 9;
|
|
1187
1227
|
break;
|
|
1188
1228
|
case 6:
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
return
|
|
1229
|
+
_context22.prev = 6;
|
|
1230
|
+
_context22.t0 = _context22["catch"](1);
|
|
1231
|
+
return _context22.abrupt("return", this._handleError(_context22.t0));
|
|
1192
1232
|
case 9:
|
|
1193
1233
|
case "end":
|
|
1194
|
-
return
|
|
1234
|
+
return _context22.stop();
|
|
1195
1235
|
}
|
|
1196
|
-
},
|
|
1236
|
+
}, _callee22, this, [[1, 6]]);
|
|
1197
1237
|
}));
|
|
1198
|
-
function pollTaskProgress(
|
|
1238
|
+
function pollTaskProgress(_x15, _x16) {
|
|
1199
1239
|
return _pollTaskProgress.apply(this, arguments);
|
|
1200
1240
|
}
|
|
1201
1241
|
return pollTaskProgress;
|
|
@@ -1215,45 +1255,45 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1215
1255
|
}, {
|
|
1216
1256
|
key: "get",
|
|
1217
1257
|
value: (function () {
|
|
1218
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1258
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(endpoint) {
|
|
1219
1259
|
var params,
|
|
1220
1260
|
headers,
|
|
1221
1261
|
response,
|
|
1222
|
-
|
|
1223
|
-
return _regeneratorRuntime().wrap(function
|
|
1224
|
-
while (1) switch (
|
|
1262
|
+
_args23 = arguments;
|
|
1263
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1264
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1225
1265
|
case 0:
|
|
1226
|
-
params =
|
|
1227
|
-
|
|
1266
|
+
params = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {};
|
|
1267
|
+
_context23.prev = 1;
|
|
1228
1268
|
// Add the authToken to the headers
|
|
1229
1269
|
headers = {
|
|
1230
1270
|
authtoken: this.authtoken
|
|
1231
1271
|
}; // Make the GET request using Axios
|
|
1232
|
-
|
|
1272
|
+
_context23.next = 5;
|
|
1233
1273
|
return this.axios.get(endpoint, {
|
|
1234
1274
|
params: params,
|
|
1235
1275
|
headers: headers
|
|
1236
1276
|
});
|
|
1237
1277
|
case 5:
|
|
1238
|
-
response =
|
|
1278
|
+
response = _context23.sent;
|
|
1239
1279
|
if (!(response.data.ok === false)) {
|
|
1240
|
-
|
|
1280
|
+
_context23.next = 8;
|
|
1241
1281
|
break;
|
|
1242
1282
|
}
|
|
1243
|
-
return
|
|
1283
|
+
return _context23.abrupt("return", this._handleError(response));
|
|
1244
1284
|
case 8:
|
|
1245
|
-
return
|
|
1285
|
+
return _context23.abrupt("return", response.data);
|
|
1246
1286
|
case 11:
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
return
|
|
1287
|
+
_context23.prev = 11;
|
|
1288
|
+
_context23.t0 = _context23["catch"](1);
|
|
1289
|
+
return _context23.abrupt("return", this._handleError(_context23.t0));
|
|
1250
1290
|
case 14:
|
|
1251
1291
|
case "end":
|
|
1252
|
-
return
|
|
1292
|
+
return _context23.stop();
|
|
1253
1293
|
}
|
|
1254
|
-
},
|
|
1294
|
+
}, _callee23, this, [[1, 11]]);
|
|
1255
1295
|
}));
|
|
1256
|
-
function get(
|
|
1296
|
+
function get(_x17) {
|
|
1257
1297
|
return _get.apply(this, arguments);
|
|
1258
1298
|
}
|
|
1259
1299
|
return get;
|
|
@@ -1274,44 +1314,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1274
1314
|
}, {
|
|
1275
1315
|
key: "post",
|
|
1276
1316
|
value: (function () {
|
|
1277
|
-
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1317
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(endpoint) {
|
|
1278
1318
|
var data,
|
|
1279
1319
|
headers,
|
|
1280
1320
|
response,
|
|
1281
|
-
|
|
1282
|
-
return _regeneratorRuntime().wrap(function
|
|
1283
|
-
while (1) switch (
|
|
1321
|
+
_args24 = arguments;
|
|
1322
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1323
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1284
1324
|
case 0:
|
|
1285
|
-
data =
|
|
1286
|
-
|
|
1325
|
+
data = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {};
|
|
1326
|
+
_context24.prev = 1;
|
|
1287
1327
|
// Add the authToken to the headers
|
|
1288
1328
|
headers = {
|
|
1289
1329
|
authtoken: this.authtoken
|
|
1290
1330
|
}; // Make the POST request using Axios
|
|
1291
|
-
|
|
1331
|
+
_context24.next = 5;
|
|
1292
1332
|
return this.axios.post(endpoint, data, {
|
|
1293
1333
|
headers: headers
|
|
1294
1334
|
});
|
|
1295
1335
|
case 5:
|
|
1296
|
-
response =
|
|
1336
|
+
response = _context24.sent;
|
|
1297
1337
|
if (!(response.data.ok === false)) {
|
|
1298
|
-
|
|
1338
|
+
_context24.next = 8;
|
|
1299
1339
|
break;
|
|
1300
1340
|
}
|
|
1301
|
-
return
|
|
1341
|
+
return _context24.abrupt("return", this._handleError(response));
|
|
1302
1342
|
case 8:
|
|
1303
|
-
return
|
|
1343
|
+
return _context24.abrupt("return", response.data);
|
|
1304
1344
|
case 11:
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
return
|
|
1345
|
+
_context24.prev = 11;
|
|
1346
|
+
_context24.t0 = _context24["catch"](1);
|
|
1347
|
+
return _context24.abrupt("return", this._handleError(_context24.t0));
|
|
1308
1348
|
case 14:
|
|
1309
1349
|
case "end":
|
|
1310
|
-
return
|
|
1350
|
+
return _context24.stop();
|
|
1311
1351
|
}
|
|
1312
|
-
},
|
|
1352
|
+
}, _callee24, this, [[1, 11]]);
|
|
1313
1353
|
}));
|
|
1314
|
-
function post(
|
|
1354
|
+
function post(_x18) {
|
|
1315
1355
|
return _post.apply(this, arguments);
|
|
1316
1356
|
}
|
|
1317
1357
|
return post;
|