ws-process 0.4.0 → 0.4.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/index.js +18 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -603,9 +603,17 @@ function asyncSend(msg) {
|
|
|
603
603
|
const cProcess = getCurrentProcess(getState, msg.processID);
|
|
604
604
|
const cProcessItemRoot = getCurrentProcessItem(getState, msg.processID);
|
|
605
605
|
|
|
606
|
-
if (!msg.action || (cProcess.useApi2 === true)) {
|
|
606
|
+
if (!msg.action || (cProcess.options.useApi2 === true)) {
|
|
607
607
|
let url;
|
|
608
|
+
let method;
|
|
609
|
+
if (msg.method) {
|
|
610
|
+
method = msg.method;
|
|
611
|
+
} else {
|
|
612
|
+
method = cProcess.options.method || 'POST';
|
|
613
|
+
}
|
|
608
614
|
const user = getState().user.currentUser;
|
|
615
|
+
let httpBody = msg.body;
|
|
616
|
+
let httpParams = msg.params;
|
|
609
617
|
|
|
610
618
|
if (/^https{0,1}:\/\//.test(msg.url)) {
|
|
611
619
|
url = msg.url;
|
|
@@ -622,6 +630,8 @@ function asyncSend(msg) {
|
|
|
622
630
|
// });
|
|
623
631
|
if (msg.action === 'manageadir') {
|
|
624
632
|
url = '/a';
|
|
633
|
+
httpBody = { params: msg.params };
|
|
634
|
+
httpParams = undefined;
|
|
625
635
|
} else if (msg.action === 'manageconfiguration') {
|
|
626
636
|
url = '/c';
|
|
627
637
|
} else if (msg.action === 'api-hub') {
|
|
@@ -640,7 +650,7 @@ function asyncSend(msg) {
|
|
|
640
650
|
const myDomain = [
|
|
641
651
|
'https://',
|
|
642
652
|
[
|
|
643
|
-
(user.system?.useApi2 === true || cProcess.useApi2 === true) ? 'api2' : 'api',
|
|
653
|
+
(user.system?.useApi2 === true || cProcess.options.useApi2 === true) ? 'api2' : 'api',
|
|
644
654
|
['dev', 'staging'].find(
|
|
645
655
|
(each) => each === local.stage,
|
|
646
656
|
)
|
|
@@ -670,7 +680,7 @@ function asyncSend(msg) {
|
|
|
670
680
|
headers['bsg-support-system-external-id'] = user.pid;
|
|
671
681
|
// headers['bsg-support-partner-id'] = user.partnerID;
|
|
672
682
|
// headers['bsg-support-system-id'] = user.systemID;
|
|
673
|
-
if (tryit(() =>
|
|
683
|
+
if (tryit(() => httpBody.Idp) === 'google' && !user.systemID && !user.partnerID) {
|
|
674
684
|
headers['x-api-key'] = '5db1bf127d3fcc0cfdd8880cb5cbe6f9'; // means "initial login"
|
|
675
685
|
} else {
|
|
676
686
|
headers['x-api-key'] = [user.systemID, user.partnerID].join('@');
|
|
@@ -680,9 +690,9 @@ function asyncSend(msg) {
|
|
|
680
690
|
|
|
681
691
|
const httpMSG = removeUndefinedKeys({
|
|
682
692
|
url,
|
|
683
|
-
method
|
|
684
|
-
params: defined(
|
|
685
|
-
data: defined(msg.data,
|
|
693
|
+
method,
|
|
694
|
+
params: defined(httpParams, method === 'GET' ? stringifyParams(httpBody) : undefined),
|
|
695
|
+
data: defined(msg.data, method !== 'GET' ? httpBody : undefined),
|
|
686
696
|
headers: {
|
|
687
697
|
...msg.headers,
|
|
688
698
|
...headers,
|
|
@@ -898,8 +908,8 @@ function asyncSend(msg) {
|
|
|
898
908
|
so we just wait for next message from lambda function
|
|
899
909
|
*/
|
|
900
910
|
|
|
901
|
-
const
|
|
902
|
-
if (
|
|
911
|
+
const cProcessStarted = getCurrentProcess(getState, started.processID);
|
|
912
|
+
if (cProcessStarted) {
|
|
903
913
|
local.dispatch(
|
|
904
914
|
updateWSProcess(started.processID, {
|
|
905
915
|
action: started.action,
|