ws-process 0.3.58 → 0.4.0

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.
Files changed (2) hide show
  1. package/index.js +17 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable import/extensions */
1
2
  /* eslint-disable import/no-unresolved */
2
3
  // ws-process.js
3
4
  import axios from 'axios';
@@ -599,9 +600,10 @@ function asyncSend(msg) {
599
600
  }),
600
601
  );
601
602
 
603
+ const cProcess = getCurrentProcess(getState, msg.processID);
602
604
  const cProcessItemRoot = getCurrentProcessItem(getState, msg.processID);
603
605
 
604
- if (!msg.action) {
606
+ if (!msg.action || (cProcess.useApi2 === true)) {
605
607
  let url;
606
608
  const user = getState().user.currentUser;
607
609
 
@@ -618,18 +620,27 @@ function asyncSend(msg) {
618
620
  // return 'api-dev';
619
621
  // }
620
622
  // });
623
+ if (msg.action === 'manageadir') {
624
+ url = '/a';
625
+ } else if (msg.action === 'manageconfiguration') {
626
+ url = '/c';
627
+ } else if (msg.action === 'api-hub') {
628
+ url = '/h';
629
+ } else {
630
+ url = msg.url;
631
+ }
621
632
 
622
633
  const currentState = getState();
623
634
  const {
624
635
  AltDomain: altDomain,
625
636
  } = tryit(() => currentState['api-Configuration'].merged.ui.result) || {};
626
637
  if (altDomain) {
627
- url = [altDomain, msg.url.replace(/^\/{0,}/, '')].join('/');
638
+ url = [altDomain, url.replace(/^\/{0,}/, '')].join('/');
628
639
  } else {
629
- const defaultDomain = [
640
+ const myDomain = [
630
641
  'https://',
631
642
  [
632
- 'api',
643
+ (user.system?.useApi2 === true || cProcess.useApi2 === true) ? 'api2' : 'api',
633
644
  ['dev', 'staging'].find(
634
645
  (each) => each === local.stage,
635
646
  )
@@ -641,8 +652,8 @@ function asyncSend(msg) {
641
652
  '.bsg.support',
642
653
  ].join('');
643
654
  url = [
644
- user.system?.useApi2 === true ? 'https://api2.bsg.support' : defaultDomain,
645
- msg.url.replace(/^\/{0,}/, ''),
655
+ myDomain,
656
+ url.replace(/^\/{0,}/, ''),
646
657
  ].join('/');
647
658
  }
648
659
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws-process",
3
- "version": "0.3.58",
3
+ "version": "0.4.0",
4
4
  "description": "Process Management for Web Socket Client",
5
5
  "main": "index.js",
6
6
  "type": "module",