zenodo 3.0.0 → 4.1.0

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.
Files changed (96) hide show
  1. package/lib/Zenodo.d.ts +22 -31
  2. package/lib/Zenodo.d.ts.map +1 -1
  3. package/lib/Zenodo.js +39 -45
  4. package/lib/Zenodo.js.map +1 -1
  5. package/lib/ZenodoAuthenticationStates.d.ts +6 -5
  6. package/lib/ZenodoAuthenticationStates.d.ts.map +1 -1
  7. package/lib/ZenodoAuthenticationStates.js +3 -5
  8. package/lib/ZenodoAuthenticationStates.js.map +1 -1
  9. package/lib/ZenodoFile.d.ts +26 -1
  10. package/lib/ZenodoFile.d.ts.map +1 -1
  11. package/lib/ZenodoFile.js +2 -3
  12. package/lib/ZenodoFile.js.map +1 -1
  13. package/lib/fetchZenodo.d.ts +2 -2
  14. package/lib/fetchZenodo.d.ts.map +1 -1
  15. package/lib/fetchZenodo.js +94 -11
  16. package/lib/fetchZenodo.js.map +1 -1
  17. package/lib/index.d.ts +0 -1
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +0 -1
  20. package/lib/index.js.map +1 -1
  21. package/lib/records/ListDepositionsOptions.d.ts.map +1 -0
  22. package/lib/records/ListDepositionsOptions.js.map +1 -0
  23. package/lib/records/Record.d.ts +36 -0
  24. package/lib/records/Record.d.ts.map +1 -0
  25. package/lib/records/Record.js +231 -0
  26. package/lib/records/Record.js.map +1 -0
  27. package/lib/records/RecordType.d.ts +518 -0
  28. package/lib/records/RecordType.d.ts.map +1 -0
  29. package/lib/records/RecordType.js +2 -0
  30. package/lib/records/RecordType.js.map +1 -0
  31. package/lib/records/RequestType.d.ts +37 -0
  32. package/lib/records/RequestType.d.ts.map +1 -0
  33. package/lib/records/RequestType.js +2 -0
  34. package/lib/records/RequestType.js.map +1 -0
  35. package/lib/utilities/zipFiles.js +1 -1
  36. package/lib/utilities/zipFiles.js.map +1 -1
  37. package/package.json +23 -22
  38. package/src/Zenodo.ts +59 -59
  39. package/src/ZenodoAuthenticationStates.ts +6 -5
  40. package/src/ZenodoFile.ts +24 -4
  41. package/src/fetchZenodo.ts +105 -18
  42. package/src/index.ts +0 -2
  43. package/src/records/Record.ts +311 -0
  44. package/src/records/RecordType.ts +485 -0
  45. package/src/records/RequestType.ts +37 -0
  46. package/src/utilities/zipFiles.ts +1 -1
  47. package/lib/depositions/Deposition.d.ts +0 -98
  48. package/lib/depositions/Deposition.d.ts.map +0 -1
  49. package/lib/depositions/Deposition.js +0 -224
  50. package/lib/depositions/Deposition.js.map +0 -1
  51. package/lib/depositions/ListDepositionsOptions.d.ts.map +0 -1
  52. package/lib/depositions/ListDepositionsOptions.js.map +0 -1
  53. package/lib/depositions/Record.d.ts +0 -10
  54. package/lib/depositions/Record.d.ts.map +0 -1
  55. package/lib/depositions/Record.js +0 -19
  56. package/lib/depositions/Record.js.map +0 -1
  57. package/lib/utilities/ZenodoDepositionSchema.d.ts +0 -473
  58. package/lib/utilities/ZenodoDepositionSchema.d.ts.map +0 -1
  59. package/lib/utilities/ZenodoDepositionSchema.js +0 -80
  60. package/lib/utilities/ZenodoDepositionSchema.js.map +0 -1
  61. package/lib/utilities/ZenodoFileSchema.d.ts +0 -39
  62. package/lib/utilities/ZenodoFileSchema.d.ts.map +0 -1
  63. package/lib/utilities/ZenodoFileSchema.js +0 -37
  64. package/lib/utilities/ZenodoFileSchema.js.map +0 -1
  65. package/lib/utilities/ZenodoMetadataSchema.d.ts +0 -400
  66. package/lib/utilities/ZenodoMetadataSchema.d.ts.map +0 -1
  67. package/lib/utilities/ZenodoMetadataSchema.js +0 -602
  68. package/lib/utilities/ZenodoMetadataSchema.js.map +0 -1
  69. package/lib/utilities/ZenodoRecordSchema.d.ts +0 -544
  70. package/lib/utilities/ZenodoRecordSchema.d.ts.map +0 -1
  71. package/lib/utilities/ZenodoRecordSchema.js +0 -70
  72. package/lib/utilities/ZenodoRecordSchema.js.map +0 -1
  73. package/lib/utilities/ZenodoReviewSchema.d.ts +0 -112
  74. package/lib/utilities/ZenodoReviewSchema.d.ts.map +0 -1
  75. package/lib/utilities/ZenodoReviewSchema.js +0 -80
  76. package/lib/utilities/ZenodoReviewSchema.js.map +0 -1
  77. package/lib/utilities/licensesEnum.d.ts +0 -4
  78. package/lib/utilities/licensesEnum.d.ts.map +0 -1
  79. package/lib/utilities/licensesEnum.js +0 -449
  80. package/lib/utilities/licensesEnum.js.map +0 -1
  81. package/lib/utilities/schemaValidation.d.ts +0 -50
  82. package/lib/utilities/schemaValidation.d.ts.map +0 -1
  83. package/lib/utilities/schemaValidation.js +0 -124
  84. package/lib/utilities/schemaValidation.js.map +0 -1
  85. package/src/depositions/Deposition.ts +0 -272
  86. package/src/depositions/Record.ts +0 -25
  87. package/src/utilities/ZenodoDepositionSchema.ts +0 -90
  88. package/src/utilities/ZenodoFileSchema.ts +0 -40
  89. package/src/utilities/ZenodoMetadataSchema.ts +0 -608
  90. package/src/utilities/ZenodoRecordSchema.ts +0 -75
  91. package/src/utilities/ZenodoReviewSchema.ts +0 -84
  92. package/src/utilities/licensesEnum.ts +0 -448
  93. package/src/utilities/schemaValidation.ts +0 -150
  94. /package/lib/{depositions → records}/ListDepositionsOptions.d.ts +0 -0
  95. /package/lib/{depositions → records}/ListDepositionsOptions.js +0 -0
  96. /package/src/{depositions → records}/ListDepositionsOptions.ts +0 -0
