curtain-web-api 1.0.74 → 1.0.76

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;
@@ -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, {}>>;
@@ -226,6 +258,11 @@ export declare class CurtainWebAPI {
226
258
  results: CurtainCollection[];
227
259
  }, any, {}>>;
228
260
  getCurtainCollection(id: number): Promise<import("axios").AxiosResponse<CurtainCollection, any, {}>>;
261
+ getCurtainCollectionSessions(id: number): Promise<import("axios").AxiosResponse<{
262
+ collection_id: number;
263
+ collection_name: string;
264
+ curtains: any[];
265
+ }, any, {}>>;
229
266
  createCurtainCollection(collection: CreateCurtainCollection): Promise<import("axios").AxiosResponse<CurtainCollection, any, {}>>;
230
267
  updateCurtainCollection(id: number, collection: UpdateCurtainCollection): Promise<import("axios").AxiosResponse<CurtainCollection, any, {}>>;
231
268
  deleteCurtainCollection(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
@@ -623,6 +623,62 @@ export class CurtainWebAPI {
623
623
  headers["Accept"] = "application/json";
624
624
  return this.axiosInstance.delete(this.baseURL + "datacite/" + id + "/", { headers: headers, responseType: "json" });
625
625
  }
626
+ async parseDataCiteAlternateIdentifiers(alternateIdentifiers) {
627
+ const result = {
628
+ alternativeSessionUrls: []
629
+ };
630
+ for (const identifier of alternateIdentifiers) {
631
+ switch (identifier.alternateIdentifierType) {
632
+ case "Curtain Main Session Data":
633
+ result.mainSessionUrl = identifier.alternateIdentifier;
634
+ break;
635
+ case "Curtain Alternative Session Data":
636
+ result.alternativeSessionUrls.push(identifier.alternateIdentifier);
637
+ break;
638
+ case "Curtain Collection Metadata":
639
+ result.collectionMetadataUrl = identifier.alternateIdentifier;
640
+ break;
641
+ }
642
+ }
643
+ if (result.collectionMetadataUrl) {
644
+ try {
645
+ const response = await this.axiosInstance.get(result.collectionMetadataUrl);
646
+ result.collectionMetadata = response.data;
647
+ }
648
+ catch (error) {
649
+ console.error("Failed to fetch collection metadata:", error);
650
+ }
651
+ }
652
+ return result;
653
+ }
654
+ async loadDataCiteSession(url) {
655
+ try {
656
+ const response = await this.axiosInstance.get(url);
657
+ return response.data;
658
+ }
659
+ catch (error) {
660
+ console.error("Failed to load session data:", error);
661
+ throw error;
662
+ }
663
+ }
664
+ async loadAllDataCiteSessions(parsedData) {
665
+ const result = {
666
+ alternatives: []
667
+ };
668
+ if (parsedData.mainSessionUrl) {
669
+ result.main = await this.loadDataCiteSession(parsedData.mainSessionUrl);
670
+ }
671
+ for (const url of parsedData.alternativeSessionUrls) {
672
+ try {
673
+ const data = await this.loadDataCiteSession(url);
674
+ result.alternatives.push(data);
675
+ }
676
+ catch (error) {
677
+ console.error(`Failed to load alternative session from ${url}:`, error);
678
+ }
679
+ }
680
+ return result;
681
+ }
626
682
  changeDataCiteStatus(id, status) {
627
683
  let headers = new AxiosHeaders();
628
684
  headers["Accept"] = "application/json";
@@ -902,6 +958,11 @@ export class CurtainWebAPI {
902
958
  headers["Accept"] = "application/json";
903
959
  return this.axiosInstance.get(this.baseURL + "curtain-collections/" + id + "/", { headers: headers, responseType: "json" });
904
960
  }
961
+ getCurtainCollectionSessions(id) {
962
+ let headers = new AxiosHeaders();
963
+ headers["Accept"] = "application/json";
964
+ return this.axiosInstance.get(this.baseURL + "curtain-collections/" + id + "/curtains/", { headers: headers, responseType: "json" });
965
+ }
905
966
  createCurtainCollection(collection) {
906
967
  let headers = new AxiosHeaders();
907
968
  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.74",
3
+ "version": "1.0.76",
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 = "";
@@ -821,6 +850,68 @@ export class CurtainWebAPI {
821
850
  return this.axiosInstance.delete(this.baseURL + "datacite/" + id + "/", {headers: headers, responseType: "json"})
822
851
  }
823
852
 
853
+ async parseDataCiteAlternateIdentifiers(alternateIdentifiers: DataCiteAlternateIdentifier[]): Promise<ParsedDataCiteData> {
854
+ const result: ParsedDataCiteData = {
855
+ alternativeSessionUrls: []
856
+ };
857
+
858
+ for (const identifier of alternateIdentifiers) {
859
+ switch (identifier.alternateIdentifierType) {
860
+ case "Curtain Main Session Data":
861
+ result.mainSessionUrl = identifier.alternateIdentifier;
862
+ break;
863
+ case "Curtain Alternative Session Data":
864
+ result.alternativeSessionUrls.push(identifier.alternateIdentifier);
865
+ break;
866
+ case "Curtain Collection Metadata":
867
+ result.collectionMetadataUrl = identifier.alternateIdentifier;
868
+ break;
869
+ }
870
+ }
871
+
872
+ if (result.collectionMetadataUrl) {
873
+ try {
874
+ const response = await this.axiosInstance.get<DataCiteCollectionMetadata>(result.collectionMetadataUrl);
875
+ result.collectionMetadata = response.data;
876
+ } catch (error) {
877
+ console.error("Failed to fetch collection metadata:", error);
878
+ }
879
+ }
880
+
881
+ return result;
882
+ }
883
+
884
+ async loadDataCiteSession(url: string): Promise<any> {
885
+ try {
886
+ const response = await this.axiosInstance.get(url);
887
+ return response.data;
888
+ } catch (error) {
889
+ console.error("Failed to load session data:", error);
890
+ throw error;
891
+ }
892
+ }
893
+
894
+ async loadAllDataCiteSessions(parsedData: ParsedDataCiteData): Promise<{main?: any, alternatives: any[]}> {
895
+ const result: {main?: any, alternatives: any[]} = {
896
+ alternatives: []
897
+ };
898
+
899
+ if (parsedData.mainSessionUrl) {
900
+ result.main = await this.loadDataCiteSession(parsedData.mainSessionUrl);
901
+ }
902
+
903
+ for (const url of parsedData.alternativeSessionUrls) {
904
+ try {
905
+ const data = await this.loadDataCiteSession(url);
906
+ result.alternatives.push(data);
907
+ } catch (error) {
908
+ console.error(`Failed to load alternative session from ${url}:`, error);
909
+ }
910
+ }
911
+
912
+ return result;
913
+ }
914
+
824
915
  changeDataCiteStatus(id: number, status: string) {
825
916
  let headers = new AxiosHeaders()
826
917
  headers["Accept"] = "application/json"
@@ -1150,6 +1241,12 @@ export class CurtainWebAPI {
1150
1241
  return this.axiosInstance.get<CurtainCollection>(this.baseURL + "curtain-collections/" + id + "/", {headers: headers, responseType: "json"});
1151
1242
  }
1152
1243
 
1244
+ getCurtainCollectionSessions(id: number) {
1245
+ let headers = new AxiosHeaders();
1246
+ headers["Accept"] = "application/json";
1247
+ return this.axiosInstance.get<{collection_id: number, collection_name: string, curtains: any[]}>(this.baseURL + "curtain-collections/" + id + "/curtains/", {headers: headers, responseType: "json"});
1248
+ }
1249
+
1153
1250
  createCurtainCollection(collection: CreateCurtainCollection) {
1154
1251
  let headers = new AxiosHeaders();
1155
1252
  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