curtain-web-api 1.0.62 → 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.
@@ -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;
@@ -22,7 +28,7 @@ export declare class CurtainWebAPI {
22
28
  ORCIDLogin(authorizationCode: string, redirectURI: string): Promise<User>;
23
29
  checkIfRefreshTokenExpired(): boolean;
24
30
  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, {}>>;
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, {}>>;
26
32
  postSettings(id: string, token: string, onDownloadProgress?: any, url?: string | undefined): Promise<import("axios").AxiosResponse<any, any, {}>>;
27
33
  getPrideData(accession: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
28
34
  generateTemporarySession(linkId: string, lifetime: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
@@ -32,7 +38,7 @@ export declare class CurtainWebAPI {
32
38
  getOwners(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
33
39
  addOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
34
40
  getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
35
- getSiteProperties(): Promise<import("axios").AxiosResponse<any, any, {}>>;
41
+ getSiteProperties(): Promise<import("axios").AxiosResponse<SiteProperties, any, {}>>;
36
42
  saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
37
43
  getDataFilterListByID(id: number, limit?: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
38
44
  getDataFilterList(title?: string, searchTerm?: string, category?: string, limit?: number, offset?: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
@@ -235,7 +235,7 @@ class CurtainWebAPI {
235
235
  return __awaiter(this, arguments, void 0, function* (settings, enable = true, description = "", sessionType = "TP", encryption = {
236
236
  encrypted: false,
237
237
  e2e: false,
238
- }, permanent = false, onUploadProgress = undefined) {
238
+ }, permanent = false, expiry_duration, onUploadProgress = undefined) {
239
239
  let form = new FormData();
240
240
  let data = JSON.stringify(settings, exports.replacer);
241
241
  if (enable) {
@@ -262,6 +262,9 @@ class CurtainWebAPI {
262
262
  else {
263
263
  form.append("permanent", "False");
264
264
  }
265
+ if (expiry_duration !== undefined) {
266
+ form.append("expiry_duration", expiry_duration.toString());
267
+ }
265
268
  if (encryption.encrypted && encryption.e2e && encryption.publicKey !== undefined) {
266
269
  const aesKey = yield (0, curtain_encryption_1.generateAESKey)();
267
270
  console.log("Encrypting data");
@@ -377,6 +380,9 @@ class CurtainWebAPI {
377
380
  form.append("enable", "False");
378
381
  }
379
382
  }
383
+ if ("expiry_duration" in sessionData) {
384
+ form.append("expiry_duration", sessionData["expiry_duration"].toString());
385
+ }
380
386
  if (encryption.encrypted) {
381
387
  form.append("encrypted", "True");
382
388
  }
@@ -442,9 +448,7 @@ class CurtainWebAPI {
442
448
  getSiteProperties() {
443
449
  let headers = new axios_1.AxiosHeaders();
444
450
  headers["Accept"] = "application/json";
445
- return this.axiosInstance.get(this.baseURL + "site-properties/", { headers: headers, responseType: "json" }).then((response) => {
446
- return response;
447
- });
451
+ return this.axiosInstance.get(this.baseURL + "site-properties/", { headers: headers, responseType: "json" });
448
452
  }
449
453
  saveDataFilterList(name, data, category = "") {
450
454
  let headers = new axios_1.AxiosHeaders();
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -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"}).then((response) => {
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 = "") {
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,