curtain-web-api 1.0.7 → 1.0.9

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.
@@ -32,7 +32,7 @@ export declare class CurtainWebAPI {
32
32
  getSiteProperties(): Promise<import("axios").AxiosResponse<any, any>>;
33
33
  saveDataFilterList(name: string, data: string): Promise<import("axios").AxiosResponse<any, any>>;
34
34
  getDataFilterListByID(id: number): Promise<import("axios").AxiosResponse<any, any>>;
35
- getDataFilterList(categoryName?: string): Promise<import("axios").AxiosResponse<any, any>>;
35
+ getDataFilterList(categoryName?: string, searchTerm?: string, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
36
36
  deleteDataFilterList(id: number): Promise<import("axios").AxiosResponse<any, any>>;
37
37
  downloadStats(): Promise<import("axios").AxiosResponse<any, any>>;
38
38
  }
@@ -67,6 +67,27 @@ class CurtainWebAPI {
67
67
  this.userInfoURL = baseURL + "user/";
68
68
  this.axiosInstance.interceptors.request.use((config) => {
69
69
  if (config.url) {
70
+ /*if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
71
+ if (config.url !== this.refereshURL &&
72
+ config.url !== this.loginURL &&
73
+ config.url !== this.orcidLoginURL) {
74
+ if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
75
+ console.log("refreshing token")
76
+ if (!this.isRefreshing) {
77
+ return this.refresh().then((response) => {
78
+ this.isRefreshing = false;
79
+ return this.axiosInstance.request(config);
80
+ }).catch((error) => {
81
+ this.isRefreshing = false;
82
+ this.user = new User();
83
+ return error;
84
+ });
85
+ }
86
+ }
87
+ }
88
+ } else {
89
+ this.user = new User();
90
+ }*/
70
91
  if (
71
92
  //config.url === this.refereshURL ||
72
93
  config.url === this.logoutURL ||
@@ -311,12 +332,15 @@ class CurtainWebAPI {
311
332
  return response;
312
333
  });
313
334
  }
314
- getDataFilterList(categoryName = "") {
335
+ getDataFilterList(categoryName = "", searchTerm = "", limit = 99999999) {
315
336
  let params = new URLSearchParams();
316
337
  if (categoryName != "") {
317
338
  params.append("name", categoryName);
318
339
  }
319
- params.append("limit", `${99999999}`);
340
+ if (searchTerm != "" && searchTerm != undefined) {
341
+ params.append("data", searchTerm);
342
+ }
343
+ params.append("limit", limit.toString());
320
344
  return this.axiosInstance.get(this.baseURL + "data_filter_list/", { responseType: "json", params });
321
345
  }
322
346
  deleteDataFilterList(id) {
@@ -62,7 +62,7 @@ function getInteractomeAtlas(genes, filterParameter = "None") {
62
62
  for (const g of genes) {
63
63
  searchTermArray.push("search_term_array%5B%5D=" + g);
64
64
  }
65
- return axios_1.default.get("http://www.interactome-atlas.org/search_results_interactions?" + params.toString() + "&" + searchTermArray.join("&"), { responseType: "json" }).then((res) => {
65
+ return axios_1.default.get("https://www.interactome-atlas.org/search_results_interactions?" + params.toString() + "&" + searchTermArray.join("&"), { responseType: "json" }).then((res) => {
66
66
  return JSON.parse(res.data);
67
67
  });
68
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -43,6 +43,27 @@ export class CurtainWebAPI {
43
43
  this.userInfoURL = baseURL + "user/";
44
44
  this.axiosInstance.interceptors.request.use((config) => {
45
45
  if (config.url) {
46
+ /*if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
47
+ if (config.url !== this.refereshURL &&
48
+ config.url !== this.loginURL &&
49
+ config.url !== this.orcidLoginURL) {
50
+ if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
51
+ console.log("refreshing token")
52
+ if (!this.isRefreshing) {
53
+ return this.refresh().then((response) => {
54
+ this.isRefreshing = false;
55
+ return this.axiosInstance.request(config);
56
+ }).catch((error) => {
57
+ this.isRefreshing = false;
58
+ this.user = new User();
59
+ return error;
60
+ });
61
+ }
62
+ }
63
+ }
64
+ } else {
65
+ this.user = new User();
66
+ }*/
46
67
  if (
47
68
  //config.url === this.refereshURL ||
48
69
  config.url === this.logoutURL ||
@@ -315,12 +336,16 @@ export class CurtainWebAPI {
315
336
  });
316
337
  }
317
338
 
318
- getDataFilterList(categoryName: string = "") {
339
+ getDataFilterList(categoryName: string = "", searchTerm: string = "", limit: number = 99999999) {
319
340
  let params = new URLSearchParams();
320
341
  if (categoryName != "") {
321
342
  params.append("name", categoryName)
322
343
  }
323
- params.append("limit", `${99999999}`)
344
+ if (searchTerm != "" && searchTerm != undefined) {
345
+ params.append("data", searchTerm)
346
+ }
347
+
348
+ params.append("limit", limit.toString())
324
349
  return this.axiosInstance.get(this.baseURL + "data_filter_list/", {responseType:"json", params})
325
350
  }
326
351
 
package/src/utilities.ts CHANGED
@@ -52,7 +52,7 @@ export function getInteractomeAtlas(genes: string[], filterParameter: string ="N
52
52
  }
53
53
 
54
54
  return axios.get(
55
- "http://www.interactome-atlas.org/search_results_interactions?" + params.toString() + "&" + searchTermArray.join("&"),
55
+ "https://www.interactome-atlas.org/search_results_interactions?" + params.toString() + "&" + searchTermArray.join("&"),
56
56
  {responseType: "json"}
57
57
  ).then((res:any) => {
58
58
  return JSON.parse(<string>res.data)