@@ -1,224 +0,0 @@
1
- import { ZenodoFile } from "../ZenodoFile.js";
2
- import { fetchZenodo } from "../fetchZenodo.js";
3
- import { validateZenodoDeposition } from "../utilities/schemaValidation.js";
4
- import { zipFiles } from "../utilities/zipFiles.js";
5
- export class Deposition {
6
- zenodo;
7
- value;
8
- constructor(zenodo, deposition) {
9
- this.zenodo = zenodo;
10
- this.value = validateZenodoDeposition(deposition, zenodo.logger);
11
- }
12
- /**
13
- * This method creates a new file in the deposition. If the file is already it will first
14
- * delete the existing file and then create a new one.
15
- * @param file - the file to create in the deposition
16
- * @returns the created file object
17
- */
18
- async createFile(file) {
19
- const createdFile = await this.createFiles([file]);
20
- if (!createdFile[0]) {
21
- throw new Error('Failed to create file: No status object returned.');
22
- }
23
- return createdFile[0];
24
- }
25
- /**
26
- * Creates multiple files in the deposition. It will attempt to create each file
27
- * multiple times with delays in between until all files are successfully created or
28
- * the maximum number of attempts is reached.
29
- * @param filesAndNames - an array of File objects to be created in the deposition
30
- * @returns an array of the created ZenodoFile objects
31
- */
32
- async createFiles(filesAndNames) {
33
- const promises = filesAndNames.map((file) => this.uploadFile(file));
34
- return await Promise.all(promises);
35
- }
36
- /**
37
- * Creates a zip file from multiple files and uploads it to the deposition.
38
- * @param filesAndNames - an array of File objects to be created in the deposition
39
- * @param zipName - the name of the zip file to be created
40
- * @returns an array of the created ZenodoFile objects
41
- */
42
- async createFilesAsZip(filesAndNames, zipName) {
43
- const zippedFile = await zipFiles(filesAndNames, zipName);
44
- return this.createFiles([zippedFile]);
45
- }
46
- /**
47
- * List all files in the deposition
48
- * @returns an array of ZenodoFile objects
49
- */
50
- async listFiles() {
51
- const response = await fetchZenodo(this.zenodo, {
52
- route: `deposit/depositions/${this.value.id}/files`,
53
- });
54
- const files = (await response.json());
55
- this.zenodo.logger?.info(`Listed ${files.length} files for deposition ${this.value.id}`);
56
- return files.map((file) => new ZenodoFile(this.zenodo, file));
57
- }
58
- /**
59
- * Delete a file from the deposition
60
- * @param id - the ID or the name of the file to delete
61
- */
62
- async deleteFile(id) {
63
- await fetchZenodo(this.zenodo, {
64
- route: `deposit/depositions/${this.value.id}/files/${id}`,
65
- method: 'DELETE',
66
- expectedStatus: 204,
67
- });
68
- this.zenodo.logger?.info(`Deleted file ${id} for deposition ${this.value.id}`);
69
- }
70
- /**
71
- * delete all files from the deposition
72
- */
73
- async deleteAllFiles() {
74
- const files = await this.listFiles();
75
- for (const file of files) {
76
- await this.deleteFile(file.value.id);
77
- }
78
- this.zenodo.logger?.info(`Deleted all files for deposition ${this.value.id}`);
79
- }
80
- /**
81
- * Retrieve a file from the deposition
82
- * @param id - the ID or the name of the file to retrieve
83
- * @returns the file object
84
- */
85
- async retrieveFile(id) {
86
- const response = await fetchZenodo(this.zenodo, {
87
- route: `deposit/depositions/${this.value.id}/files/${id}`,
88
- });
89
- const file = new ZenodoFile(this.zenodo, await response.json());
90
- this.zenodo.logger?.info(`Retrieved file ${id} for deposition ${this.value.id}`);
91
- return file;
92
- }
93
- /**
94
- * Update the metadata of the deposition
95
- * @param metadata - the new metadata to update the deposition with
96
- * @returns the updated deposition object
97
- */
98
- async update(metadata) {
99
- const response = await fetchZenodo(this.zenodo, {
100
- route: `deposit/depositions/${this.value.id}`,
101
- method: 'PUT',
102
- body: JSON.stringify({ metadata }),
103
- });
104
- const deposition = new Deposition(this.zenodo, await response.json());
105
- this.zenodo.logger?.info(`Updated deposition ${this.value.id}`);
106
- return deposition;
107
- }
108
- /**
109
- * Publish the deposition. This will make it publicly available.
110
- * !!! Note that the deposition cannot be deleted after it is published.
111
- * @returns the updated deposition object after publishing
112
- */
113
- async publish() {
114
- const response = await fetchZenodo(this.zenodo, {
115
- route: `deposit/depositions/${this.value.id}/actions/publish`,
116
- method: 'POST',
117
- expectedStatus: 202,
118
- });
119
- const deposition = new Deposition(this.zenodo, await response.json());
120
- this.zenodo.logger?.info(`Published deposition ${this.value.id}`);
121
- return deposition;
122
- }
123
- /**
124
- * Creates a new version of a published deposition.
125
- * This is useful for updating the deposition with new files or metadata.
126
- * The new version will have a new ID and will not overwrite the existing deposition.
127
- * @returns a new deposition object that is a new version of the current deposition
128
- */
129
- async newVersion() {
130
- const response = await fetchZenodo(this.zenodo, {
131
- route: `deposit/depositions/${this.value.id}/actions/newversion`,
132
- method: 'POST',
133
- expectedStatus: 201,
134
- });
135
- const deposition = new Deposition(this.zenodo, await response.json());
136
- if (deposition.value.metadata &&
137
- !deposition.value.metadata?.publication_date) {
138
- deposition.value.metadata.publication_date = new Date()
139
- .toISOString()
140
- .split('T')[0];
141
- await deposition.update(deposition.value.metadata);
142
- }
143
- this.zenodo.logger?.info(`Created new version for deposition ${this.value.id}`);
144
- return deposition;
145
- }
146
- /**
147
- * Upload a file to the deposition
148
- * @param file - the file to upload to the deposition
149
- * @returns the created file object
150
- */
151
- async uploadFile(file) {
152
- const formData = new FormData();
153
- formData.append('file', file);
154
- const response = await fetchZenodo(this.zenodo, {
155
- route: `deposit/depositions/${this.value.id}/files`,
156
- method: 'POST',
157
- body: formData,
158
- expectedStatus: 201,
159
- });
160
- const zenodoFile = new ZenodoFile(this.zenodo, await response.json());
161
- this.zenodo.logger?.info(`Created file ${zenodoFile.value.id} for deposition ${this.value.id}`);
162
- this.value.files?.push(zenodoFile.value);
163
- return zenodoFile;
164
- }
165
- /**
166
- * Submits the deposition for review via browser.
167
- * CORS request won't work from the other endpoint when using a browser.
168
- * If a URL is provided, it will use that URL to submit the request.
169
- * Otherwise, it will find the request for the current deposition and submit it.
170
- * This is not the intended endpoint for submitting requests via browser.
171
- * But the base endpoint is not CORS enabled.
172
- * You can find the method with the right endpoint at:
173
- * https://github.com/cheminfo/zenodo/blob/7fbf3e8bb44246b3465b94b68c21cd3f4fee3bf6/src/depositions/Deposition.ts#L286-L301
174
- * @param url - optional URL to submit the request
175
- * @returns The submitted Zenodo request object
176
- */
177
- async submitForReview(url) {
178
- if (url) {
179
- // If a URL is provided, we assume it's a full API endpoint for submitting the request
180
- url = url.replace(/.*requests\//, 'requests/');
181
- const response = await fetchZenodo(this.zenodo, {
182
- route: url,
183
- method: 'POST',
184
- });
185
- this.zenodo.logger?.info(`Submitted deposition ${this.value.id} for review via URL ${url}`);
186
- return (await response.json());
187
- }
188
- else {
189
- const response = await fetchZenodo(this.zenodo, {
190
- route: `requests`,
191
- });
192
- const requests = (await response.json());
193
- const request = requests.hits.hits.find((req) => req.topic.record === String(this.value.id));
194
- await fetchZenodo(this.zenodo, {
195
- route: request?.links.actions?.submit,
196
- method: 'POST',
197
- expectedStatus: 202,
198
- });
199
- this.zenodo.logger?.info(`Submitted deposition ${this.value.id} for review`);
200
- return request;
201
- }
202
- }
203
- /**
204
- * Adds the deposition to a community.
205
- * This method adds the deposition to a community by creating a review request.
206
- * @param communityId - the ID of the community to add the deposition to
207
- * @returns the response from the Zenodo API
208
- */
209
- async addToCommunity(communityId) {
210
- const body = JSON.stringify({
211
- receiver: { community: communityId },
212
- type: 'community-submission',
213
- });
214
- const response = await fetchZenodo(this.zenodo, {
215
- route: `records/${this.value.id}/draft/review`,
216
- method: 'PUT',
217
- body,
218
- expectedStatus: 200,
219
- });
220
- this.zenodo.logger?.info(`Added deposition ${this.value.id} to community ${communityId}`);
221
- return await response.json();
222
- }
223
- }
224
- //# sourceMappingURL=Deposition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Deposition.js","sourceRoot":"","sources":["../../src/depositions/Deposition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,OAAO,UAAU;IACb,MAAM,CAAS;IAChB,KAAK,CAAmB;IAE/B,YAAY,MAAc,EAAE,UAAmB;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,wBAAwB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,IAAU;QACzB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;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tC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YAC1B,QAAQ,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE;YACpC,IAAI,EAAE,sBAAsB;SAC7B,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;YAC9C,KAAK,EAAE,WAAW,IAAI,CAAC,KAAK,CAAC,EAAE,eAAe;YAC9C,MAAM,EAAE,KAAK;YACb,IAAI;YACJ,cAAc,EAAE,GAAG;SACpB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CACtB,oBAAoB,IAAI,CAAC,KAAK,CAAC,EAAE,iBAAiB,WAAW,EAAE,CAChE,CAAC;QACF,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListDepositionsOptions.d.ts","sourceRoot":"","sources":["../../src/depositions/ListDepositionsOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAE/B;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,CAAC;IAEjE;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;CACxC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListDepositionsOptions.js","sourceRoot":"","sources":["../../src/depositions/ListDepositionsOptions.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import type { Zenodo } from '../Zenodo.ts';
2
- import type { ZenodoRecord } from '../utilities/ZenodoRecordSchema.ts';
3
- import type { Deposition } from './Deposition.ts';
4
- export declare class Record {
5
- value: ZenodoRecord;
6
- private zenodo;
7
- constructor(zenodo: Zenodo, value: unknown);
8
- getDeposition(): Promise<Deposition>;
9
- }
10
- //# sourceMappingURL=Record.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Record.d.ts","sourceRoot":"","sources":["../../src/depositions/Record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,qBAAa,MAAM;IACV,KAAK,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAKpC,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;CAS3C"}
@@ -1,19 +0,0 @@
1
- import { validateZenodoRecord } from "../utilities/schemaValidation.js";
2
- export class Record {
3
- value;
4
- zenodo;
5
- constructor(zenodo, value) {
6
- this.zenodo = zenodo;
7
- this.value = validateZenodoRecord(value);
8
- }
9
- async getDeposition() {
10
- if (this.value.id === undefined) {
11
- throw new Error('Deposition ID is undefined');
12
- }
13
- if (this.zenodo.accessToken === undefined) {
14
- throw new Error('Access token is required to retrieve a deposition');
15
- }
16
- return await this.zenodo.retrieveDeposition(this.value.id);
17
- }
18
- }
19
- //# sourceMappingURL=Record.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Record.js","sourceRoot":"","sources":["../../src/depositions/Record.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAIxE,MAAM,OAAO,MAAM;IACV,KAAK,CAAe;IACnB,MAAM,CAAS;IAEvB,YAAY,MAAc,EAAE,KAAc;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF"}