ws-process 0.3.30 → 0.3.32
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/index.js +23 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable import/no-unresolved */
|
|
1
2
|
// ws-process.js
|
|
2
3
|
import axios from 'axios';
|
|
3
4
|
import {
|
|
@@ -456,6 +457,17 @@ function handleResponseHandler(res, getState, isLast = true, isFirst = true) {
|
|
|
456
457
|
return { cbData };
|
|
457
458
|
}
|
|
458
459
|
|
|
460
|
+
function stringifyParams(params) {
|
|
461
|
+
if (!params) {
|
|
462
|
+
return params;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return Object.keys(params).reduce((acc, key) => {
|
|
466
|
+
acc[key] = tryit(() => JSON.stringify(params[key]), params[key]);
|
|
467
|
+
return acc;
|
|
468
|
+
}, {});
|
|
469
|
+
}
|
|
470
|
+
|
|
459
471
|
function asyncSend(msg) {
|
|
460
472
|
return (dispatch, getState) => {
|
|
461
473
|
// eslint-disable-next-line consistent-return
|
|
@@ -530,7 +542,7 @@ function asyncSend(msg) {
|
|
|
530
542
|
const httpMSG = removeUndefinedKeys({
|
|
531
543
|
url,
|
|
532
544
|
method: msg.method,
|
|
533
|
-
params: defined(msg.params, msg.method === 'GET' ? msg.body : undefined),
|
|
545
|
+
params: defined(msg.params, msg.method === 'GET' ? stringifyParams(msg.body) : undefined),
|
|
534
546
|
data: defined(msg.data, msg.method !== 'GET' ? msg.body : undefined),
|
|
535
547
|
headers: {
|
|
536
548
|
...msg.headers,
|
|
@@ -558,6 +570,9 @@ function asyncSend(msg) {
|
|
|
558
570
|
local.dispatch(updateWSCount(processID));
|
|
559
571
|
reject(ex);
|
|
560
572
|
}).then((data) => {
|
|
573
|
+
if (data === undefined) {
|
|
574
|
+
return data;
|
|
575
|
+
}
|
|
561
576
|
const bodyUrl = tryit(() => data.data.getBodyFromUrl === true && data.data.url);
|
|
562
577
|
if (bodyUrl) {
|
|
563
578
|
return axios({
|
|
@@ -569,6 +584,10 @@ function asyncSend(msg) {
|
|
|
569
584
|
}
|
|
570
585
|
return data;
|
|
571
586
|
}).then((data) => {
|
|
587
|
+
if (data === undefined) {
|
|
588
|
+
return data;
|
|
589
|
+
}
|
|
590
|
+
|
|
572
591
|
if (process.env.NODE_ENV === 'test') {
|
|
573
592
|
// pass
|
|
574
593
|
} else {
|
|
@@ -612,7 +631,7 @@ function asyncSend(msg) {
|
|
|
612
631
|
data: newData,
|
|
613
632
|
});
|
|
614
633
|
}
|
|
615
|
-
return;
|
|
634
|
+
return undefined;
|
|
616
635
|
}
|
|
617
636
|
}
|
|
618
637
|
|
|
@@ -620,10 +639,11 @@ function asyncSend(msg) {
|
|
|
620
639
|
newData, getState,
|
|
621
640
|
);
|
|
622
641
|
if (terminate === true) {
|
|
623
|
-
return;
|
|
642
|
+
return undefined;
|
|
624
643
|
}
|
|
625
644
|
|
|
626
645
|
resolve(newData);
|
|
646
|
+
return undefined;
|
|
627
647
|
});
|
|
628
648
|
}
|
|
629
649
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ws-process",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "Process Management for Web Socket Client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"homepage": "https://github.com/bsgp/ws-process#readme",
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@bsgp/lib-core": "0.2.510",
|
|
28
|
-
"axios": "
|
|
28
|
+
"axios": "1.3.4",
|
|
29
29
|
"immer": "3.1.3",
|
|
30
30
|
"react": "16.8.6",
|
|
31
31
|
"react-dom": "16.8.6",
|