curtain-web-api 1.0.5 → 1.0.7

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/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ curtain-web-api
@@ -6,6 +6,8 @@
6
6
  <excludeFolder url="file://$MODULE_DIR$/temp" />
7
7
  <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
8
  <excludeFolder url="file://$MODULE_DIR$/node_modules" />
9
+ <excludeFolder url="file://$MODULE_DIR$/build" />
10
+ <excludeFolder url="file://$MODULE_DIR$/curtainuser" />
9
11
  </content>
10
12
  <orderEntry type="inheritedJdk" />
11
13
  <orderEntry type="sourceFolder" forTests="false" />
package/.idea/modules.xml CHANGED
@@ -2,7 +2,7 @@
2
2
  <project version="4">
3
3
  <component name="ProjectModuleManager">
4
4
  <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/curtain-login.iml" filepath="$PROJECT_DIR$/.idea/curtain-login.iml" />
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/curtain-web-api.iml" filepath="$PROJECT_DIR$/.idea/curtain-web-api.iml" />
6
6
  </modules>
7
7
  </component>
8
8
  </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # Curtain Web API
2
+ ---
3
+
4
+ This is a node.js package used to interact with the Curtain Web REST API.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm install curtain-web-api pouchdb -s
10
+ npm install @types/pouchdb -D
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ import { CurtainWebApi } from 'curtain-web-api';
17
+
18
+ const curtainAPI = new CurtainWebApi("https://curtain-api-location/")
19
+
20
+
21
+ // Login to the API
22
+
23
+ curtainAPI.login("username", "password").then((result) => {
24
+ console.log(result);
25
+ // The result is an object containing the user's information
26
+ }).catch((error) => {
27
+ console.log(error);
28
+ });
29
+
30
+ // Get the user's information
31
+ curtainAPI.getUser().then((result) => {
32
+ console.log(result);
33
+ // The result is an object containing the user's information similar to the login but can only be performed after login have succeeded
34
+ }).catch((error) => {
35
+ console.log(error);
36
+ });
37
+
38
+ // Get session information
39
+ curtainAPI.getSessionSettings(sessionId).then((result) => {
40
+ console.log(result);
41
+ // The result is an object containing the session's basic information without any data
42
+ }).catch((error) => {
43
+ console.log(error);
44
+ });
45
+
46
+
47
+ // Get session data
48
+ curtainAPI.postSettings(sessionId, sessionToken).then((result) => {
49
+ console.log(result);
50
+ // The result is an object containing the session's data
51
+ }).catch((error) => {
52
+ console.log(error);
53
+ });
54
+
55
+
56
+ // Upload session data
57
+ curtainAPI.putSettings(settings, enableToPublic, description, sessionType).then((result) => {
58
+ console.log(result);
59
+ // The result is an object containing the session's data
60
+ }).catch((error) => {
61
+ console.log(error);
62
+ });
63
+ ```
@@ -116,6 +116,7 @@ class CurtainWebAPI {
116
116
  this.user.access_token = response.data.access;
117
117
  this.user.refresh_token = response.data.refresh;
118
118
  this.user.loginStatus = true;
119
+ this.user.saveIntoDB().then();
119
120
  return this.getUserInfo();
120
121
  });
121
122
  }
@@ -163,6 +164,7 @@ class CurtainWebAPI {
163
164
  this.user.access_token = response.data.access;
164
165
  this.user.refresh_token = response.data.refresh;
165
166
  this.user.loginStatus = true;
167
+ this.user.saveIntoDB().then();
166
168
  return response;
167
169
  }).then((response) => {
168
170
  return this.getUserInfo();
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { CurtainWebAPI, replacer, reviver } from "./classes/curtain-api";
2
2
  import { User } from "./classes/curtain-user";
3
- import { getProteomicsData, getPrideData, getEBIAlpha } from "./utilities";
4
- export { CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, replacer, reviver };
3
+ import { getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions } from "./utilities";
4
+ export { CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions, replacer, reviver };
package/build/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reviver = exports.replacer = exports.getEBIAlpha = exports.getPrideData = exports.getProteomicsData = exports.User = exports.CurtainWebAPI = void 0;
3
+ exports.reviver = exports.replacer = exports.getStringDBInteractions = exports.getInteractomeAtlas = exports.getEBIAlpha = exports.getPrideData = exports.getProteomicsData = exports.User = exports.CurtainWebAPI = void 0;
4
4
  const curtain_api_1 = require("./classes/curtain-api");
5
5
  Object.defineProperty(exports, "CurtainWebAPI", { enumerable: true, get: function () { return curtain_api_1.CurtainWebAPI; } });
6
6
  Object.defineProperty(exports, "replacer", { enumerable: true, get: function () { return curtain_api_1.replacer; } });
@@ -11,3 +11,5 @@ const utilities_1 = require("./utilities");
11
11
  Object.defineProperty(exports, "getProteomicsData", { enumerable: true, get: function () { return utilities_1.getProteomicsData; } });
12
12
  Object.defineProperty(exports, "getPrideData", { enumerable: true, get: function () { return utilities_1.getPrideData; } });
13
13
  Object.defineProperty(exports, "getEBIAlpha", { enumerable: true, get: function () { return utilities_1.getEBIAlpha; } });
14
+ Object.defineProperty(exports, "getInteractomeAtlas", { enumerable: true, get: function () { return utilities_1.getInteractomeAtlas; } });
15
+ Object.defineProperty(exports, "getStringDBInteractions", { enumerable: true, get: function () { return utilities_1.getStringDBInteractions; } });
@@ -2,4 +2,4 @@ export declare function getProteomicsData(acc: string, tissueType: string): Prom
2
2
  export declare function getPrideData(acc: string): Promise<import("axios").AxiosResponse<any, any>>;
3
3
  export declare function getEBIAlpha(id: string): Promise<import("axios").AxiosResponse<any, any>>;
4
4
  export declare function getStringDBInteractions(genes: string[], organism: string, score?: number, networkType?: string): Promise<import("axios").AxiosResponse<any, any>>;
5
- export declare function interactomeAtlas(genes: string[], filterParameter?: string): Promise<any>;
5
+ export declare function getInteractomeAtlas(genes: string[], filterParameter?: string): Promise<any>;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.interactomeAtlas = exports.getStringDBInteractions = exports.getEBIAlpha = exports.getPrideData = exports.getProteomicsData = void 0;
26
+ exports.getInteractomeAtlas = exports.getStringDBInteractions = exports.getEBIAlpha = exports.getPrideData = exports.getProteomicsData = void 0;
27
27
  const axios_1 = __importStar(require("axios"));
28
28
  function getProteomicsData(acc, tissueType) {
29
29
  let headers = new axios_1.AxiosHeaders();
@@ -52,7 +52,7 @@ function getStringDBInteractions(genes, organism, score = 400, networkType = "fu
52
52
  return axios_1.default.get("https://string-db.org/api/tsv/network?", { responseType: "text", params: params });
53
53
  }
54
54
  exports.getStringDBInteractions = getStringDBInteractions;
55
- function interactomeAtlas(genes, filterParameter = "None") {
55
+ function getInteractomeAtlas(genes, filterParameter = "None") {
56
56
  let params = new URLSearchParams();
57
57
  params.append("query_interactors", "query");
58
58
  params.append("query_id_array", genes.join("%2C"));
@@ -66,4 +66,4 @@ function interactomeAtlas(genes, filterParameter = "None") {
66
66
  return JSON.parse(res.data);
67
67
  });
68
68
  }
69
- exports.interactomeAtlas = interactomeAtlas;
69
+ exports.getInteractomeAtlas = getInteractomeAtlas;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -94,6 +94,7 @@ export class CurtainWebAPI {
94
94
  this.user.access_token = response.data.access;
95
95
  this.user.refresh_token = response.data.refresh;
96
96
  this.user.loginStatus = true;
97
+ this.user.saveIntoDB().then();
97
98
  return this.getUserInfo();
98
99
  });
99
100
  }
@@ -147,6 +148,7 @@ export class CurtainWebAPI {
147
148
  this.user.access_token = response.data.access;
148
149
  this.user.refresh_token = response.data.refresh;
149
150
  this.user.loginStatus = true;
151
+ this.user.saveIntoDB().then();
150
152
  return response;
151
153
  }).then((response) => {
152
154
  return this.getUserInfo();
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {CurtainWebAPI, replacer, reviver} from "./classes/curtain-api";
2
2
  import {User} from "./classes/curtain-user";
3
- import {getProteomicsData, getPrideData, getEBIAlpha} from "./utilities";
3
+ import {getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions} from "./utilities";
4
4
 
5
- export {CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, replacer, reviver};
5
+ export {CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions, replacer, reviver};
@@ -100,7 +100,7 @@ describe("Session data", () => {
100
100
  })
101
101
  it('should login and then retrieve session data', async () => {
102
102
  const curtainLogin = new CurtainWebAPI();
103
- await curtainLogin.login("root", "21021992pkqtoaN")
103
+ await curtainLogin.login("testroot", "testpassword")
104
104
  const previousAccess = curtainLogin.user.access_token.slice()
105
105
  curtainLogin.user.access_token = ""
106
106
  expect(previousAccess).to.not.equal(curtainLogin.user.access_token)
@@ -110,7 +110,7 @@ describe("Session data", () => {
110
110
  });
111
111
  it('should login, expire access, then try to retrieve data', async () => {
112
112
  const curtainLogin = new CurtainWebAPI();
113
- await curtainLogin.login("root", "21021992pkqtoaN")
113
+ await curtainLogin.login("testroot", "testpassword")
114
114
  const previousAccess = curtainLogin.user.access_token.slice()
115
115
  curtainLogin.user.access_token = ""
116
116
  expect(previousAccess).to.not.equal(curtainLogin.user.access_token)
package/src/utilities.ts CHANGED
@@ -39,7 +39,7 @@ export function getStringDBInteractions(genes: string[], organism: string, score
39
39
  )
40
40
  }
41
41
 
42
- export function interactomeAtlas(genes: string[], filterParameter: string ="None") {
42
+ export function getInteractomeAtlas(genes: string[], filterParameter: string ="None") {
43
43
  let params = new URLSearchParams();
44
44
  params.append("query_interactors", "query");
45
45
  params.append("query_id_array", genes.join("%2C"));