curtain-web-api 1.0.67 → 1.0.69

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.
@@ -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;
@@ -101,11 +105,11 @@ export declare class CurtainWebAPI {
101
105
  axiosInstance: import("axios").AxiosInstance;
102
106
  baseURL: string;
103
107
  constructor(baseURL?: string);
104
- login(username: string, password: string): Promise<User>;
108
+ login(username: string, password: string, remember_me?: boolean): Promise<User>;
105
109
  getUserInfo(): Promise<User>;
106
110
  logout(): Promise<void>;
107
111
  refresh(): Promise<import("axios").AxiosResponse<any, any, {}>>;
108
- ORCIDLogin(authorizationCode: string, redirectURI: string): Promise<User>;
112
+ ORCIDLogin(authorizationCode: string, redirectURI: string, remember_me?: boolean): Promise<User>;
109
113
  checkIfRefreshTokenExpired(): boolean;
110
114
  deleteCurtainLink(curtainLinkID: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
111
115
  putSettings(settings: any, enable?: boolean, description?: string, sessionType?: string, encryption?: CurtainEncryption, permanent?: boolean, expiry_duration?: number, onUploadProgress?: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
@@ -179,8 +183,10 @@ export declare class CurtainWebAPI {
179
183
  getPermanentLinkRequest(id: number): Promise<import("axios").AxiosResponse<PermanentLinkRequest, any, {}>>;
180
184
  approvePermanentLinkRequest(id: number): Promise<import("axios").AxiosResponse<{
181
185
  message: string;
186
+ request: PermanentLinkRequest;
182
187
  }, any, {}>>;
183
188
  rejectPermanentLinkRequest(id: number, admin_notes?: string): Promise<import("axios").AxiosResponse<{
184
189
  message: string;
190
+ request: PermanentLinkRequest;
185
191
  }, any, {}>>;
186
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/") || config.url.startsWith(this.dataciteURL)) {
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();
@@ -156,13 +160,13 @@ export class CurtainWebAPI {
156
160
  return response;
157
161
  });
158
162
  }
159
- ORCIDLogin(authorizationCode, redirectURI) {
163
+ ORCIDLogin(authorizationCode, redirectURI, remember_me = false) {
160
164
  let headers = new AxiosHeaders();
161
165
  headers["Accept"] = "application/json";
162
166
  headers["Content-Type"] = "application/json";
163
167
  return this.user.loadFromDB().then((response) => {
164
168
  console.log(this.user);
165
- return this.axiosInstance.post(this.orcidLoginURL, JSON.stringify({ "auth_token": authorizationCode, "redirect_uri": redirectURI }), { headers: headers, responseType: "json" }).then((response) => {
169
+ return this.axiosInstance.post(this.orcidLoginURL, JSON.stringify({ "auth_token": authorizationCode, "redirect_uri": redirectURI, "remember_me": remember_me }), { headers: headers, responseType: "json" }).then((response) => {
166
170
  return this.user.saveIntoDB(response.data.access, response.data.refresh).then((response) => {
167
171
  console.log(this.user);
168
172
  return this.getUserInfo();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.67",
3
+ "version": "1.0.69",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -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 {
@@ -176,7 +180,11 @@ export class CurtainWebAPI {
176
180
  config.url === this.userInfoURL ||
177
181
  config.url.startsWith(this.curtainURL) ||
178
182
  config.url.startsWith(this.baseURL + "data_filter_list/") ||
179
- config.url.startsWith(this.baseURL + "api_key/")|| config.url.startsWith(this.dataciteURL)) {
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/")) {
180
188
  if (this.user.loginStatus) {
181
189
  config.headers["Authorization"] = "Bearer " + this.user.access_token;
182
190
  }
@@ -213,12 +221,12 @@ export class CurtainWebAPI {
213
221
  });
214
222
  }
215
223
 
216
- login(username: string, password: string) {
224
+ login(username: string, password: string, remember_me: boolean = false) {
217
225
  let headers = new AxiosHeaders();
218
226
  headers["Accept"] = "application/json";
219
227
  headers["Content-Type"] = "application/json";
220
228
  headers["withCredentials"] = "true";
221
- 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) => {
222
230
  this.user.loginStatus = true;
223
231
  return this.user.saveIntoDB(response.data.access, response.data.refresh).then((response) => {
224
232
  return this.getUserInfo()
@@ -269,14 +277,14 @@ export class CurtainWebAPI {
269
277
  });
270
278
  }
271
279
 
272
- ORCIDLogin(authorizationCode: string, redirectURI: string){
280
+ ORCIDLogin(authorizationCode: string, redirectURI: string, remember_me: boolean = false){
273
281
  let headers = new AxiosHeaders();
274
282
  headers["Accept"] = "application/json";
275
283
  headers["Content-Type"] = "application/json";
276
284
  return this.user.loadFromDB().then(
277
285
  (response) => {
278
286
  console.log(this.user)
279
- return this.axiosInstance.post(this.orcidLoginURL, JSON.stringify({"auth_token": authorizationCode, "redirect_uri": redirectURI}), {headers: headers, responseType:"json"}).then((response) => {
287
+ return this.axiosInstance.post(this.orcidLoginURL, JSON.stringify({"auth_token": authorizationCode, "redirect_uri": redirectURI, "remember_me": remember_me}), {headers: headers, responseType:"json"}).then((response) => {
280
288
  return this.user.saveIntoDB(response.data.access, response.data.refresh).then((response) => {
281
289
  console.log(this.user)
282
290
  return this.getUserInfo()
@@ -1037,7 +1045,7 @@ export class CurtainWebAPI {
1037
1045
  let headers = new AxiosHeaders();
1038
1046
  headers["Accept"] = "application/json";
1039
1047
  headers["Content-Type"] = "application/json";
1040
- return this.axiosInstance.post<{message: string}>(this.baseURL + "permanent-link-requests/" + id + "/approve/", {}, {headers: headers, responseType: "json"});
1048
+ return this.axiosInstance.post<{message: string, request: PermanentLinkRequest}>(this.baseURL + "permanent-link-requests/" + id + "/approve/", {}, {headers: headers, responseType: "json"});
1041
1049
  }
1042
1050
 
1043
1051
  rejectPermanentLinkRequest(id: number, admin_notes?: string) {
@@ -1045,7 +1053,7 @@ export class CurtainWebAPI {
1045
1053
  headers["Accept"] = "application/json";
1046
1054
  headers["Content-Type"] = "application/json";
1047
1055
  const data = admin_notes ? {admin_notes} : {};
1048
- return this.axiosInstance.post<{message: string}>(this.baseURL + "permanent-link-requests/" + id + "/reject/", data, {headers: headers, responseType: "json"});
1056
+ return this.axiosInstance.post<{message: string, request: PermanentLinkRequest}>(this.baseURL + "permanent-link-requests/" + id + "/reject/", data, {headers: headers, responseType: "json"});
1049
1057
  }
1050
1058
  }
1051
1059