@js4cytoscape/ndex-client 0.4.3-alpha.0 → 0.4.3-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@js4cytoscape/ndex-client",
3
- "version": "0.4.3-alpha.0",
3
+ "version": "0.4.3-alpha.1",
4
4
  "description": "NDEx client library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,6 +28,6 @@
28
28
  "node": ">=12.16.1"
29
29
  },
30
30
  "dependencies": {
31
- "axios": "^0.26.0"
31
+ "axios": "^1.3.4"
32
32
  }
33
33
  }
package/src/CyNDEx.js CHANGED
@@ -20,7 +20,7 @@ class CyNDEx {
20
20
  }
21
21
 
22
22
  getNDExServer() {
23
- return this._ndexServer ? this._ndexServer : 'http://public.ndexbio.org';
23
+ return this._ndexServer ? this._ndexServer : 'https://www.ndexbio.org';
24
24
  }
25
25
 
26
26
  setGoogleAuth(googleAuthObj) {
@@ -149,6 +149,10 @@ class CyNDEx {
149
149
  return this._httpPost('/cyndex2/v1/networks/cx', undefined, cx);
150
150
  }
151
151
 
152
+ postCX2NetworkToCytoscape(cx2_string, title, collection_name) {
153
+ return this._httpPost('/v1/networks',{ 'format': 'cx2', 'collection': collection_name, 'title':title}, cx2_string);
154
+ }
155
+
152
156
  postCytoscapeNetworkToNDEx(suid = 'current') {
153
157
  const saveParams = {
154
158
  serverUrl: this.getNDExServer() + '/v2',
package/src/NDEx.js CHANGED
@@ -9,7 +9,7 @@ const CX1_HEADER = {
9
9
  class NDEx {
10
10
  constructor(hostprefix) {
11
11
  if (hostprefix === undefined || hostprefix === null || hostprefix === '') {
12
- throw new Error('NDEx server endpoint base URL is required in client constructor.');
12
+ throw new Error('NDEx server host name or endpoint base URL is required in client constructor.');
13
13
  }
14
14
 
15
15
  // axios needs http to be at the front of the url.
@@ -17,7 +17,11 @@ class NDEx {
17
17
  // with an ambiguous reason
18
18
  let httpRegex = new RegExp("^(http|https)://", "i");
19
19
  if (!httpRegex.test(hostprefix)) {
20
- throw new Error(`"http://" or "https://" must be prefixed to the input url: ${hostprefix}`);
20
+ // throw new Error(`"http://" or "https://" must be prefixed to the input url: ${hostprefix}`);
21
+ // we assume it is a host name
22
+ if ( hostprefix.indexOf('/') > -1 )
23
+ throw new Error ('"/" are not allowed in host name.');
24
+ hostprefix = "https://"+ hostprefix + "/v2";
21
25
  }
22
26
 
23
27
  this._host = hostprefix;