curtain-web-api 1.0.61 → 1.0.63
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/build/classes/curtain-api.d.ts +50 -40
- package/build/classes/curtain-api.js +57 -11
- package/build/classes/curtain-encryption.d.ts +2 -2
- package/build/classes/curtain-encryption.js +2 -2
- package/build/index.d.ts +2 -2
- package/build/utilities.d.ts +4 -4
- package/build/utilities.js +17 -7
- package/package.json +1 -1
- package/src/classes/curtain-api.ts +49 -4
- package/src/classes/curtain-encryption.ts +4 -4
- package/src/index.ts +2 -1
|
@@ -2,6 +2,12 @@ import { User } from "./curtain-user";
|
|
|
2
2
|
import { CurtainEncryption } from "./curtain-encryption";
|
|
3
3
|
export declare const replacer: (key: any, value: any) => any;
|
|
4
4
|
export declare const reviver: (key: any, value: any) => any;
|
|
5
|
+
export interface SiteProperties {
|
|
6
|
+
non_user_post: boolean;
|
|
7
|
+
allow_user_set_permanent: boolean;
|
|
8
|
+
expiry_duration_options: number[];
|
|
9
|
+
default_expiry_duration_months: number;
|
|
10
|
+
}
|
|
5
11
|
export declare class CurtainWebAPI {
|
|
6
12
|
loginURL: string;
|
|
7
13
|
logoutURL: string;
|
|
@@ -18,49 +24,53 @@ export declare class CurtainWebAPI {
|
|
|
18
24
|
login(username: string, password: string): Promise<User>;
|
|
19
25
|
getUserInfo(): Promise<User>;
|
|
20
26
|
logout(): Promise<void>;
|
|
21
|
-
refresh(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
27
|
+
refresh(): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
22
28
|
ORCIDLogin(authorizationCode: string, redirectURI: string): Promise<User>;
|
|
23
29
|
checkIfRefreshTokenExpired(): boolean;
|
|
24
|
-
deleteCurtainLink(curtainLinkID: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
25
|
-
putSettings(settings: any, enable?: boolean, description?: string, sessionType?: string, encryption?: CurtainEncryption, permanent?: boolean, onUploadProgress?: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
26
|
-
postSettings(id: string, token: string, onDownloadProgress?: any, url?: string | undefined): Promise<import("axios").AxiosResponse<any, any>>;
|
|
27
|
-
getPrideData(accession: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
28
|
-
generateTemporarySession(linkId: string, lifetime: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
29
|
-
updateSession(sessionData: any, linkId: string, encryption?: CurtainEncryption): Promise<import("axios").AxiosResponse<any, any>>;
|
|
30
|
-
getSessionSettings(linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
31
|
-
getOwnership(linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
32
|
-
getOwners(linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
33
|
-
addOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
34
|
-
getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
35
|
-
getSiteProperties(): Promise<import("axios").AxiosResponse<any,
|
|
36
|
-
saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
37
|
-
getDataFilterListByID(id: number, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
38
|
-
getDataFilterList(title?: string, searchTerm?: string, category?: string, limit?: number, offset?: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
39
|
-
getDataFilterListByCategory(category: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
40
|
-
deleteDataFilterList(id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
30
|
+
deleteCurtainLink(curtainLinkID: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
31
|
+
putSettings(settings: any, enable?: boolean, description?: string, sessionType?: string, encryption?: CurtainEncryption, permanent?: boolean, expiry_duration?: number, onUploadProgress?: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
32
|
+
postSettings(id: string, token: string, onDownloadProgress?: any, url?: string | undefined): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
33
|
+
getPrideData(accession: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
34
|
+
generateTemporarySession(linkId: string, lifetime: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
35
|
+
updateSession(sessionData: any, linkId: string, encryption?: CurtainEncryption): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
36
|
+
getSessionSettings(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
37
|
+
getOwnership(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
38
|
+
getOwners(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
39
|
+
addOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
40
|
+
getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
41
|
+
getSiteProperties(): Promise<import("axios").AxiosResponse<SiteProperties, any, {}>>;
|
|
42
|
+
saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
43
|
+
getDataFilterListByID(id: number, limit?: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
44
|
+
getDataFilterList(title?: string, searchTerm?: string, category?: string, limit?: number, offset?: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
45
|
+
getDataFilterListByCategory(category: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
46
|
+
deleteDataFilterList(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
47
|
+
updateDataFilterList(id: number, name?: string, data?: string, category?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
48
|
+
downloadStats(): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
49
|
+
postInteractomeAtlasProxy(genes: string[], filterParameter: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
50
|
+
postPrimitiveStatsTest(data: any, type?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
51
|
+
getDataAllListCategory(): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
52
|
+
postCompareSession(idList: string[], matchType: string, studyList: string[], sessionId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
53
|
+
getStatsSummary(lastNDays: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
54
|
+
postEncryptionFactors(encryptedAESKey: string, encryptedIV: string, linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
55
|
+
getEncryptionFactors(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
56
|
+
createCurtainAPIKey(name: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
57
|
+
getCurtainAPIKeys(): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
58
|
+
deleteCurtainAPIKey(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
59
|
+
getRandomDataCiteSuffix(): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
60
|
+
submitDataCite(data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
61
|
+
getDataCite(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
62
|
+
getDataCites(url?: string, title?: string, status?: string, limit?: number, offset?: number, manage?: boolean, curtain_type?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
63
|
+
getDataCiteTimeLimitedPermissionToken(suffix: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
64
|
+
getDataCiteProxyOrcidPublicRecord(orcid: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
58
65
|
getDataCiteQuota(): Promise<import("axios").AxiosResponse<{
|
|
59
66
|
quota: number;
|
|
60
67
|
max_quota: number;
|
|
61
|
-
}, any>>;
|
|
62
|
-
updateDataCite(id: number, data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
63
|
-
deleteDataCite(id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
64
|
-
changeDataCiteStatus(id: number, status: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
65
|
-
lockDataCite(id: number, lock: boolean): Promise<import("axios").AxiosResponse<any, any>>;
|
|
68
|
+
}, any, {}>>;
|
|
69
|
+
updateDataCite(id: number, data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
70
|
+
deleteDataCite(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
71
|
+
changeDataCiteStatus(id: number, status: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
72
|
+
lockDataCite(id: number, lock: boolean): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
73
|
+
getKinaseLibraryProxy(sequence: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
74
|
+
getJobResult(job_id: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
75
|
+
getDataCiteFile(datacite_id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
66
76
|
}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -225,7 +235,7 @@ class CurtainWebAPI {
|
|
|
225
235
|
return __awaiter(this, arguments, void 0, function* (settings, enable = true, description = "", sessionType = "TP", encryption = {
|
|
226
236
|
encrypted: false,
|
|
227
237
|
e2e: false,
|
|
228
|
-
}, permanent = false, onUploadProgress = undefined) {
|
|
238
|
+
}, permanent = false, expiry_duration, onUploadProgress = undefined) {
|
|
229
239
|
let form = new FormData();
|
|
230
240
|
let data = JSON.stringify(settings, exports.replacer);
|
|
231
241
|
if (enable) {
|
|
@@ -252,6 +262,9 @@ class CurtainWebAPI {
|
|
|
252
262
|
else {
|
|
253
263
|
form.append("permanent", "False");
|
|
254
264
|
}
|
|
265
|
+
if (expiry_duration !== undefined) {
|
|
266
|
+
form.append("expiry_duration", expiry_duration.toString());
|
|
267
|
+
}
|
|
255
268
|
if (encryption.encrypted && encryption.e2e && encryption.publicKey !== undefined) {
|
|
256
269
|
const aesKey = yield (0, curtain_encryption_1.generateAESKey)();
|
|
257
270
|
console.log("Encrypting data");
|
|
@@ -367,6 +380,9 @@ class CurtainWebAPI {
|
|
|
367
380
|
form.append("enable", "False");
|
|
368
381
|
}
|
|
369
382
|
}
|
|
383
|
+
if ("expiry_duration" in sessionData) {
|
|
384
|
+
form.append("expiry_duration", sessionData["expiry_duration"].toString());
|
|
385
|
+
}
|
|
370
386
|
if (encryption.encrypted) {
|
|
371
387
|
form.append("encrypted", "True");
|
|
372
388
|
}
|
|
@@ -432,9 +448,7 @@ class CurtainWebAPI {
|
|
|
432
448
|
getSiteProperties() {
|
|
433
449
|
let headers = new axios_1.AxiosHeaders();
|
|
434
450
|
headers["Accept"] = "application/json";
|
|
435
|
-
return this.axiosInstance.get(this.baseURL + "site-properties/", { headers: headers, responseType: "json" })
|
|
436
|
-
return response;
|
|
437
|
-
});
|
|
451
|
+
return this.axiosInstance.get(this.baseURL + "site-properties/", { headers: headers, responseType: "json" });
|
|
438
452
|
}
|
|
439
453
|
saveDataFilterList(name, data, category = "") {
|
|
440
454
|
let headers = new axios_1.AxiosHeaders();
|
|
@@ -479,6 +493,21 @@ class CurtainWebAPI {
|
|
|
479
493
|
return response;
|
|
480
494
|
});
|
|
481
495
|
}
|
|
496
|
+
updateDataFilterList(id, name, data, category) {
|
|
497
|
+
let headers = new axios_1.AxiosHeaders();
|
|
498
|
+
headers["Accept"] = "application/json";
|
|
499
|
+
headers["Content-Type"] = "application/json";
|
|
500
|
+
const updateData = {};
|
|
501
|
+
if (name !== undefined)
|
|
502
|
+
updateData.name = name;
|
|
503
|
+
if (data !== undefined)
|
|
504
|
+
updateData.data = data;
|
|
505
|
+
if (category !== undefined)
|
|
506
|
+
updateData.category = category;
|
|
507
|
+
return this.axiosInstance.patch(this.baseURL + "data_filter_list/" + id + "/", updateData, { headers: headers, responseType: "json" }).then((response) => {
|
|
508
|
+
return response;
|
|
509
|
+
});
|
|
510
|
+
}
|
|
482
511
|
downloadStats() {
|
|
483
512
|
let headers = new axios_1.AxiosHeaders();
|
|
484
513
|
headers["Accept"] = "application/json";
|
|
@@ -639,5 +668,22 @@ class CurtainWebAPI {
|
|
|
639
668
|
headers["Content-Type"] = "application/json";
|
|
640
669
|
return this.axiosInstance.post(this.baseURL + "datacite/" + id + "/lock/", { lock: lock }, { headers: headers, responseType: "json" });
|
|
641
670
|
}
|
|
671
|
+
getKinaseLibraryProxy(sequence) {
|
|
672
|
+
let headers = new axios_1.AxiosHeaders();
|
|
673
|
+
headers["Accept"] = "application/json";
|
|
674
|
+
let params = new URLSearchParams();
|
|
675
|
+
params.append("sequence", sequence);
|
|
676
|
+
return this.axiosInstance.get(this.baseURL + "kinase_library_proxy/", { headers: headers, params: params, responseType: "json" });
|
|
677
|
+
}
|
|
678
|
+
getJobResult(job_id) {
|
|
679
|
+
let headers = new axios_1.AxiosHeaders();
|
|
680
|
+
headers["Accept"] = "application/json";
|
|
681
|
+
return this.axiosInstance.get(this.baseURL + "job/" + job_id + "/", { headers: headers, responseType: "json" });
|
|
682
|
+
}
|
|
683
|
+
getDataCiteFile(datacite_id) {
|
|
684
|
+
let headers = new axios_1.AxiosHeaders();
|
|
685
|
+
headers["Accept"] = "application/json";
|
|
686
|
+
return this.axiosInstance.get(this.baseURL + "datacite/file/" + datacite_id + "/", { headers: headers, responseType: "blob" });
|
|
687
|
+
}
|
|
642
688
|
}
|
|
643
689
|
exports.CurtainWebAPI = CurtainWebAPI;
|
|
@@ -16,8 +16,8 @@ export interface CurtainEncryption {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function arrayBufferToBase64String(arrayBuffer: ArrayBuffer): string;
|
|
18
18
|
export declare function removeLines(str_data: string): string;
|
|
19
|
-
export declare function base64ToArrayBuffer(b64: string):
|
|
20
|
-
export declare function pemToArrayBuffer(pem: string):
|
|
19
|
+
export declare function base64ToArrayBuffer(b64: string): ArrayBuffer;
|
|
20
|
+
export declare function pemToArrayBuffer(pem: string): ArrayBuffer;
|
|
21
21
|
export declare function encryptAESKey(publicKey: CryptoKey, aesKey: ArrayBuffer): Promise<ArrayBuffer>;
|
|
22
22
|
export declare function generateAESKey(): Promise<CryptoKey>;
|
|
23
23
|
export declare function encryptAESData(aesKey: CryptoKey, data: string): Promise<{
|
|
@@ -124,7 +124,7 @@ function base64ToArrayBuffer(b64) {
|
|
|
124
124
|
for (let i = 0; i < byteString.length; i++) {
|
|
125
125
|
byteArray[i] = byteString.charCodeAt(i);
|
|
126
126
|
}
|
|
127
|
-
return byteArray;
|
|
127
|
+
return byteArray.buffer;
|
|
128
128
|
}
|
|
129
129
|
function pemToArrayBuffer(pem) {
|
|
130
130
|
const b64Lines = removeLines(pem);
|
|
@@ -156,7 +156,7 @@ function encryptAESData(aesKey, data) {
|
|
|
156
156
|
const enc = new TextEncoder();
|
|
157
157
|
const encoded = enc.encode(data);
|
|
158
158
|
const encrypted = yield crypto.subtle.encrypt({ name: "AES-GCM", iv: iv }, aesKey, encoded);
|
|
159
|
-
return { encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv) };
|
|
159
|
+
return { encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv.buffer) };
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
// a function to decrypt a string with an aes key
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CurtainWebAPI, replacer, reviver } from "./classes/curtain-api";
|
|
1
|
+
import { CurtainWebAPI, replacer, reviver, SiteProperties } from "./classes/curtain-api";
|
|
2
2
|
import { User } from "./classes/curtain-user";
|
|
3
3
|
import { getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions } from "./utilities";
|
|
4
4
|
import { importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines } from "./classes/curtain-encryption";
|
|
5
5
|
import PouchDB from "pouchdb";
|
|
6
|
-
export { CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions, replacer, reviver, importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines, PouchDB };
|
|
6
|
+
export { CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions, replacer, reviver, SiteProperties, importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines, PouchDB };
|
package/build/utilities.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function getProteomicsData(acc: string, tissueType: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
2
|
-
export declare function getPrideData(acc: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
3
|
-
export declare function getEBIAlpha(id: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
-
export declare function getStringDBInteractions(genes: string[], organism: string, score?: number, networkType?: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
1
|
+
export declare function getProteomicsData(acc: string, tissueType: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
2
|
+
export declare function getPrideData(acc: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
3
|
+
export declare function getEBIAlpha(id: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
|
+
export declare function getStringDBInteractions(genes: string[], organism: string, score?: number, networkType?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
5
5
|
export declare function getInteractomeAtlas(genes: string[], filterParameter?: string): Promise<any>;
|
package/build/utilities.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.getProteomicsData = getProteomicsData;
|
|
27
37
|
exports.getPrideData = getPrideData;
|
package/package.json
CHANGED
|
@@ -30,6 +30,13 @@ export const reviver = (key: any, value: any) => {
|
|
|
30
30
|
return value;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export interface SiteProperties {
|
|
34
|
+
non_user_post: boolean;
|
|
35
|
+
allow_user_set_permanent: boolean;
|
|
36
|
+
expiry_duration_options: number[];
|
|
37
|
+
default_expiry_duration_months: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
export class CurtainWebAPI {
|
|
34
41
|
loginURL: string = "";
|
|
35
42
|
logoutURL: string = "";
|
|
@@ -211,7 +218,7 @@ export class CurtainWebAPI {
|
|
|
211
218
|
async putSettings(settings: any, enable: boolean = true, description: string = "", sessionType: string = "TP", encryption: CurtainEncryption = {
|
|
212
219
|
encrypted: false,
|
|
213
220
|
e2e: false,
|
|
214
|
-
}, permanent: boolean = false, onUploadProgress: any = undefined) {
|
|
221
|
+
}, permanent: boolean = false, expiry_duration?: number, onUploadProgress: any = undefined) {
|
|
215
222
|
let form: FormData = new FormData();
|
|
216
223
|
let data = JSON.stringify(settings, replacer)
|
|
217
224
|
if (enable) {
|
|
@@ -234,6 +241,9 @@ export class CurtainWebAPI {
|
|
|
234
241
|
} else {
|
|
235
242
|
form.append("permanent", "False")
|
|
236
243
|
}
|
|
244
|
+
if (expiry_duration !== undefined) {
|
|
245
|
+
form.append("expiry_duration", expiry_duration.toString())
|
|
246
|
+
}
|
|
237
247
|
if (encryption.encrypted && encryption.e2e && encryption.publicKey !== undefined) {
|
|
238
248
|
const aesKey = await generateAESKey()
|
|
239
249
|
console.log("Encrypting data")
|
|
@@ -350,6 +360,10 @@ export class CurtainWebAPI {
|
|
|
350
360
|
}
|
|
351
361
|
}
|
|
352
362
|
|
|
363
|
+
if ("expiry_duration" in sessionData) {
|
|
364
|
+
form.append("expiry_duration", sessionData["expiry_duration"].toString())
|
|
365
|
+
}
|
|
366
|
+
|
|
353
367
|
if (encryption.encrypted) {
|
|
354
368
|
form.append("encrypted", "True")
|
|
355
369
|
} else {
|
|
@@ -422,9 +436,7 @@ export class CurtainWebAPI {
|
|
|
422
436
|
getSiteProperties() {
|
|
423
437
|
let headers = new AxiosHeaders();
|
|
424
438
|
headers["Accept"] = "application/json";
|
|
425
|
-
return this.axiosInstance.get(this.baseURL + "site-properties/", {headers: headers, responseType:"json"})
|
|
426
|
-
return response;
|
|
427
|
-
});
|
|
439
|
+
return this.axiosInstance.get<SiteProperties>(this.baseURL + "site-properties/", {headers: headers, responseType:"json"});
|
|
428
440
|
}
|
|
429
441
|
|
|
430
442
|
saveDataFilterList(name: string, data: string, category: string = "") {
|
|
@@ -482,6 +494,19 @@ export class CurtainWebAPI {
|
|
|
482
494
|
});
|
|
483
495
|
}
|
|
484
496
|
|
|
497
|
+
updateDataFilterList(id: number, name?: string, data?: string, category?: string) {
|
|
498
|
+
let headers = new AxiosHeaders();
|
|
499
|
+
headers["Accept"] = "application/json";
|
|
500
|
+
headers["Content-Type"] = "application/json";
|
|
501
|
+
const updateData: {name?: string, data?: string, category?: string} = {};
|
|
502
|
+
if (name !== undefined) updateData.name = name;
|
|
503
|
+
if (data !== undefined) updateData.data = data;
|
|
504
|
+
if (category !== undefined) updateData.category = category;
|
|
505
|
+
return this.axiosInstance.patch(this.baseURL + "data_filter_list/" + id + "/", updateData, {headers: headers, responseType:"json"}).then((response) => {
|
|
506
|
+
return response;
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
|
|
485
510
|
downloadStats() {
|
|
486
511
|
let headers = new AxiosHeaders();
|
|
487
512
|
headers["Accept"] = "application/json";
|
|
@@ -661,5 +686,25 @@ export class CurtainWebAPI {
|
|
|
661
686
|
headers["Content-Type"] = "application/json"
|
|
662
687
|
return this.axiosInstance.post(this.baseURL + "datacite/" + id + "/lock/", {lock: lock}, {headers: headers, responseType: "json"})
|
|
663
688
|
}
|
|
689
|
+
|
|
690
|
+
getKinaseLibraryProxy(sequence: string) {
|
|
691
|
+
let headers = new AxiosHeaders();
|
|
692
|
+
headers["Accept"] = "application/json";
|
|
693
|
+
let params = new URLSearchParams();
|
|
694
|
+
params.append("sequence", sequence);
|
|
695
|
+
return this.axiosInstance.get(this.baseURL + "kinase_library_proxy/", {headers: headers, params: params, responseType: "json"});
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
getJobResult(job_id: string) {
|
|
699
|
+
let headers = new AxiosHeaders();
|
|
700
|
+
headers["Accept"] = "application/json";
|
|
701
|
+
return this.axiosInstance.get(this.baseURL + "job/" + job_id + "/", {headers: headers, responseType: "json"});
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
getDataCiteFile(datacite_id: number) {
|
|
705
|
+
let headers = new AxiosHeaders();
|
|
706
|
+
headers["Accept"] = "application/json";
|
|
707
|
+
return this.axiosInstance.get(this.baseURL + "datacite/file/" + datacite_id + "/", {headers: headers, responseType: "blob"});
|
|
708
|
+
}
|
|
664
709
|
}
|
|
665
710
|
|
|
@@ -21,7 +21,7 @@ export async function generateKeyPair(modulusLength: number = 2048, publicExpone
|
|
|
21
21
|
modulusLength: modulusLength,
|
|
22
22
|
publicExponent: publicExponent,
|
|
23
23
|
hash: "SHA-256",
|
|
24
|
-
},
|
|
24
|
+
} as RsaHashedKeyGenParams,
|
|
25
25
|
true,
|
|
26
26
|
["encrypt", "decrypt"],
|
|
27
27
|
)
|
|
@@ -85,14 +85,14 @@ export function removeLines(str_data: string) {
|
|
|
85
85
|
return str_data.replace("\n", "");
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
export function base64ToArrayBuffer(b64: string) {
|
|
88
|
+
export function base64ToArrayBuffer(b64: string): ArrayBuffer {
|
|
89
89
|
const byteString = atob(b64);
|
|
90
90
|
const byteArray = new Uint8Array(byteString.length);
|
|
91
91
|
for(let i=0; i < byteString.length; i++) {
|
|
92
92
|
byteArray[i] = byteString.charCodeAt(i);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
return byteArray;
|
|
95
|
+
return byteArray.buffer;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export function pemToArrayBuffer(pem: string) {
|
|
@@ -128,7 +128,7 @@ export async function encryptAESData(aesKey: CryptoKey, data: string) {
|
|
|
128
128
|
const enc = new TextEncoder()
|
|
129
129
|
const encoded = enc.encode(data)
|
|
130
130
|
const encrypted = await crypto.subtle.encrypt({name: "AES-GCM", iv: iv}, aesKey, encoded)
|
|
131
|
-
return {encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv)}
|
|
131
|
+
return {encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv.buffer)}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
// a function to decrypt a string with an aes key
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {CurtainWebAPI, replacer, reviver} from "./classes/curtain-api";
|
|
1
|
+
import {CurtainWebAPI, replacer, reviver, SiteProperties} from "./classes/curtain-api";
|
|
2
2
|
import {User} from "./classes/curtain-user";
|
|
3
3
|
import {getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions} from "./utilities";
|
|
4
4
|
import {importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines} from "./classes/curtain-encryption";
|
|
@@ -13,6 +13,7 @@ export {
|
|
|
13
13
|
getStringDBInteractions,
|
|
14
14
|
replacer,
|
|
15
15
|
reviver,
|
|
16
|
+
SiteProperties,
|
|
16
17
|
importKey,
|
|
17
18
|
importPrivateKey,
|
|
18
19
|
exportPrivateKey,
|