curtain-web-api 1.0.48 → 1.0.50
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.
|
@@ -9,6 +9,7 @@ export declare class CurtainWebAPI {
|
|
|
9
9
|
orcidLoginURL: string;
|
|
10
10
|
userInfoURL: string;
|
|
11
11
|
curtainURL: string;
|
|
12
|
+
dataciteURL: string;
|
|
12
13
|
user: User;
|
|
13
14
|
isRefreshing: boolean;
|
|
14
15
|
axiosInstance: import("axios").AxiosInstance;
|
|
@@ -33,7 +34,7 @@ export declare class CurtainWebAPI {
|
|
|
33
34
|
getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
34
35
|
getSiteProperties(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
35
36
|
saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
36
|
-
getDataFilterListByID(id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
37
|
+
getDataFilterListByID(id: number, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
37
38
|
getDataFilterList(title?: string, searchTerm?: string, category?: string, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
38
39
|
getDataFilterListByCategory(category: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
39
40
|
deleteDataFilterList(id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -48,4 +49,7 @@ export declare class CurtainWebAPI {
|
|
|
48
49
|
createCurtainAPIKey(name: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
49
50
|
getCurtainAPIKeys(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
50
51
|
deleteCurtainAPIKey(id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
52
|
+
getRandomDataCiteSuffix(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
53
|
+
submitDataCite(data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
54
|
+
getDataCite(id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
51
55
|
}
|
|
@@ -66,6 +66,7 @@ class CurtainWebAPI {
|
|
|
66
66
|
this.orcidLoginURL = "";
|
|
67
67
|
this.userInfoURL = "";
|
|
68
68
|
this.curtainURL = "";
|
|
69
|
+
this.dataciteURL = "";
|
|
69
70
|
this.user = new curtain_user_1.User();
|
|
70
71
|
this.isRefreshing = false;
|
|
71
72
|
this.axiosInstance = axios_1.default.create();
|
|
@@ -77,6 +78,7 @@ class CurtainWebAPI {
|
|
|
77
78
|
this.orcidLoginURL = baseURL + "rest-auth/orcid/";
|
|
78
79
|
this.userInfoURL = baseURL + "user/";
|
|
79
80
|
this.curtainURL = baseURL + "curtain/";
|
|
81
|
+
this.dataciteURL = baseURL + "datacite/";
|
|
80
82
|
this.axiosInstance.interceptors.request.use((config) => {
|
|
81
83
|
if (config.url) {
|
|
82
84
|
/*if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
|
|
@@ -106,7 +108,7 @@ class CurtainWebAPI {
|
|
|
106
108
|
config.url === this.userInfoURL ||
|
|
107
109
|
config.url.startsWith(this.curtainURL) ||
|
|
108
110
|
config.url.startsWith(this.baseURL + "data_filter_list/") ||
|
|
109
|
-
config.url.startsWith(this.baseURL + "api_key/")) {
|
|
111
|
+
config.url.startsWith(this.baseURL + "api_key/") || config.url.startsWith(this.dataciteURL)) {
|
|
110
112
|
if (this.user.loginStatus) {
|
|
111
113
|
config.headers["Authorization"] = "Bearer " + this.user.access_token;
|
|
112
114
|
}
|
|
@@ -219,11 +221,11 @@ class CurtainWebAPI {
|
|
|
219
221
|
return response;
|
|
220
222
|
});
|
|
221
223
|
}
|
|
222
|
-
putSettings(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
putSettings(settings_1) {
|
|
225
|
+
return __awaiter(this, arguments, void 0, function* (settings, enable = true, description = "", sessionType = "TP", encryption = {
|
|
226
|
+
encrypted: false,
|
|
227
|
+
e2e: false,
|
|
228
|
+
}, permanent = false, onUploadProgress = undefined) {
|
|
227
229
|
let form = new FormData();
|
|
228
230
|
let data = JSON.stringify(settings, exports.replacer);
|
|
229
231
|
if (enable) {
|
|
@@ -319,11 +321,11 @@ class CurtainWebAPI {
|
|
|
319
321
|
return response;
|
|
320
322
|
});
|
|
321
323
|
}
|
|
322
|
-
updateSession(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
updateSession(sessionData_1, linkId_1) {
|
|
325
|
+
return __awaiter(this, arguments, void 0, function* (sessionData, linkId, encryption = {
|
|
326
|
+
encrypted: false,
|
|
327
|
+
e2e: false,
|
|
328
|
+
}) {
|
|
327
329
|
let form = new FormData();
|
|
328
330
|
if ("file" in sessionData) {
|
|
329
331
|
let data = JSON.stringify(sessionData["file"], exports.replacer);
|
|
@@ -430,10 +432,11 @@ class CurtainWebAPI {
|
|
|
430
432
|
return response;
|
|
431
433
|
});
|
|
432
434
|
}
|
|
433
|
-
getDataFilterListByID(id) {
|
|
435
|
+
getDataFilterListByID(id, limit = 100) {
|
|
434
436
|
let headers = new axios_1.AxiosHeaders();
|
|
435
437
|
headers["Accept"] = "application/json";
|
|
436
|
-
|
|
438
|
+
let params = { limit: limit.toString() };
|
|
439
|
+
return this.axiosInstance.get(this.baseURL + "data_filter_list/" + id + "/", { headers: headers, responseType: "json", }).then((response) => {
|
|
437
440
|
return response;
|
|
438
441
|
});
|
|
439
442
|
}
|
|
@@ -546,5 +549,21 @@ class CurtainWebAPI {
|
|
|
546
549
|
headers["Content-Type"] = "application/json";
|
|
547
550
|
return this.axiosInstance.delete(this.baseURL + "api_key/" + id + "/", { headers: headers, responseType: "json" });
|
|
548
551
|
}
|
|
552
|
+
getRandomDataCiteSuffix() {
|
|
553
|
+
let headers = new axios_1.AxiosHeaders();
|
|
554
|
+
headers["Accept"] = "application/json";
|
|
555
|
+
return this.axiosInstance.get(this.baseURL + "datacite/get_random_suffix/", { headers: headers, responseType: "json" });
|
|
556
|
+
}
|
|
557
|
+
submitDataCite(data) {
|
|
558
|
+
let headers = new axios_1.AxiosHeaders();
|
|
559
|
+
headers["Accept"] = "application/json";
|
|
560
|
+
headers["Content-Type"] = "application/json";
|
|
561
|
+
return this.axiosInstance.post(this.baseURL + "datacite/", data, { headers: headers, responseType: "json" });
|
|
562
|
+
}
|
|
563
|
+
getDataCite(id) {
|
|
564
|
+
let headers = new axios_1.AxiosHeaders();
|
|
565
|
+
headers["Accept"] = "application/json";
|
|
566
|
+
return this.axiosInstance.get(this.baseURL + "datacite/" + id + "/", { headers: headers, responseType: "json" });
|
|
567
|
+
}
|
|
549
568
|
}
|
|
550
569
|
exports.CurtainWebAPI = CurtainWebAPI;
|
|
@@ -9,29 +9,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.encryptDataRSA = encryptDataRSA;
|
|
13
|
+
exports.decryptDataRSA = decryptDataRSA;
|
|
14
|
+
exports.importPublicKey = importPublicKey;
|
|
15
|
+
exports.importPrivateKey = importPrivateKey;
|
|
16
|
+
exports.generateKeyPair = generateKeyPair;
|
|
17
|
+
exports.exportPublicKey = exportPublicKey;
|
|
18
|
+
exports.exportPrivateKey = exportPrivateKey;
|
|
19
|
+
exports.importKey = importKey;
|
|
20
|
+
exports.exportKeyString = exportKeyString;
|
|
21
|
+
exports.saveToLocalStorage = saveToLocalStorage;
|
|
22
|
+
exports.loadFromLocalStorage = loadFromLocalStorage;
|
|
23
|
+
exports.arrayBufferToBase64String = arrayBufferToBase64String;
|
|
24
|
+
exports.removeLines = removeLines;
|
|
25
|
+
exports.base64ToArrayBuffer = base64ToArrayBuffer;
|
|
26
|
+
exports.pemToArrayBuffer = pemToArrayBuffer;
|
|
27
|
+
exports.encryptAESKey = encryptAESKey;
|
|
28
|
+
exports.generateAESKey = generateAESKey;
|
|
29
|
+
exports.encryptAESData = encryptAESData;
|
|
30
|
+
exports.decryptAESData = decryptAESData;
|
|
31
|
+
exports.decryptAESKey = decryptAESKey;
|
|
32
|
+
exports.exportAESKey = exportAESKey;
|
|
33
|
+
exports.importAESKey = importAESKey;
|
|
34
|
+
exports.encryptDataAES = encryptDataAES;
|
|
35
|
+
exports.decryptDataAES = decryptDataAES;
|
|
36
|
+
exports.hashData = hashData;
|
|
13
37
|
function encryptDataRSA(data, publicKey) {
|
|
14
38
|
return crypto.subtle.encrypt({ name: 'RSA-OAEP' }, publicKey, new TextEncoder().encode(data));
|
|
15
39
|
}
|
|
16
|
-
exports.encryptDataRSA = encryptDataRSA;
|
|
17
40
|
function decryptDataRSA(data, privateKey) {
|
|
18
41
|
return crypto.subtle.decrypt({ name: 'RSA-OAEP' }, privateKey, new TextEncoder().encode(data));
|
|
19
42
|
}
|
|
20
|
-
exports.decryptDataRSA = decryptDataRSA;
|
|
21
43
|
function importPublicKey(key) {
|
|
22
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
45
|
return yield crypto.subtle.importKey('spki', key, { name: 'RSA-OAEP', hash: 'SHA-256' }, true, ['encrypt']);
|
|
24
46
|
});
|
|
25
47
|
}
|
|
26
|
-
exports.importPublicKey = importPublicKey;
|
|
27
48
|
function importPrivateKey(key) {
|
|
28
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
50
|
return yield crypto.subtle.importKey('pkcs8', key, { name: 'RSA-OAEP', hash: 'SHA-256' }, true, ['decrypt']);
|
|
30
51
|
});
|
|
31
52
|
}
|
|
32
|
-
|
|
33
|
-
function
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
function generateKeyPair() {
|
|
54
|
+
return __awaiter(this, arguments, void 0, function* (modulusLength = 2048, publicExponent = new Uint8Array([1, 0, 1])) {
|
|
35
55
|
return yield crypto.subtle.generateKey({
|
|
36
56
|
name: "RSA-OAEP",
|
|
37
57
|
modulusLength: modulusLength,
|
|
@@ -40,19 +60,16 @@ function generateKeyPair(modulusLength = 2048, publicExponent = new Uint8Array([
|
|
|
40
60
|
}, true, ["encrypt", "decrypt"]);
|
|
41
61
|
});
|
|
42
62
|
}
|
|
43
|
-
exports.generateKeyPair = generateKeyPair;
|
|
44
63
|
function exportPublicKey(key) {
|
|
45
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
65
|
return yield crypto.subtle.exportKey('spki', key);
|
|
47
66
|
});
|
|
48
67
|
}
|
|
49
|
-
exports.exportPublicKey = exportPublicKey;
|
|
50
68
|
function exportPrivateKey(key) {
|
|
51
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
70
|
return yield crypto.subtle.exportKey('pkcs8', key);
|
|
53
71
|
});
|
|
54
72
|
}
|
|
55
|
-
exports.exportPrivateKey = exportPrivateKey;
|
|
56
73
|
function importKey(key, type) {
|
|
57
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
75
|
if (type === "public") {
|
|
@@ -63,7 +80,6 @@ function importKey(key, type) {
|
|
|
63
80
|
}
|
|
64
81
|
});
|
|
65
82
|
}
|
|
66
|
-
exports.importKey = importKey;
|
|
67
83
|
function exportKeyString(key, type) {
|
|
68
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
85
|
if (type === "public") {
|
|
@@ -76,14 +92,12 @@ function exportKeyString(key, type) {
|
|
|
76
92
|
}
|
|
77
93
|
});
|
|
78
94
|
}
|
|
79
|
-
exports.exportKeyString = exportKeyString;
|
|
80
95
|
function saveToLocalStorage(key, type) {
|
|
81
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
97
|
const k = yield exportKeyString(key, type);
|
|
83
98
|
localStorage.setItem(type + "_key", k);
|
|
84
99
|
});
|
|
85
100
|
}
|
|
86
|
-
exports.saveToLocalStorage = saveToLocalStorage;
|
|
87
101
|
function loadFromLocalStorage(type) {
|
|
88
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
103
|
const k = localStorage.getItem(type + "_key");
|
|
@@ -93,7 +107,6 @@ function loadFromLocalStorage(type) {
|
|
|
93
107
|
return undefined;
|
|
94
108
|
});
|
|
95
109
|
}
|
|
96
|
-
exports.loadFromLocalStorage = loadFromLocalStorage;
|
|
97
110
|
function arrayBufferToBase64String(arrayBuffer) {
|
|
98
111
|
const byteArray = new Uint8Array(arrayBuffer);
|
|
99
112
|
let byteString = '';
|
|
@@ -102,11 +115,9 @@ function arrayBufferToBase64String(arrayBuffer) {
|
|
|
102
115
|
}
|
|
103
116
|
return btoa(byteString);
|
|
104
117
|
}
|
|
105
|
-
exports.arrayBufferToBase64String = arrayBufferToBase64String;
|
|
106
118
|
function removeLines(str_data) {
|
|
107
119
|
return str_data.replace("\n", "");
|
|
108
120
|
}
|
|
109
|
-
exports.removeLines = removeLines;
|
|
110
121
|
function base64ToArrayBuffer(b64) {
|
|
111
122
|
const byteString = atob(b64);
|
|
112
123
|
const byteArray = new Uint8Array(byteString.length);
|
|
@@ -115,7 +126,6 @@ function base64ToArrayBuffer(b64) {
|
|
|
115
126
|
}
|
|
116
127
|
return byteArray;
|
|
117
128
|
}
|
|
118
|
-
exports.base64ToArrayBuffer = base64ToArrayBuffer;
|
|
119
129
|
function pemToArrayBuffer(pem) {
|
|
120
130
|
const b64Lines = removeLines(pem);
|
|
121
131
|
let b64Prefix = b64Lines.replace('-----BEGIN PRIVATE KEY-----', '');
|
|
@@ -124,14 +134,12 @@ function pemToArrayBuffer(pem) {
|
|
|
124
134
|
b64Final = b64Final.replace('-----END PUBLIC KEY-----', '');
|
|
125
135
|
return base64ToArrayBuffer(b64Final);
|
|
126
136
|
}
|
|
127
|
-
exports.pemToArrayBuffer = pemToArrayBuffer;
|
|
128
137
|
// a function to generate to encrypt an aes key arraybuffer with a public key
|
|
129
138
|
function encryptAESKey(publicKey, aesKey) {
|
|
130
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
140
|
return yield crypto.subtle.encrypt({ name: "RSA-OAEP" }, publicKey, aesKey);
|
|
132
141
|
});
|
|
133
142
|
}
|
|
134
|
-
exports.encryptAESKey = encryptAESKey;
|
|
135
143
|
// a function to generate an aes key in GCM mode with a length of 256 bits
|
|
136
144
|
function generateAESKey() {
|
|
137
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -141,7 +149,6 @@ function generateAESKey() {
|
|
|
141
149
|
}, true, ["encrypt", "decrypt"]);
|
|
142
150
|
});
|
|
143
151
|
}
|
|
144
|
-
exports.generateAESKey = generateAESKey;
|
|
145
152
|
// a function to encrypt a string with an aes key
|
|
146
153
|
function encryptAESData(aesKey, data) {
|
|
147
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -152,7 +159,6 @@ function encryptAESData(aesKey, data) {
|
|
|
152
159
|
return { encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv) };
|
|
153
160
|
});
|
|
154
161
|
}
|
|
155
|
-
exports.encryptAESData = encryptAESData;
|
|
156
162
|
// a function to decrypt a string with an aes key
|
|
157
163
|
function decryptAESData(aesKey, data, iv) {
|
|
158
164
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -161,28 +167,24 @@ function decryptAESData(aesKey, data, iv) {
|
|
|
161
167
|
return dec.decode(decrypted);
|
|
162
168
|
});
|
|
163
169
|
}
|
|
164
|
-
exports.decryptAESData = decryptAESData;
|
|
165
170
|
// a function to decrypt an aes key with a private key
|
|
166
171
|
function decryptAESKey(privateKey, encryptedKey) {
|
|
167
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
173
|
return yield crypto.subtle.decrypt({ name: "RSA-OAEP" }, privateKey, encryptedKey);
|
|
169
174
|
});
|
|
170
175
|
}
|
|
171
|
-
exports.decryptAESKey = decryptAESKey;
|
|
172
176
|
// a function to export an aes key to a string
|
|
173
177
|
function exportAESKey(key) {
|
|
174
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
175
179
|
return yield crypto.subtle.exportKey("raw", key);
|
|
176
180
|
});
|
|
177
181
|
}
|
|
178
|
-
exports.exportAESKey = exportAESKey;
|
|
179
182
|
// a function to import an aes key from a string
|
|
180
183
|
function importAESKey(key) {
|
|
181
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
185
|
return yield crypto.subtle.importKey("raw", key, "AES-GCM", true, ["encrypt", "decrypt"]);
|
|
183
186
|
});
|
|
184
187
|
}
|
|
185
|
-
exports.importAESKey = importAESKey;
|
|
186
188
|
// a function to encrypt aes key with a public key and also use the aes key to encrypt a large string then return the encrypted aes key and the encrypted string
|
|
187
189
|
function encryptDataAES(data, publicKey) {
|
|
188
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -192,7 +194,6 @@ function encryptDataAES(data, publicKey) {
|
|
|
192
194
|
return { encryptedKey: arrayBufferToBase64String(encryptedKey), encryptedData: encryptedData };
|
|
193
195
|
});
|
|
194
196
|
}
|
|
195
|
-
exports.encryptDataAES = encryptDataAES;
|
|
196
197
|
// a function to decrypt an aes key with a private key and use the aes key to decrypt a large string
|
|
197
198
|
function decryptDataAES(encryptedKey, encryptedData, iv, privateKey) {
|
|
198
199
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -201,7 +202,6 @@ function decryptDataAES(encryptedKey, encryptedData, iv, privateKey) {
|
|
|
201
202
|
return yield decryptAESData(yield importAESKey(aesKey), encryptedData, iv);
|
|
202
203
|
});
|
|
203
204
|
}
|
|
204
|
-
exports.decryptDataAES = decryptDataAES;
|
|
205
205
|
// a function to calculate sha-256 hash of a large string
|
|
206
206
|
function hashData(data) {
|
|
207
207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -211,4 +211,3 @@ function hashData(data) {
|
|
|
211
211
|
return arrayBufferToBase64String(hash);
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
|
-
exports.hashData = hashData;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/// <reference types="pouchdb-find" />
|
|
2
|
-
/// <reference types="pouchdb-core" />
|
|
3
|
-
/// <reference types="pouchdb-mapreduce" />
|
|
4
|
-
/// <reference types="pouchdb-replication" />
|
|
5
1
|
export declare class User {
|
|
6
2
|
get refresh_token(): string;
|
|
7
3
|
set refresh_token(value: string);
|
package/build/utilities.js
CHANGED
|
@@ -23,7 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.getProteomicsData = getProteomicsData;
|
|
27
|
+
exports.getPrideData = getPrideData;
|
|
28
|
+
exports.getEBIAlpha = getEBIAlpha;
|
|
29
|
+
exports.getStringDBInteractions = getStringDBInteractions;
|
|
30
|
+
exports.getInteractomeAtlas = getInteractomeAtlas;
|
|
27
31
|
const axios_1 = __importStar(require("axios"));
|
|
28
32
|
function getProteomicsData(acc, tissueType) {
|
|
29
33
|
let headers = new axios_1.AxiosHeaders();
|
|
@@ -31,18 +35,15 @@ function getProteomicsData(acc, tissueType) {
|
|
|
31
35
|
headers["Content-Type"] = "application/json";
|
|
32
36
|
return axios_1.default.get("https://www.proteomicsdb.org/proteomicsdb/logic/api/proteinexpression.xsodata/InputParams(PROTEINFILTER='" + acc + "',MS_LEVEL=1,TISSUE_ID_SELECTION='',TISSUE_CATEGORY_SELECTION='" + tissueType + "',SCOPE_SELECTION=1,GROUP_BY_TISSUE=1,CALCULATION_METHOD=0,EXP_ID=-1)/Results?$select=UNIQUE_IDENTIFIER,TISSUE_ID,TISSUE_NAME,TISSUE_SAP_SYNONYM,SAMPLE_ID,SAMPLE_NAME,AFFINITY_PURIFICATION,EXPERIMENT_ID,EXPERIMENT_NAME,EXPERIMENT_SCOPE,EXPERIMENT_SCOPE_NAME,PROJECT_ID,PROJECT_NAME,PROJECT_STATUS,UNNORMALIZED_INTENSITY,NORMALIZED_INTENSITY,MIN_NORMALIZED_INTENSITY,MAX_NORMALIZED_INTENSITY,SAMPLES&$format=json", { responseType: "json" });
|
|
33
37
|
}
|
|
34
|
-
exports.getProteomicsData = getProteomicsData;
|
|
35
38
|
function getPrideData(acc) {
|
|
36
39
|
let headers = new axios_1.AxiosHeaders();
|
|
37
40
|
headers["Accept"] = "application/json";
|
|
38
41
|
headers["Content-Type"] = "application/json";
|
|
39
42
|
return axios_1.default.get("https://www.ebi.ac.uk/pride/ws/archive/v2/projects/" + acc, { responseType: "json", headers: headers });
|
|
40
43
|
}
|
|
41
|
-
exports.getPrideData = getPrideData;
|
|
42
44
|
function getEBIAlpha(id) {
|
|
43
45
|
return axios_1.default.get("https://alphafold.ebi.ac.uk/" + "/api/prediction/" + id, { responseType: "json" });
|
|
44
46
|
}
|
|
45
|
-
exports.getEBIAlpha = getEBIAlpha;
|
|
46
47
|
function getStringDBInteractions(genes, organism, score = 400, networkType = "functional") {
|
|
47
48
|
let params = new URLSearchParams();
|
|
48
49
|
params.append("identifiers", genes.join("%0d"));
|
|
@@ -51,7 +52,6 @@ function getStringDBInteractions(genes, organism, score = 400, networkType = "fu
|
|
|
51
52
|
params.append("network_type", networkType);
|
|
52
53
|
return axios_1.default.get("https://string-db.org/api/tsv/network?", { responseType: "text", params: params });
|
|
53
54
|
}
|
|
54
|
-
exports.getStringDBInteractions = getStringDBInteractions;
|
|
55
55
|
function getInteractomeAtlas(genes, filterParameter = "None") {
|
|
56
56
|
let params = new URLSearchParams();
|
|
57
57
|
params.append("query_interactors", "query");
|
|
@@ -66,4 +66,3 @@ function getInteractomeAtlas(genes, filterParameter = "None") {
|
|
|
66
66
|
return JSON.parse(res.data);
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
exports.getInteractomeAtlas = getInteractomeAtlas;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "curtain-web-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.50",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"axios": "^1.3.5",
|
|
19
|
-
"pouchdb": "^
|
|
19
|
+
"pouchdb": "^9.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/expect": "^24.3.0",
|
|
@@ -37,6 +37,7 @@ export class CurtainWebAPI {
|
|
|
37
37
|
orcidLoginURL: string = "";
|
|
38
38
|
userInfoURL: string = "";
|
|
39
39
|
curtainURL: string = "";
|
|
40
|
+
dataciteURL: string = "";
|
|
40
41
|
user: User = new User();
|
|
41
42
|
isRefreshing: boolean = false;
|
|
42
43
|
axiosInstance = axios.create()
|
|
@@ -50,6 +51,7 @@ export class CurtainWebAPI {
|
|
|
50
51
|
this.orcidLoginURL = baseURL + "rest-auth/orcid/";
|
|
51
52
|
this.userInfoURL = baseURL + "user/";
|
|
52
53
|
this.curtainURL = baseURL + "curtain/"
|
|
54
|
+
this.dataciteURL = baseURL + "datacite/"
|
|
53
55
|
this.axiosInstance.interceptors.request.use((config) => {
|
|
54
56
|
if (config.url) {
|
|
55
57
|
/*if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
|
|
@@ -79,7 +81,7 @@ export class CurtainWebAPI {
|
|
|
79
81
|
config.url === this.userInfoURL ||
|
|
80
82
|
config.url.startsWith(this.curtainURL) ||
|
|
81
83
|
config.url.startsWith(this.baseURL + "data_filter_list/") ||
|
|
82
|
-
config.url.startsWith(this.baseURL + "api_key/")) {
|
|
84
|
+
config.url.startsWith(this.baseURL + "api_key/")|| config.url.startsWith(this.dataciteURL)) {
|
|
83
85
|
if (this.user.loginStatus) {
|
|
84
86
|
config.headers["Authorization"] = "Bearer " + this.user.access_token;
|
|
85
87
|
}
|
|
@@ -423,10 +425,11 @@ export class CurtainWebAPI {
|
|
|
423
425
|
});
|
|
424
426
|
}
|
|
425
427
|
|
|
426
|
-
getDataFilterListByID(id: number) {
|
|
428
|
+
getDataFilterListByID(id: number, limit: number = 100) {
|
|
427
429
|
let headers = new AxiosHeaders();
|
|
428
430
|
headers["Accept"] = "application/json";
|
|
429
|
-
|
|
431
|
+
let params = {limit: limit.toString()}
|
|
432
|
+
return this.axiosInstance.get(this.baseURL + "data_filter_list/" + id + "/", {headers: headers, responseType:"json",}).then((response) => {
|
|
430
433
|
return response;
|
|
431
434
|
});
|
|
432
435
|
}
|
|
@@ -557,5 +560,24 @@ export class CurtainWebAPI {
|
|
|
557
560
|
headers["Content-Type"] = "application/json"
|
|
558
561
|
return this.axiosInstance.delete(this.baseURL + "api_key/" + id + "/", {headers: headers, responseType: "json"})
|
|
559
562
|
}
|
|
563
|
+
|
|
564
|
+
getRandomDataCiteSuffix() {
|
|
565
|
+
let headers = new AxiosHeaders()
|
|
566
|
+
headers["Accept"] = "application/json"
|
|
567
|
+
return this.axiosInstance.get(this.baseURL + "datacite/get_random_suffix/", {headers: headers, responseType: "json"})
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
submitDataCite(data: any) {
|
|
571
|
+
let headers = new AxiosHeaders()
|
|
572
|
+
headers["Accept"] = "application/json"
|
|
573
|
+
headers["Content-Type"] = "application/json"
|
|
574
|
+
return this.axiosInstance.post(this.baseURL + "datacite/", data, {headers: headers, responseType: "json"})
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
getDataCite(id: number) {
|
|
578
|
+
let headers = new AxiosHeaders()
|
|
579
|
+
headers["Accept"] = "application/json"
|
|
580
|
+
return this.axiosInstance.get(this.baseURL + "datacite/" + id + "/", {headers: headers, responseType: "json"})
|
|
581
|
+
}
|
|
560
582
|
}
|
|
561
583
|
|