roboto-js 1.8.3 → 1.8.5
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/.last-build +1 -1
- package/dist/cjs/rbt_api.cjs +39 -5
- package/dist/esm/rbt_api.js +39 -5
- package/dist/rbt_api.js +34 -6
- package/package.json +1 -1
- package/src/rbt_api.js +39 -5
package/.last-build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2025-
|
|
1
|
+
2025-11-03T07:10:02.529Z
|
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -95,6 +95,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
95
95
|
|
|
96
96
|
// Use the storageAdaptor to get the authToken, if available
|
|
97
97
|
this.initAuthToken(authtoken);
|
|
98
|
+
|
|
99
|
+
// Set apiKey synchronously if provided (don't wait for async initApiKey)
|
|
100
|
+
if (apikey) {
|
|
101
|
+
this.apikey = apikey;
|
|
102
|
+
this.axios.defaults.headers.common['apikey'] = this.apikey;
|
|
103
|
+
}
|
|
98
104
|
this.initApiKey(apikey);
|
|
99
105
|
}
|
|
100
106
|
|
|
@@ -1777,8 +1783,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1777
1783
|
this.pollTaskProgress(jobId, callbacks);
|
|
1778
1784
|
}
|
|
1779
1785
|
if (status === 'ERROR' && onError) {
|
|
1780
|
-
//
|
|
1781
|
-
onError(response);
|
|
1786
|
+
// Normalize error response to have consistent message/label at top level
|
|
1787
|
+
onError(this._normalizeErrorResponse(response));
|
|
1782
1788
|
}
|
|
1783
1789
|
if (status === 'STOPPED' && onStopped) {
|
|
1784
1790
|
// Provide the current progress to the callback function
|
|
@@ -1790,7 +1796,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1790
1796
|
}
|
|
1791
1797
|
if (status === 'DONE' && onDone) {
|
|
1792
1798
|
// Provide the current progress to the callback function
|
|
1793
|
-
//console.log('Finish (request) ',response);
|
|
1799
|
+
//console.log('Finish (request) ',response); s
|
|
1794
1800
|
onDone(response);
|
|
1795
1801
|
}
|
|
1796
1802
|
return _context25.abrupt("return", {
|
|
@@ -1875,6 +1881,34 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1875
1881
|
}
|
|
1876
1882
|
return stopJob;
|
|
1877
1883
|
}()
|
|
1884
|
+
/**
|
|
1885
|
+
* Normalize error response to have consistent message/label at top level
|
|
1886
|
+
* Extracts from messages array if present (from chain execution)
|
|
1887
|
+
*/
|
|
1888
|
+
}, {
|
|
1889
|
+
key: "_normalizeErrorResponse",
|
|
1890
|
+
value: function _normalizeErrorResponse(response) {
|
|
1891
|
+
// If response already has message/label at top level and no messages array, return as-is
|
|
1892
|
+
if ((response.message || response.label) && !response.messages) {
|
|
1893
|
+
return response;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
// Extract the most recent error from messages array
|
|
1897
|
+
if (response.messages && response.messages.length > 0) {
|
|
1898
|
+
var lastMessage = response.messages[response.messages.length - 1];
|
|
1899
|
+
return _objectSpread(_objectSpread({}, response), {}, {
|
|
1900
|
+
message: lastMessage.message || response.message || 'Unknown error',
|
|
1901
|
+
label: lastMessage.label || response.label || 'Error'
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// Fallback: ensure we have at least message/label fields
|
|
1906
|
+
return _objectSpread(_objectSpread({}, response), {}, {
|
|
1907
|
+
message: response.message || 'Unknown error',
|
|
1908
|
+
label: response.label || 'Error'
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1878
1912
|
/**
|
|
1879
1913
|
* Polls the progress of a long-running task.
|
|
1880
1914
|
*
|
|
@@ -1915,8 +1949,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1915
1949
|
onDone(response);
|
|
1916
1950
|
}
|
|
1917
1951
|
if (response.status === 'ERROR' && onError) {
|
|
1918
|
-
//
|
|
1919
|
-
onError(response);
|
|
1952
|
+
// Normalize error response to have consistent message/label at top level
|
|
1953
|
+
onError(_this9._normalizeErrorResponse(response));
|
|
1920
1954
|
}
|
|
1921
1955
|
if (response.status === 'STOPPED' && onStopped) {
|
|
1922
1956
|
// Provide the current progress to the callback function
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -54,6 +54,12 @@ export default class RbtApi {
|
|
|
54
54
|
|
|
55
55
|
// Use the storageAdaptor to get the authToken, if available
|
|
56
56
|
this.initAuthToken(authtoken);
|
|
57
|
+
|
|
58
|
+
// Set apiKey synchronously if provided (don't wait for async initApiKey)
|
|
59
|
+
if (apikey) {
|
|
60
|
+
this.apikey = apikey;
|
|
61
|
+
this.axios.defaults.headers.common['apikey'] = this.apikey;
|
|
62
|
+
}
|
|
57
63
|
this.initApiKey(apikey);
|
|
58
64
|
}
|
|
59
65
|
|
|
@@ -1025,8 +1031,8 @@ export default class RbtApi {
|
|
|
1025
1031
|
this.pollTaskProgress(jobId, callbacks);
|
|
1026
1032
|
}
|
|
1027
1033
|
if (status === 'ERROR' && onError) {
|
|
1028
|
-
//
|
|
1029
|
-
onError(response);
|
|
1034
|
+
// Normalize error response to have consistent message/label at top level
|
|
1035
|
+
onError(this._normalizeErrorResponse(response));
|
|
1030
1036
|
}
|
|
1031
1037
|
if (status === 'STOPPED' && onStopped) {
|
|
1032
1038
|
// Provide the current progress to the callback function
|
|
@@ -1038,7 +1044,7 @@ export default class RbtApi {
|
|
|
1038
1044
|
}
|
|
1039
1045
|
if (status === 'DONE' && onDone) {
|
|
1040
1046
|
// Provide the current progress to the callback function
|
|
1041
|
-
//console.log('Finish (request) ',response);
|
|
1047
|
+
//console.log('Finish (request) ',response); s
|
|
1042
1048
|
onDone(response);
|
|
1043
1049
|
}
|
|
1044
1050
|
return {
|
|
@@ -1085,6 +1091,34 @@ export default class RbtApi {
|
|
|
1085
1091
|
}
|
|
1086
1092
|
}
|
|
1087
1093
|
|
|
1094
|
+
/**
|
|
1095
|
+
* Normalize error response to have consistent message/label at top level
|
|
1096
|
+
* Extracts from messages array if present (from chain execution)
|
|
1097
|
+
*/
|
|
1098
|
+
_normalizeErrorResponse(response) {
|
|
1099
|
+
// If response already has message/label at top level and no messages array, return as-is
|
|
1100
|
+
if ((response.message || response.label) && !response.messages) {
|
|
1101
|
+
return response;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// Extract the most recent error from messages array
|
|
1105
|
+
if (response.messages && response.messages.length > 0) {
|
|
1106
|
+
const lastMessage = response.messages[response.messages.length - 1];
|
|
1107
|
+
return {
|
|
1108
|
+
...response,
|
|
1109
|
+
message: lastMessage.message || response.message || 'Unknown error',
|
|
1110
|
+
label: lastMessage.label || response.label || 'Error'
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
// Fallback: ensure we have at least message/label fields
|
|
1115
|
+
return {
|
|
1116
|
+
...response,
|
|
1117
|
+
message: response.message || 'Unknown error',
|
|
1118
|
+
label: response.label || 'Error'
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1088
1122
|
/**
|
|
1089
1123
|
* Polls the progress of a long-running task.
|
|
1090
1124
|
*
|
|
@@ -1117,8 +1151,8 @@ export default class RbtApi {
|
|
|
1117
1151
|
onDone(response);
|
|
1118
1152
|
}
|
|
1119
1153
|
if (response.status === 'ERROR' && onError) {
|
|
1120
|
-
//
|
|
1121
|
-
onError(response);
|
|
1154
|
+
// Normalize error response to have consistent message/label at top level
|
|
1155
|
+
onError(this._normalizeErrorResponse(response));
|
|
1122
1156
|
}
|
|
1123
1157
|
if (response.status === 'STOPPED' && onStopped) {
|
|
1124
1158
|
// Provide the current progress to the callback function
|
package/dist/rbt_api.js
CHANGED
|
@@ -1730,8 +1730,8 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1730
1730
|
this.pollTaskProgress(jobId, callbacks);
|
|
1731
1731
|
}
|
|
1732
1732
|
if (status === 'ERROR' && onError) {
|
|
1733
|
-
//
|
|
1734
|
-
onError(response);
|
|
1733
|
+
// Normalize error response to have consistent message/label at top level
|
|
1734
|
+
onError(this._normalizeErrorResponse(response));
|
|
1735
1735
|
}
|
|
1736
1736
|
if (status === 'STOPPED' && onStopped) {
|
|
1737
1737
|
// Provide the current progress to the callback function
|
|
@@ -1743,7 +1743,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1743
1743
|
}
|
|
1744
1744
|
if (status === 'DONE' && onDone) {
|
|
1745
1745
|
// Provide the current progress to the callback function
|
|
1746
|
-
//console.log('Finish (request) ',response);
|
|
1746
|
+
//console.log('Finish (request) ',response); s
|
|
1747
1747
|
onDone(response);
|
|
1748
1748
|
}
|
|
1749
1749
|
return _context23.a(2, {
|
|
@@ -1825,6 +1825,34 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
return stopJob;
|
|
1827
1827
|
}()
|
|
1828
|
+
/**
|
|
1829
|
+
* Normalize error response to have consistent message/label at top level
|
|
1830
|
+
* Extracts from messages array if present (from chain execution)
|
|
1831
|
+
*/
|
|
1832
|
+
}, {
|
|
1833
|
+
key: "_normalizeErrorResponse",
|
|
1834
|
+
value: function _normalizeErrorResponse(response) {
|
|
1835
|
+
// If response already has message/label at top level and no messages array, return as-is
|
|
1836
|
+
if ((response.message || response.label) && !response.messages) {
|
|
1837
|
+
return response;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
// Extract the most recent error from messages array
|
|
1841
|
+
if (response.messages && response.messages.length > 0) {
|
|
1842
|
+
var lastMessage = response.messages[response.messages.length - 1];
|
|
1843
|
+
return _objectSpread(_objectSpread({}, response), {}, {
|
|
1844
|
+
message: lastMessage.message || response.message || 'Unknown error',
|
|
1845
|
+
label: lastMessage.label || response.label || 'Error'
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
// Fallback: ensure we have at least message/label fields
|
|
1850
|
+
return _objectSpread(_objectSpread({}, response), {}, {
|
|
1851
|
+
message: response.message || 'Unknown error',
|
|
1852
|
+
label: response.label || 'Error'
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1828
1856
|
/**
|
|
1829
1857
|
* Polls the progress of a long-running task.
|
|
1830
1858
|
*
|
|
@@ -1865,8 +1893,8 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1865
1893
|
onDone(response);
|
|
1866
1894
|
}
|
|
1867
1895
|
if (response.status === 'ERROR' && onError) {
|
|
1868
|
-
//
|
|
1869
|
-
onError(response);
|
|
1896
|
+
// Normalize error response to have consistent message/label at top level
|
|
1897
|
+
onError(_this9._normalizeErrorResponse(response));
|
|
1870
1898
|
}
|
|
1871
1899
|
if (response.status === 'STOPPED' && onStopped) {
|
|
1872
1900
|
// Provide the current progress to the callback function
|
|
@@ -1878,7 +1906,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1878
1906
|
}
|
|
1879
1907
|
|
|
1880
1908
|
// Provide the current progress to the callback function
|
|
1881
|
-
if (response.status == 'RUNNING') {
|
|
1909
|
+
if (response.status == 'RUNNING' && onProgress) {
|
|
1882
1910
|
onProgress(response);
|
|
1883
1911
|
}
|
|
1884
1912
|
|
package/package.json
CHANGED
package/src/rbt_api.js
CHANGED
|
@@ -55,6 +55,12 @@ export default class RbtApi {
|
|
|
55
55
|
|
|
56
56
|
// Use the storageAdaptor to get the authToken, if available
|
|
57
57
|
this.initAuthToken(authtoken);
|
|
58
|
+
|
|
59
|
+
// Set apiKey synchronously if provided (don't wait for async initApiKey)
|
|
60
|
+
if (apikey) {
|
|
61
|
+
this.apikey = apikey;
|
|
62
|
+
this.axios.defaults.headers.common['apikey'] = this.apikey;
|
|
63
|
+
}
|
|
58
64
|
this.initApiKey(apikey);
|
|
59
65
|
|
|
60
66
|
|
|
@@ -1078,8 +1084,8 @@ export default class RbtApi {
|
|
|
1078
1084
|
this.pollTaskProgress(jobId, callbacks);
|
|
1079
1085
|
}
|
|
1080
1086
|
if (status === 'ERROR' && onError){
|
|
1081
|
-
//
|
|
1082
|
-
onError(response);
|
|
1087
|
+
// Normalize error response to have consistent message/label at top level
|
|
1088
|
+
onError(this._normalizeErrorResponse(response));
|
|
1083
1089
|
}
|
|
1084
1090
|
if (status === 'STOPPED' && onStopped){
|
|
1085
1091
|
// Provide the current progress to the callback function
|
|
@@ -1091,7 +1097,7 @@ export default class RbtApi {
|
|
|
1091
1097
|
}
|
|
1092
1098
|
if (status === 'DONE' && onDone){
|
|
1093
1099
|
// Provide the current progress to the callback function
|
|
1094
|
-
//console.log('Finish (request) ',response);
|
|
1100
|
+
//console.log('Finish (request) ',response); s
|
|
1095
1101
|
onDone(response);
|
|
1096
1102
|
}
|
|
1097
1103
|
|
|
@@ -1142,6 +1148,34 @@ export default class RbtApi {
|
|
|
1142
1148
|
}
|
|
1143
1149
|
|
|
1144
1150
|
|
|
1151
|
+
/**
|
|
1152
|
+
* Normalize error response to have consistent message/label at top level
|
|
1153
|
+
* Extracts from messages array if present (from chain execution)
|
|
1154
|
+
*/
|
|
1155
|
+
_normalizeErrorResponse(response) {
|
|
1156
|
+
// If response already has message/label at top level and no messages array, return as-is
|
|
1157
|
+
if ((response.message || response.label) && !response.messages) {
|
|
1158
|
+
return response;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// Extract the most recent error from messages array
|
|
1162
|
+
if (response.messages && response.messages.length > 0) {
|
|
1163
|
+
const lastMessage = response.messages[response.messages.length - 1];
|
|
1164
|
+
return {
|
|
1165
|
+
...response,
|
|
1166
|
+
message: lastMessage.message || response.message || 'Unknown error',
|
|
1167
|
+
label: lastMessage.label || response.label || 'Error'
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// Fallback: ensure we have at least message/label fields
|
|
1172
|
+
return {
|
|
1173
|
+
...response,
|
|
1174
|
+
message: response.message || 'Unknown error',
|
|
1175
|
+
label: response.label || 'Error'
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1145
1179
|
/**
|
|
1146
1180
|
* Polls the progress of a long-running task.
|
|
1147
1181
|
*
|
|
@@ -1165,8 +1199,8 @@ export default class RbtApi {
|
|
|
1165
1199
|
onDone(response);
|
|
1166
1200
|
}
|
|
1167
1201
|
if (response.status === 'ERROR' && onError){
|
|
1168
|
-
//
|
|
1169
|
-
onError(response);
|
|
1202
|
+
// Normalize error response to have consistent message/label at top level
|
|
1203
|
+
onError(this._normalizeErrorResponse(response));
|
|
1170
1204
|
}
|
|
1171
1205
|
if (response.status === 'STOPPED' && onStopped){
|
|
1172
1206
|
// Provide the current progress to the callback function
|