curtain-web-api 1.0.75 → 1.0.77

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/.idea/.name CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/.idea/modules.xml CHANGED
File without changes
package/.idea/vcs.xml CHANGED
File without changes
package/README.md CHANGED
File without changes
@@ -11,6 +11,8 @@ export interface SiteProperties {
11
11
  jwt_refresh_token_lifetime_days: number;
12
12
  jwt_remember_me_access_token_lifetime_days: number;
13
13
  jwt_remember_me_refresh_token_lifetime_days: number;
14
+ umami_website_id?: string;
15
+ umami_url?: string;
14
16
  }
15
17
  export interface CurtainChunkedUploadStatus {
16
18
  id: string;
@@ -121,6 +123,30 @@ export interface AddCurtainToCollection {
121
123
  curtain_id?: number;
122
124
  link_id?: string;
123
125
  }
126
+ export interface DataCiteAlternateIdentifier {
127
+ alternateIdentifier: string;
128
+ alternateIdentifierType: string;
129
+ }
130
+ export interface DataCiteCollectionMetadata {
131
+ collection_id: number;
132
+ collection_name: string;
133
+ collection_description: string;
134
+ main_session: {
135
+ curtain_id: number | null;
136
+ link_id: string | null;
137
+ };
138
+ sessions: Array<{
139
+ curtain_id: number;
140
+ link_id: string;
141
+ data_url: string;
142
+ }>;
143
+ }
144
+ export interface ParsedDataCiteData {
145
+ mainSessionUrl?: string;
146
+ alternativeSessionUrls: string[];
147
+ collectionMetadataUrl?: string;
148
+ collectionMetadata?: DataCiteCollectionMetadata;
149
+ }
124
150
  export declare class CurtainWebAPI {
125
151
  loginURL: string;
126
152
  logoutURL: string;
@@ -152,7 +178,7 @@ export declare class CurtainWebAPI {
152
178
  addOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
153
179
  removeOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
154
180
  getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
155
- getSiteProperties(): Promise<import("axios").AxiosResponse<SiteProperties, any, {}>>;
181
+ getSiteProperties(appType?: string): Promise<import("axios").AxiosResponse<SiteProperties, any, {}>>;
156
182
  saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
157
183
  getDataFilterListByID(id: number, limit?: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
158
184
  getDataFilterList(title?: string, searchTerm?: string, category?: string, limit?: number, offset?: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
@@ -182,6 +208,12 @@ export declare class CurtainWebAPI {
182
208
  }, any, {}>>;
183
209
  updateDataCite(id: number, data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
184
210
  deleteDataCite(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
211
+ parseDataCiteAlternateIdentifiers(alternateIdentifiers: DataCiteAlternateIdentifier[]): Promise<ParsedDataCiteData>;
212
+ loadDataCiteSession(url: string): Promise<any>;
213
+ loadAllDataCiteSessions(parsedData: ParsedDataCiteData): Promise<{
214
+ main?: any;
215
+ alternatives: any[];
216
+ }>;
185
217
  changeDataCiteStatus(id: number, status: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
186
218
  lockDataCite(id: number, lock: boolean): Promise<import("axios").AxiosResponse<any, any, {}>>;
187
219
  getKinaseLibraryProxy(sequence: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
@@ -414,10 +414,14 @@ export class CurtainWebAPI {
414
414
  return response;
415
415
  });
416
416
  }
417
- getSiteProperties() {
417
+ getSiteProperties(appType) {
418
418
  let headers = new AxiosHeaders();
419
419
  headers["Accept"] = "application/json";
420
- return this.axiosInstance.get(this.baseURL + "site-properties/", { headers: headers, responseType: "json" });
420
+ let params = new URLSearchParams();
421
+ if (appType) {
422
+ params.append("app", appType);
423
+ }
424
+ return this.axiosInstance.get(this.baseURL + "site-properties/", { headers: headers, params: params, responseType: "json" });
421
425
  }
422
426
  saveDataFilterList(name, data, category = "") {
423
427
  let headers = new AxiosHeaders();
@@ -623,6 +627,62 @@ export class CurtainWebAPI {
623
627
  headers["Accept"] = "application/json";
624
628
  return this.axiosInstance.delete(this.baseURL + "datacite/" + id + "/", { headers: headers, responseType: "json" });
625
629
  }
630
+ async parseDataCiteAlternateIdentifiers(alternateIdentifiers) {
631
+ const result = {
632
+ alternativeSessionUrls: []
633
+ };
634
+ for (const identifier of alternateIdentifiers) {
635
+ switch (identifier.alternateIdentifierType) {
636
+ case "Curtain Main Session Data":
637
+ result.mainSessionUrl = identifier.alternateIdentifier;
638
+ break;
639
+ case "Curtain Alternative Session Data":
640
+ result.alternativeSessionUrls.push(identifier.alternateIdentifier);
641
+ break;
642
+ case "Curtain Collection Metadata":
643
+ result.collectionMetadataUrl = identifier.alternateIdentifier;
644
+ break;
645
+ }
646
+ }
647
+ if (result.collectionMetadataUrl) {
648
+ try {
649
+ const response = await this.axiosInstance.get(result.collectionMetadataUrl);
650
+ result.collectionMetadata = response.data;
651
+ }
652
+ catch (error) {
653
+ console.error("Failed to fetch collection metadata:", error);
654
+ }
655
+ }
656
+ return result;
657
+ }
658
+ async loadDataCiteSession(url) {
659
+ try {
660
+ const response = await this.axiosInstance.get(url);
661
+ return response.data;
662
+ }
663
+ catch (error) {
664
+ console.error("Failed to load session data:", error);
665
+ throw error;
666
+ }
667
+ }
668
+ async loadAllDataCiteSessions(parsedData) {
669
+ const result = {
670
+ alternatives: []
671
+ };
672
+ if (parsedData.mainSessionUrl) {
673
+ result.main = await this.loadDataCiteSession(parsedData.mainSessionUrl);
674
+ }
675
+ for (const url of parsedData.alternativeSessionUrls) {
676
+ try {
677
+ const data = await this.loadDataCiteSession(url);
678
+ result.alternatives.push(data);
679
+ }
680
+ catch (error) {
681
+ console.error(`Failed to load alternative session from ${url}:`, error);
682
+ }
683
+ }
684
+ return result;
685
+ }
626
686
  changeDataCiteStatus(id, status) {
627
687
  let headers = new AxiosHeaders();
628
688
  headers["Accept"] = "application/json";
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/build/index.d.ts CHANGED
File without changes
package/build/index.js CHANGED
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -39,6 +39,8 @@ export interface SiteProperties {
39
39
  jwt_refresh_token_lifetime_days: number;
40
40
  jwt_remember_me_access_token_lifetime_days: number;
41
41
  jwt_remember_me_refresh_token_lifetime_days: number;
42
+ umami_website_id?: string;
43
+ umami_url?: string;
42
44
  }
43
45
 
44
46
  export interface CurtainChunkedUploadStatus {
@@ -162,6 +164,33 @@ export interface AddCurtainToCollection {
162
164
  link_id?: string;
163
165
  }
164
166
 
167
+ export interface DataCiteAlternateIdentifier {
168
+ alternateIdentifier: string;
169
+ alternateIdentifierType: string;
170
+ }
171
+
172
+ export interface DataCiteCollectionMetadata {
173
+ collection_id: number;
174
+ collection_name: string;
175
+ collection_description: string;
176
+ main_session: {
177
+ curtain_id: number | null;
178
+ link_id: string | null;
179
+ };
180
+ sessions: Array<{
181
+ curtain_id: number;
182
+ link_id: string;
183
+ data_url: string;
184
+ }>;
185
+ }
186
+
187
+ export interface ParsedDataCiteData {
188
+ mainSessionUrl?: string;
189
+ alternativeSessionUrls: string[];
190
+ collectionMetadataUrl?: string;
191
+ collectionMetadata?: DataCiteCollectionMetadata;
192
+ }
193
+
165
194
  export class CurtainWebAPI {
166
195
  loginURL: string = "";
167
196
  logoutURL: string = "";
@@ -581,10 +610,14 @@ export class CurtainWebAPI {
581
610
  });
582
611
  }
583
612
 
584
- getSiteProperties() {
613
+ getSiteProperties(appType?: string) {
585
614
  let headers = new AxiosHeaders();
586
615
  headers["Accept"] = "application/json";
587
- return this.axiosInstance.get<SiteProperties>(this.baseURL + "site-properties/", {headers: headers, responseType:"json"});
616
+ let params = new URLSearchParams();
617
+ if (appType) {
618
+ params.append("app", appType);
619
+ }
620
+ return this.axiosInstance.get<SiteProperties>(this.baseURL + "site-properties/", {headers: headers, params: params, responseType:"json"});
588
621
  }
589
622
 
590
623
  saveDataFilterList(name: string, data: string, category: string = "") {
@@ -821,6 +854,68 @@ export class CurtainWebAPI {
821
854
  return this.axiosInstance.delete(this.baseURL + "datacite/" + id + "/", {headers: headers, responseType: "json"})
822
855
  }
823
856
 
857
+ async parseDataCiteAlternateIdentifiers(alternateIdentifiers: DataCiteAlternateIdentifier[]): Promise<ParsedDataCiteData> {
858
+ const result: ParsedDataCiteData = {
859
+ alternativeSessionUrls: []
860
+ };
861
+
862
+ for (const identifier of alternateIdentifiers) {
863
+ switch (identifier.alternateIdentifierType) {
864
+ case "Curtain Main Session Data":
865
+ result.mainSessionUrl = identifier.alternateIdentifier;
866
+ break;
867
+ case "Curtain Alternative Session Data":
868
+ result.alternativeSessionUrls.push(identifier.alternateIdentifier);
869
+ break;
870
+ case "Curtain Collection Metadata":
871
+ result.collectionMetadataUrl = identifier.alternateIdentifier;
872
+ break;
873
+ }
874
+ }
875
+
876
+ if (result.collectionMetadataUrl) {
877
+ try {
878
+ const response = await this.axiosInstance.get<DataCiteCollectionMetadata>(result.collectionMetadataUrl);
879
+ result.collectionMetadata = response.data;
880
+ } catch (error) {
881
+ console.error("Failed to fetch collection metadata:", error);
882
+ }
883
+ }
884
+
885
+ return result;
886
+ }
887
+
888
+ async loadDataCiteSession(url: string): Promise<any> {
889
+ try {
890
+ const response = await this.axiosInstance.get(url);
891
+ return response.data;
892
+ } catch (error) {
893
+ console.error("Failed to load session data:", error);
894
+ throw error;
895
+ }
896
+ }
897
+
898
+ async loadAllDataCiteSessions(parsedData: ParsedDataCiteData): Promise<{main?: any, alternatives: any[]}> {
899
+ const result: {main?: any, alternatives: any[]} = {
900
+ alternatives: []
901
+ };
902
+
903
+ if (parsedData.mainSessionUrl) {
904
+ result.main = await this.loadDataCiteSession(parsedData.mainSessionUrl);
905
+ }
906
+
907
+ for (const url of parsedData.alternativeSessionUrls) {
908
+ try {
909
+ const data = await this.loadDataCiteSession(url);
910
+ result.alternatives.push(data);
911
+ } catch (error) {
912
+ console.error(`Failed to load alternative session from ${url}:`, error);
913
+ }
914
+ }
915
+
916
+ return result;
917
+ }
918
+
824
919
  changeDataCiteStatus(id: number, status: string) {
825
920
  let headers = new AxiosHeaders()
826
921
  headers["Accept"] = "application/json"
File without changes
File without changes
package/src/index.ts CHANGED
File without changes
File without changes
File without changes
package/src/utilities.ts CHANGED
File without changes
package/tsconfig.json CHANGED
File without changes