roboto-js 1.1.11 → 1.1.13
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 +3 -2
- package/dist/cjs/rbt_api.cjs +4 -3
- package/dist/esm/index.js +3 -2
- package/dist/esm/rbt_api.js +4 -3
- package/package.json +2 -1
- package/src/index.js +4 -2
- package/src/rbt_api.js +6 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -52,8 +52,9 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
// DEVELOPMENT
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
var baseUrl = new URL(this.config.baseUrl);
|
|
56
|
+
if (baseUrl.hostname === 'rbt.dorfio.com' || baseUrl.hostname.startsWith('localhost')) {
|
|
57
|
+
this.config.baseUrl = url.toString().replace(/^https:/, 'http:');
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
// Check if a request object is provided
|
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -656,7 +656,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
656
656
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
|
|
657
657
|
_context13.prev = 3;
|
|
658
658
|
_context13.next = 6;
|
|
659
|
-
return this.post('
|
|
659
|
+
return this.post('/task_service/runChain', params);
|
|
660
660
|
case 6:
|
|
661
661
|
response = _context13.sent;
|
|
662
662
|
if (response) {
|
|
@@ -725,7 +725,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
725
725
|
* @param {function} onProgress - Callback function that receives progress updates.
|
|
726
726
|
*
|
|
727
727
|
* The function periodically sends GET requests to check the task's progress
|
|
728
|
-
* and reports back via the provided callback function. The polling stops when
|
|
728
|
+
* and reports back via the provided callback function . The polling stops when
|
|
729
729
|
* the task is completed or an error occurs.
|
|
730
730
|
*/
|
|
731
731
|
)
|
|
@@ -747,7 +747,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
747
747
|
while (1) switch (_context14.prev = _context14.next) {
|
|
748
748
|
case 0:
|
|
749
749
|
_context14.next = 2;
|
|
750
|
-
return _this2.get("
|
|
750
|
+
return _this2.get("/task_service/pollChainProgress", {
|
|
751
751
|
jobId: jobId
|
|
752
752
|
});
|
|
753
753
|
case 2:
|
|
@@ -931,6 +931,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
931
931
|
if (res) return;
|
|
932
932
|
}
|
|
933
933
|
if (_lodash["default"].isObject(err) && _lodash["default"].get(err, 'response')) {
|
|
934
|
+
console.log('RbtAPI handleError', err);
|
|
934
935
|
var msg = _lodash["default"].get(err, 'response.data.message', 'Error in API response');
|
|
935
936
|
if (msg.key) {
|
|
936
937
|
throw new Error(msg.key);
|
package/dist/esm/index.js
CHANGED
|
@@ -20,8 +20,9 @@ export default class Roboto {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// DEVELOPMENT
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const baseUrl = new URL(this.config.baseUrl);
|
|
24
|
+
if (baseUrl.hostname === 'rbt.dorfio.com' || baseUrl.hostname.startsWith('localhost')) {
|
|
25
|
+
this.config.baseUrl = url.toString().replace(/^https:/, 'http:');
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
// Check if a request object is provided
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -342,7 +342,7 @@ export default class RbtApi {
|
|
|
342
342
|
onFinish
|
|
343
343
|
} = callbacks;
|
|
344
344
|
try {
|
|
345
|
-
const response = await this.post('
|
|
345
|
+
const response = await this.post('/task_service/runChain', params);
|
|
346
346
|
// Check if response and response.data are defined
|
|
347
347
|
if (!response) {
|
|
348
348
|
throw new Error('Invalid server response');
|
|
@@ -402,7 +402,7 @@ export default class RbtApi {
|
|
|
402
402
|
* @param {function} onProgress - Callback function that receives progress updates.
|
|
403
403
|
*
|
|
404
404
|
* The function periodically sends GET requests to check the task's progress
|
|
405
|
-
* and reports back via the provided callback function. The polling stops when
|
|
405
|
+
* and reports back via the provided callback function . The polling stops when
|
|
406
406
|
* the task is completed or an error occurs.
|
|
407
407
|
*/
|
|
408
408
|
async pollTaskProgress(jobId, callbacks) {
|
|
@@ -413,7 +413,7 @@ export default class RbtApi {
|
|
|
413
413
|
} = callbacks;
|
|
414
414
|
try {
|
|
415
415
|
const checkProgress = async () => {
|
|
416
|
-
const response = await this.get(
|
|
416
|
+
const response = await this.get(`/task_service/pollChainProgress`, {
|
|
417
417
|
jobId: jobId
|
|
418
418
|
});
|
|
419
419
|
|
|
@@ -529,6 +529,7 @@ export default class RbtApi {
|
|
|
529
529
|
if (res) return;
|
|
530
530
|
}
|
|
531
531
|
if (_.isObject(err) && _.get(err, 'response')) {
|
|
532
|
+
console.log('RbtAPI handleError', err);
|
|
532
533
|
const msg = _.get(err, 'response.data.message', 'Error in API response');
|
|
533
534
|
if (msg.key) {
|
|
534
535
|
throw new Error(msg.key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roboto-js",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/cjs/index.cjs",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"require": "./dist/cjs/index.cjs"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
+
"clean": "rm -rf node_modules; rm package-lock.json; npm install",
|
|
12
13
|
"build": "npm run build:cjs && npm run build:esm",
|
|
13
14
|
"build:cjs": "babel src --out-dir dist/cjs --presets=@babel/preset-env --extensions \".js,.jsx\" --out-file-extension .cjs && npm run postbuild:cjs",
|
|
14
15
|
"build:esm": "babel src --out-dir dist/esm",
|
package/src/index.js
CHANGED
|
@@ -31,10 +31,12 @@ export default class Roboto{
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// DEVELOPMENT
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const baseUrl = new URL(this.config.baseUrl);
|
|
35
|
+
if (baseUrl.hostname === 'rbt.dorfio.com' || baseUrl.hostname.startsWith('localhost')) {
|
|
36
|
+
this.config.baseUrl = url.toString().replace(/^https:/, 'http:');
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
|
|
38
40
|
// Check if a request object is provided
|
|
39
41
|
if (proxyReq && proxyReq.headers) {
|
|
40
42
|
const authtoken = proxyReq.headers.authtoken;
|
package/src/rbt_api.js
CHANGED
|
@@ -25,7 +25,6 @@ export default class RbtApi {
|
|
|
25
25
|
this.authtoken = authTokenToUse;
|
|
26
26
|
this.appServiceHost = null;
|
|
27
27
|
|
|
28
|
-
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
async initLocalDb(){
|
|
@@ -369,7 +368,7 @@ export default class RbtApi {
|
|
|
369
368
|
const { onProgress, onError, onFinish } = callbacks;
|
|
370
369
|
|
|
371
370
|
try {
|
|
372
|
-
const response = await this.post('
|
|
371
|
+
const response = await this.post('/task_service/runChain', params);
|
|
373
372
|
// Check if response and response.data are defined
|
|
374
373
|
if (!response) {
|
|
375
374
|
throw new Error('Invalid server response');
|
|
@@ -417,14 +416,14 @@ export default class RbtApi {
|
|
|
417
416
|
* @param {function} onProgress - Callback function that receives progress updates.
|
|
418
417
|
*
|
|
419
418
|
* The function periodically sends GET requests to check the task's progress
|
|
420
|
-
* and reports back via the provided callback function. The polling stops when
|
|
419
|
+
* and reports back via the provided callback function . The polling stops when
|
|
421
420
|
* the task is completed or an error occurs.
|
|
422
421
|
*/
|
|
423
422
|
async pollTaskProgress(jobId, callbacks) {
|
|
424
423
|
const { onProgress, onError, onFinish } = callbacks;
|
|
425
424
|
try {
|
|
426
425
|
const checkProgress = async () => {
|
|
427
|
-
const response = await this.get(
|
|
426
|
+
const response = await this.get(`/task_service/pollChainProgress`, { jobId: jobId });
|
|
428
427
|
|
|
429
428
|
// If the task is still in progress, start polling for updates
|
|
430
429
|
if (response.status === 'DONE' && onFinish){
|
|
@@ -543,6 +542,9 @@ export default class RbtApi {
|
|
|
543
542
|
}
|
|
544
543
|
|
|
545
544
|
if (_.isObject(err) && _.get(err, 'response')) {
|
|
545
|
+
|
|
546
|
+
console.log('RbtAPI handleError', err);
|
|
547
|
+
|
|
546
548
|
const msg = _.get(err, 'response.data.message', 'Error in API response');
|
|
547
549
|
|
|
548
550
|
if(msg.key){
|