curtain-web-api 1.0.66 → 1.0.68
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 +41 -1
- package/build/classes/curtain-api.js +45 -3
- package/build/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/classes/curtain-api.ts +78 -3
- package/src/index.ts +5 -1
|
@@ -7,6 +7,10 @@ export interface SiteProperties {
|
|
|
7
7
|
allow_user_set_permanent: boolean;
|
|
8
8
|
expiry_duration_options: number[];
|
|
9
9
|
default_expiry_duration_months: number;
|
|
10
|
+
jwt_access_token_lifetime_minutes: number;
|
|
11
|
+
jwt_refresh_token_lifetime_days: number;
|
|
12
|
+
jwt_remember_me_access_token_lifetime_days: number;
|
|
13
|
+
jwt_remember_me_refresh_token_lifetime_days: number;
|
|
10
14
|
}
|
|
11
15
|
export interface CurtainChunkedUploadStatus {
|
|
12
16
|
id: string;
|
|
@@ -66,6 +70,28 @@ export interface Announcement {
|
|
|
66
70
|
dismissible: boolean;
|
|
67
71
|
is_visible: boolean;
|
|
68
72
|
}
|
|
73
|
+
export interface PermanentLinkRequest {
|
|
74
|
+
id: number;
|
|
75
|
+
curtain: number;
|
|
76
|
+
curtain_link_id: string;
|
|
77
|
+
requested_by: number;
|
|
78
|
+
requested_by_username: string;
|
|
79
|
+
request_type: 'permanent' | 'extend';
|
|
80
|
+
requested_expiry_months?: number;
|
|
81
|
+
status: 'pending' | 'approved' | 'rejected';
|
|
82
|
+
reason?: string;
|
|
83
|
+
requested_at: string;
|
|
84
|
+
reviewed_at?: string;
|
|
85
|
+
reviewed_by?: number;
|
|
86
|
+
reviewed_by_username?: string;
|
|
87
|
+
admin_notes?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface CreatePermanentLinkRequest {
|
|
90
|
+
curtain: number;
|
|
91
|
+
request_type: 'permanent' | 'extend';
|
|
92
|
+
requested_expiry_months?: number;
|
|
93
|
+
reason?: string;
|
|
94
|
+
}
|
|
69
95
|
export declare class CurtainWebAPI {
|
|
70
96
|
loginURL: string;
|
|
71
97
|
logoutURL: string;
|
|
@@ -79,7 +105,7 @@ export declare class CurtainWebAPI {
|
|
|
79
105
|
axiosInstance: import("axios").AxiosInstance;
|
|
80
106
|
baseURL: string;
|
|
81
107
|
constructor(baseURL?: string);
|
|
82
|
-
login(username: string, password: string): Promise<User>;
|
|
108
|
+
login(username: string, password: string, remember_me?: boolean): Promise<User>;
|
|
83
109
|
getUserInfo(): Promise<User>;
|
|
84
110
|
logout(): Promise<void>;
|
|
85
111
|
refresh(): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
@@ -149,4 +175,18 @@ export declare class CurtainWebAPI {
|
|
|
149
175
|
count: number;
|
|
150
176
|
results: Announcement[];
|
|
151
177
|
}, any, {}>>;
|
|
178
|
+
createPermanentLinkRequest(request: CreatePermanentLinkRequest): Promise<import("axios").AxiosResponse<PermanentLinkRequest, any, {}>>;
|
|
179
|
+
getPermanentLinkRequests(limit?: number, offset?: number, status?: string, curtain?: number): Promise<import("axios").AxiosResponse<{
|
|
180
|
+
count: number;
|
|
181
|
+
results: PermanentLinkRequest[];
|
|
182
|
+
}, any, {}>>;
|
|
183
|
+
getPermanentLinkRequest(id: number): Promise<import("axios").AxiosResponse<PermanentLinkRequest, any, {}>>;
|
|
184
|
+
approvePermanentLinkRequest(id: number): Promise<import("axios").AxiosResponse<{
|
|
185
|
+
message: string;
|
|
186
|
+
request: PermanentLinkRequest;
|
|
187
|
+
}, any, {}>>;
|
|
188
|
+
rejectPermanentLinkRequest(id: number, admin_notes?: string): Promise<import("axios").AxiosResponse<{
|
|
189
|
+
message: string;
|
|
190
|
+
request: PermanentLinkRequest;
|
|
191
|
+
}, any, {}>>;
|
|
152
192
|
}
|
|
@@ -71,7 +71,11 @@ export class CurtainWebAPI {
|
|
|
71
71
|
config.url === this.userInfoURL ||
|
|
72
72
|
config.url.startsWith(this.curtainURL) ||
|
|
73
73
|
config.url.startsWith(this.baseURL + "data_filter_list/") ||
|
|
74
|
-
config.url.startsWith(this.baseURL + "api_key/") ||
|
|
74
|
+
config.url.startsWith(this.baseURL + "api_key/") ||
|
|
75
|
+
config.url.startsWith(this.baseURL + "permanent-link-requests/") ||
|
|
76
|
+
config.url.startsWith(this.baseURL + "curtain-chunked-upload/") ||
|
|
77
|
+
config.url.startsWith(this.baseURL + "stats/summary/") ||
|
|
78
|
+
config.url.startsWith(this.baseURL + "job/")) {
|
|
75
79
|
if (this.user.loginStatus) {
|
|
76
80
|
config.headers["Authorization"] = "Bearer " + this.user.access_token;
|
|
77
81
|
}
|
|
@@ -106,12 +110,12 @@ export class CurtainWebAPI {
|
|
|
106
110
|
return Promise.reject(error);
|
|
107
111
|
});
|
|
108
112
|
}
|
|
109
|
-
login(username, password) {
|
|
113
|
+
login(username, password, remember_me = false) {
|
|
110
114
|
let headers = new AxiosHeaders();
|
|
111
115
|
headers["Accept"] = "application/json";
|
|
112
116
|
headers["Content-Type"] = "application/json";
|
|
113
117
|
headers["withCredentials"] = "true";
|
|
114
|
-
return this.axiosInstance.post(this.loginURL, { username, password }, { headers: headers, responseType: "json" }).then((response) => {
|
|
118
|
+
return this.axiosInstance.post(this.loginURL, { username, password, remember_me }, { headers: headers, responseType: "json" }).then((response) => {
|
|
115
119
|
this.user.loginStatus = true;
|
|
116
120
|
return this.user.saveIntoDB(response.data.access, response.data.refresh).then((response) => {
|
|
117
121
|
return this.getUserInfo();
|
|
@@ -806,4 +810,42 @@ export class CurtainWebAPI {
|
|
|
806
810
|
params.append("offset", offset.toString());
|
|
807
811
|
return this.axiosInstance.get(this.baseURL + "announcements/", { headers: headers, params: params, responseType: "json" });
|
|
808
812
|
}
|
|
813
|
+
createPermanentLinkRequest(request) {
|
|
814
|
+
let headers = new AxiosHeaders();
|
|
815
|
+
headers["Accept"] = "application/json";
|
|
816
|
+
headers["Content-Type"] = "application/json";
|
|
817
|
+
return this.axiosInstance.post(this.baseURL + "permanent-link-requests/", request, { headers: headers, responseType: "json" });
|
|
818
|
+
}
|
|
819
|
+
getPermanentLinkRequests(limit = 10, offset = 0, status, curtain) {
|
|
820
|
+
let headers = new AxiosHeaders();
|
|
821
|
+
headers["Accept"] = "application/json";
|
|
822
|
+
let params = new URLSearchParams();
|
|
823
|
+
params.append("limit", limit.toString());
|
|
824
|
+
params.append("offset", offset.toString());
|
|
825
|
+
if (status) {
|
|
826
|
+
params.append("status", status);
|
|
827
|
+
}
|
|
828
|
+
if (curtain) {
|
|
829
|
+
params.append("curtain", curtain.toString());
|
|
830
|
+
}
|
|
831
|
+
return this.axiosInstance.get(this.baseURL + "permanent-link-requests/", { headers: headers, params: params, responseType: "json" });
|
|
832
|
+
}
|
|
833
|
+
getPermanentLinkRequest(id) {
|
|
834
|
+
let headers = new AxiosHeaders();
|
|
835
|
+
headers["Accept"] = "application/json";
|
|
836
|
+
return this.axiosInstance.get(this.baseURL + "permanent-link-requests/" + id + "/", { headers: headers, responseType: "json" });
|
|
837
|
+
}
|
|
838
|
+
approvePermanentLinkRequest(id) {
|
|
839
|
+
let headers = new AxiosHeaders();
|
|
840
|
+
headers["Accept"] = "application/json";
|
|
841
|
+
headers["Content-Type"] = "application/json";
|
|
842
|
+
return this.axiosInstance.post(this.baseURL + "permanent-link-requests/" + id + "/approve/", {}, { headers: headers, responseType: "json" });
|
|
843
|
+
}
|
|
844
|
+
rejectPermanentLinkRequest(id, admin_notes) {
|
|
845
|
+
let headers = new AxiosHeaders();
|
|
846
|
+
headers["Accept"] = "application/json";
|
|
847
|
+
headers["Content-Type"] = "application/json";
|
|
848
|
+
const data = admin_notes ? { admin_notes } : {};
|
|
849
|
+
return this.axiosInstance.post(this.baseURL + "permanent-link-requests/" + id + "/reject/", data, { headers: headers, responseType: "json" });
|
|
850
|
+
}
|
|
809
851
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CurtainWebAPI, replacer, reviver, SiteProperties, CurtainChunkedUploadStatus, CurtainChunkedUploadRequest, CurtainChunkedUploadResponse, CurtainChunkedUploadCompletionRequest, CurtainChunkedUploadCompletionResponse, Announcement } from "./classes/curtain-api";
|
|
1
|
+
import { CurtainWebAPI, replacer, reviver, SiteProperties, CurtainChunkedUploadStatus, CurtainChunkedUploadRequest, CurtainChunkedUploadResponse, CurtainChunkedUploadCompletionRequest, CurtainChunkedUploadCompletionResponse, Announcement, PermanentLinkRequest, CreatePermanentLinkRequest } 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, encryptAESData, decryptAESData, encryptAESKey, decryptAESKey, generateAESKey, exportAESKey, importAESKey } from "./classes/curtain-encryption";
|
|
5
5
|
import PouchDB from "pouchdb";
|
|
6
|
-
export { CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions, replacer, reviver, SiteProperties, CurtainChunkedUploadStatus, CurtainChunkedUploadRequest, CurtainChunkedUploadResponse, CurtainChunkedUploadCompletionRequest, CurtainChunkedUploadCompletionResponse, Announcement, importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines, encryptAESData, decryptAESData, encryptAESKey, decryptAESKey, generateAESKey, exportAESKey, importAESKey, PouchDB };
|
|
6
|
+
export { CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions, replacer, reviver, SiteProperties, CurtainChunkedUploadStatus, CurtainChunkedUploadRequest, CurtainChunkedUploadResponse, CurtainChunkedUploadCompletionRequest, CurtainChunkedUploadCompletionResponse, Announcement, PermanentLinkRequest, CreatePermanentLinkRequest, importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines, encryptAESData, decryptAESData, encryptAESKey, decryptAESKey, generateAESKey, exportAESKey, importAESKey, PouchDB };
|
package/package.json
CHANGED
|
@@ -35,6 +35,10 @@ export interface SiteProperties {
|
|
|
35
35
|
allow_user_set_permanent: boolean;
|
|
36
36
|
expiry_duration_options: number[];
|
|
37
37
|
default_expiry_duration_months: number;
|
|
38
|
+
jwt_access_token_lifetime_minutes: number;
|
|
39
|
+
jwt_refresh_token_lifetime_days: number;
|
|
40
|
+
jwt_remember_me_access_token_lifetime_days: number;
|
|
41
|
+
jwt_remember_me_refresh_token_lifetime_days: number;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
export interface CurtainChunkedUploadStatus {
|
|
@@ -101,6 +105,30 @@ export interface Announcement {
|
|
|
101
105
|
is_visible: boolean;
|
|
102
106
|
}
|
|
103
107
|
|
|
108
|
+
export interface PermanentLinkRequest {
|
|
109
|
+
id: number;
|
|
110
|
+
curtain: number;
|
|
111
|
+
curtain_link_id: string;
|
|
112
|
+
requested_by: number;
|
|
113
|
+
requested_by_username: string;
|
|
114
|
+
request_type: 'permanent' | 'extend';
|
|
115
|
+
requested_expiry_months?: number;
|
|
116
|
+
status: 'pending' | 'approved' | 'rejected';
|
|
117
|
+
reason?: string;
|
|
118
|
+
requested_at: string;
|
|
119
|
+
reviewed_at?: string;
|
|
120
|
+
reviewed_by?: number;
|
|
121
|
+
reviewed_by_username?: string;
|
|
122
|
+
admin_notes?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface CreatePermanentLinkRequest {
|
|
126
|
+
curtain: number;
|
|
127
|
+
request_type: 'permanent' | 'extend';
|
|
128
|
+
requested_expiry_months?: number;
|
|
129
|
+
reason?: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
104
132
|
export class CurtainWebAPI {
|
|
105
133
|
loginURL: string = "";
|
|
106
134
|
logoutURL: string = "";
|
|
@@ -152,7 +180,11 @@ export class CurtainWebAPI {
|
|
|
152
180
|
config.url === this.userInfoURL ||
|
|
153
181
|
config.url.startsWith(this.curtainURL) ||
|
|
154
182
|
config.url.startsWith(this.baseURL + "data_filter_list/") ||
|
|
155
|
-
config.url.startsWith(this.baseURL + "api_key/")||
|
|
183
|
+
config.url.startsWith(this.baseURL + "api_key/") ||
|
|
184
|
+
config.url.startsWith(this.baseURL + "permanent-link-requests/") ||
|
|
185
|
+
config.url.startsWith(this.baseURL + "curtain-chunked-upload/") ||
|
|
186
|
+
config.url.startsWith(this.baseURL + "stats/summary/") ||
|
|
187
|
+
config.url.startsWith(this.baseURL + "job/")) {
|
|
156
188
|
if (this.user.loginStatus) {
|
|
157
189
|
config.headers["Authorization"] = "Bearer " + this.user.access_token;
|
|
158
190
|
}
|
|
@@ -189,12 +221,12 @@ export class CurtainWebAPI {
|
|
|
189
221
|
});
|
|
190
222
|
}
|
|
191
223
|
|
|
192
|
-
login(username: string, password: string) {
|
|
224
|
+
login(username: string, password: string, remember_me: boolean = false) {
|
|
193
225
|
let headers = new AxiosHeaders();
|
|
194
226
|
headers["Accept"] = "application/json";
|
|
195
227
|
headers["Content-Type"] = "application/json";
|
|
196
228
|
headers["withCredentials"] = "true";
|
|
197
|
-
return this.axiosInstance.post(this.loginURL, {username, password}, {headers: headers, responseType:"json"}).then((response) => {
|
|
229
|
+
return this.axiosInstance.post(this.loginURL, {username, password, remember_me}, {headers: headers, responseType:"json"}).then((response) => {
|
|
198
230
|
this.user.loginStatus = true;
|
|
199
231
|
return this.user.saveIntoDB(response.data.access, response.data.refresh).then((response) => {
|
|
200
232
|
return this.getUserInfo()
|
|
@@ -980,5 +1012,48 @@ export class CurtainWebAPI {
|
|
|
980
1012
|
params.append("offset", offset.toString());
|
|
981
1013
|
return this.axiosInstance.get<{count: number, results: Announcement[]}>(this.baseURL + "announcements/", {headers: headers, params: params, responseType: "json"});
|
|
982
1014
|
}
|
|
1015
|
+
|
|
1016
|
+
createPermanentLinkRequest(request: CreatePermanentLinkRequest) {
|
|
1017
|
+
let headers = new AxiosHeaders();
|
|
1018
|
+
headers["Accept"] = "application/json";
|
|
1019
|
+
headers["Content-Type"] = "application/json";
|
|
1020
|
+
return this.axiosInstance.post<PermanentLinkRequest>(this.baseURL + "permanent-link-requests/", request, {headers: headers, responseType: "json"});
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
getPermanentLinkRequests(limit: number = 10, offset: number = 0, status?: string, curtain?: number) {
|
|
1024
|
+
let headers = new AxiosHeaders();
|
|
1025
|
+
headers["Accept"] = "application/json";
|
|
1026
|
+
let params = new URLSearchParams();
|
|
1027
|
+
params.append("limit", limit.toString());
|
|
1028
|
+
params.append("offset", offset.toString());
|
|
1029
|
+
if (status) {
|
|
1030
|
+
params.append("status", status);
|
|
1031
|
+
}
|
|
1032
|
+
if (curtain) {
|
|
1033
|
+
params.append("curtain", curtain.toString());
|
|
1034
|
+
}
|
|
1035
|
+
return this.axiosInstance.get<{count: number, results: PermanentLinkRequest[]}>(this.baseURL + "permanent-link-requests/", {headers: headers, params: params, responseType: "json"});
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
getPermanentLinkRequest(id: number) {
|
|
1039
|
+
let headers = new AxiosHeaders();
|
|
1040
|
+
headers["Accept"] = "application/json";
|
|
1041
|
+
return this.axiosInstance.get<PermanentLinkRequest>(this.baseURL + "permanent-link-requests/" + id + "/", {headers: headers, responseType: "json"});
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
approvePermanentLinkRequest(id: number) {
|
|
1045
|
+
let headers = new AxiosHeaders();
|
|
1046
|
+
headers["Accept"] = "application/json";
|
|
1047
|
+
headers["Content-Type"] = "application/json";
|
|
1048
|
+
return this.axiosInstance.post<{message: string, request: PermanentLinkRequest}>(this.baseURL + "permanent-link-requests/" + id + "/approve/", {}, {headers: headers, responseType: "json"});
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
rejectPermanentLinkRequest(id: number, admin_notes?: string) {
|
|
1052
|
+
let headers = new AxiosHeaders();
|
|
1053
|
+
headers["Accept"] = "application/json";
|
|
1054
|
+
headers["Content-Type"] = "application/json";
|
|
1055
|
+
const data = admin_notes ? {admin_notes} : {};
|
|
1056
|
+
return this.axiosInstance.post<{message: string, request: PermanentLinkRequest}>(this.baseURL + "permanent-link-requests/" + id + "/reject/", data, {headers: headers, responseType: "json"});
|
|
1057
|
+
}
|
|
983
1058
|
}
|
|
984
1059
|
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
CurtainChunkedUploadResponse,
|
|
9
9
|
CurtainChunkedUploadCompletionRequest,
|
|
10
10
|
CurtainChunkedUploadCompletionResponse,
|
|
11
|
-
Announcement
|
|
11
|
+
Announcement,
|
|
12
|
+
PermanentLinkRequest,
|
|
13
|
+
CreatePermanentLinkRequest
|
|
12
14
|
} from "./classes/curtain-api";
|
|
13
15
|
import {User} from "./classes/curtain-user";
|
|
14
16
|
import {getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions} from "./utilities";
|
|
@@ -55,6 +57,8 @@ export {
|
|
|
55
57
|
CurtainChunkedUploadCompletionRequest,
|
|
56
58
|
CurtainChunkedUploadCompletionResponse,
|
|
57
59
|
Announcement,
|
|
60
|
+
PermanentLinkRequest,
|
|
61
|
+
CreatePermanentLinkRequest,
|
|
58
62
|
importKey,
|
|
59
63
|
importPrivateKey,
|
|
60
64
|
exportPrivateKey,
|