zenodo 2.0.0 → 3.0.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 (122) hide show
  1. package/README.md +12 -0
  2. package/lib/Zenodo.d.ts +76 -4
  3. package/lib/Zenodo.d.ts.map +1 -1
  4. package/lib/Zenodo.js +150 -19
  5. package/lib/Zenodo.js.map +1 -1
  6. package/lib/ZenodoAuthenticationStates.d.ts +21 -0
  7. package/lib/ZenodoAuthenticationStates.d.ts.map +1 -0
  8. package/lib/ZenodoAuthenticationStates.js +20 -0
  9. package/lib/ZenodoAuthenticationStates.js.map +1 -0
  10. package/lib/ZenodoFile.d.ts +2 -38
  11. package/lib/ZenodoFile.d.ts.map +1 -1
  12. package/lib/ZenodoFile.js +3 -18
  13. package/lib/ZenodoFile.js.map +1 -1
  14. package/lib/depositions/Deposition.d.ts +90 -6
  15. package/lib/depositions/Deposition.d.ts.map +1 -1
  16. package/lib/depositions/Deposition.js +198 -29
  17. package/lib/depositions/Deposition.js.map +1 -1
  18. package/lib/depositions/ListDepositionsOptions.d.ts +4 -2
  19. package/lib/depositions/ListDepositionsOptions.d.ts.map +1 -1
  20. package/lib/depositions/ListDepositionsOptions.js +1 -2
  21. package/lib/depositions/Record.d.ts +10 -0
  22. package/lib/depositions/Record.d.ts.map +1 -0
  23. package/lib/depositions/Record.js +19 -0
  24. package/lib/depositions/Record.js.map +1 -0
  25. package/lib/fetchZenodo.d.ts +44 -1
  26. package/lib/fetchZenodo.d.ts.map +1 -1
  27. package/lib/fetchZenodo.js +214 -15
  28. package/lib/fetchZenodo.js.map +1 -1
  29. package/lib/index.d.ts +3 -1
  30. package/lib/index.d.ts.map +1 -1
  31. package/lib/index.js +3 -17
  32. package/lib/index.js.map +1 -1
  33. package/lib/responseStatuses.js +1 -4
  34. package/lib/responseStatuses.js.map +1 -1
  35. package/lib/utilities/ZenodoDepositionSchema.d.ts +473 -0
  36. package/lib/utilities/ZenodoDepositionSchema.d.ts.map +1 -0
  37. package/lib/utilities/ZenodoDepositionSchema.js +80 -0
  38. package/lib/utilities/ZenodoDepositionSchema.js.map +1 -0
  39. package/lib/utilities/ZenodoFileSchema.d.ts +39 -0
  40. package/lib/utilities/ZenodoFileSchema.d.ts.map +1 -0
  41. package/lib/utilities/ZenodoFileSchema.js +37 -0
  42. package/lib/utilities/ZenodoFileSchema.js.map +1 -0
  43. package/lib/utilities/ZenodoMetadataSchema.d.ts +400 -0
  44. package/lib/utilities/ZenodoMetadataSchema.d.ts.map +1 -0
  45. package/lib/utilities/ZenodoMetadataSchema.js +602 -0
  46. package/lib/utilities/ZenodoMetadataSchema.js.map +1 -0
  47. package/lib/utilities/ZenodoRecordSchema.d.ts +544 -0
  48. package/lib/utilities/ZenodoRecordSchema.d.ts.map +1 -0
  49. package/lib/utilities/ZenodoRecordSchema.js +70 -0
  50. package/lib/utilities/ZenodoRecordSchema.js.map +1 -0
  51. package/lib/utilities/ZenodoReviewSchema.d.ts +112 -0
  52. package/lib/utilities/ZenodoReviewSchema.d.ts.map +1 -0
  53. package/lib/utilities/ZenodoReviewSchema.js +80 -0
  54. package/lib/utilities/ZenodoReviewSchema.js.map +1 -0
  55. package/lib/utilities/licensesEnum.d.ts +4 -0
  56. package/lib/utilities/licensesEnum.d.ts.map +1 -0
  57. package/lib/utilities/licensesEnum.js +449 -0
  58. package/lib/utilities/licensesEnum.js.map +1 -0
  59. package/lib/utilities/schemaValidation.d.ts +50 -0
  60. package/lib/utilities/schemaValidation.d.ts.map +1 -0
  61. package/lib/utilities/schemaValidation.js +124 -0
  62. package/lib/utilities/schemaValidation.js.map +1 -0
  63. package/lib/utilities/zipFiles.d.ts +9 -0
  64. package/lib/utilities/zipFiles.d.ts.map +1 -0
  65. package/lib/utilities/zipFiles.js +28 -0
  66. package/lib/utilities/zipFiles.js.map +1 -0
  67. package/package.json +28 -22
  68. package/src/Zenodo.ts +180 -10
  69. package/src/ZenodoAuthenticationStates.ts +22 -0
  70. package/src/ZenodoFile.ts +4 -18
  71. package/src/depositions/Deposition.ts +236 -24
  72. package/src/depositions/ListDepositionsOptions.ts +4 -2
  73. package/src/depositions/Record.ts +25 -0
  74. package/src/fetchZenodo.ts +402 -16
  75. package/src/index.ts +5 -1
  76. package/src/utilities/ZenodoDepositionSchema.ts +90 -0
  77. package/src/utilities/ZenodoFileSchema.ts +40 -0
  78. package/src/utilities/ZenodoMetadataSchema.ts +608 -0
  79. package/src/utilities/ZenodoRecordSchema.ts +75 -0
  80. package/src/utilities/ZenodoReviewSchema.ts +84 -0
  81. package/src/utilities/licensesEnum.ts +448 -0
  82. package/src/utilities/schemaValidation.ts +150 -0
  83. package/src/utilities/zipFiles.ts +36 -0
  84. package/lib/depositions/depositionSchema.d.ts +0 -982
  85. package/lib/depositions/depositionSchema.d.ts.map +0 -1
  86. package/lib/depositions/depositionSchema.js +0 -141
  87. package/lib/depositions/depositionSchema.js.map +0 -1
  88. package/lib-esm/Zenodo.d.ts +0 -19
  89. package/lib-esm/Zenodo.d.ts.map +0 -1
  90. package/lib-esm/Zenodo.js +0 -51
  91. package/lib-esm/Zenodo.js.map +0 -1
  92. package/lib-esm/ZenodoFile.d.ts +0 -45
  93. package/lib-esm/ZenodoFile.d.ts.map +0 -1
  94. package/lib-esm/ZenodoFile.js +0 -33
  95. package/lib-esm/ZenodoFile.js.map +0 -1
  96. package/lib-esm/depositions/Deposition.d.ts +0 -14
  97. package/lib-esm/depositions/Deposition.d.ts.map +0 -1
  98. package/lib-esm/depositions/Deposition.js +0 -51
  99. package/lib-esm/depositions/Deposition.js.map +0 -1
  100. package/lib-esm/depositions/ListDepositionsOptions.d.ts +0 -32
  101. package/lib-esm/depositions/ListDepositionsOptions.d.ts.map +0 -1
  102. package/lib-esm/depositions/ListDepositionsOptions.js +0 -2
  103. package/lib-esm/depositions/ListDepositionsOptions.js.map +0 -1
  104. package/lib-esm/depositions/depositionSchema.d.ts +0 -982
  105. package/lib-esm/depositions/depositionSchema.d.ts.map +0 -1
  106. package/lib-esm/depositions/depositionSchema.js +0 -138
  107. package/lib-esm/depositions/depositionSchema.js.map +0 -1
  108. package/lib-esm/fetchZenodo.d.ts +0 -12
  109. package/lib-esm/fetchZenodo.d.ts.map +0 -1
  110. package/lib-esm/fetchZenodo.js +0 -31
  111. package/lib-esm/fetchZenodo.js.map +0 -1
  112. package/lib-esm/index.d.ts +0 -2
  113. package/lib-esm/index.d.ts.map +0 -1
  114. package/lib-esm/index.js +0 -2
  115. package/lib-esm/index.js.map +0 -1
  116. package/lib-esm/responseStatuses.d.ts +0 -8
  117. package/lib-esm/responseStatuses.d.ts.map +0 -1
  118. package/lib-esm/responseStatuses.js +0 -68
  119. package/lib-esm/responseStatuses.js.map +0 -1
  120. package/src/__tests__/Zenodo.test.ts +0 -79
  121. package/src/__tests__/getConfig.ts +0 -9
  122. package/src/depositions/depositionSchema.ts +0 -154
@@ -0,0 +1,608 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+
3
+ import { licenseEnum } from './licensesEnum.ts';
4
+
5
+ /**
6
+ * The schema was taken from the Unofficial JSON schema for Zenodo upload metadata the 16th of June 2025.
7
+ * https:// github.com/zenodraft/metadata-schema-zenodo
8
+ */
9
+ export const zenodoMetadataSchema = {
10
+ $schema: 'http://json-schema.org/draft-07/schema',
11
+ additionalProperties: true,
12
+ allOf: [
13
+ {
14
+ if: {
15
+ type: 'object',
16
+ properties: {
17
+ access_right: {
18
+ const: 'embargoed',
19
+ },
20
+ },
21
+ required: ['access_right'],
22
+ },
23
+ // eslint-disable-next-line unicorn/no-thenable
24
+ then: {
25
+ type: 'object',
26
+ required: ['embargo_date', 'license'],
27
+ },
28
+ },
29
+ ],
30
+ definitions: {},
31
+ properties: {
32
+ access_conditions: {
33
+ type: 'string',
34
+ },
35
+ access_right: {
36
+ description:
37
+ 'Open access uploads have considerably higher visibility on Zenodo.',
38
+ enum: ['closed', 'embargoed', 'open', 'restricted'],
39
+ type: 'string',
40
+ },
41
+ communities: {
42
+ items: {
43
+ additionalProperties: true,
44
+ properties: {
45
+ identifier: {
46
+ type: 'string',
47
+ },
48
+ },
49
+ required: [],
50
+ type: 'object',
51
+ },
52
+ minItems: 0,
53
+ type: 'array',
54
+ uniqueItems: true,
55
+ },
56
+ conference_acronym: {
57
+ type: 'string',
58
+ },
59
+ conference_dates: {
60
+ type: 'string',
61
+ },
62
+ conference_place: {
63
+ type: 'string',
64
+ },
65
+ conference_session: {
66
+ type: 'string',
67
+ },
68
+ conference_session_part: {
69
+ type: 'string',
70
+ },
71
+ conference_title: {
72
+ type: 'string',
73
+ },
74
+ conference_url: {
75
+ format: 'uri',
76
+ type: 'string',
77
+ },
78
+ contributors: {
79
+ items: {
80
+ additionalProperties: false,
81
+ properties: {
82
+ affiliation: {
83
+ minLength: 1,
84
+ type: ['string', 'null'],
85
+ },
86
+ name: {
87
+ description: 'Family name, given names',
88
+ minLength: 1,
89
+ type: 'string',
90
+ },
91
+ orcid: {
92
+ description: 'ORCID identifier',
93
+ examples: ['0000-0002-1825-0097'],
94
+ pattern: '[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]{1}',
95
+ type: 'string',
96
+ },
97
+ type: {
98
+ enum: [
99
+ 'ContactPerson',
100
+ 'DataCollector',
101
+ 'DataCurator',
102
+ 'DataManager',
103
+ 'Distributor',
104
+ 'Editor',
105
+ 'HostingInstitution',
106
+ 'Other',
107
+ 'Producer',
108
+ 'ProjectLeader',
109
+ 'ProjectManager',
110
+ 'ProjectMember',
111
+ 'RegistrationAgency',
112
+ 'RegistrationAuthority',
113
+ 'RelatedPerson',
114
+ 'Researcher',
115
+ 'ResearchGroup',
116
+ 'RightsHolder',
117
+ 'Sponsor',
118
+ 'Supervisor',
119
+ 'WorkPackageLeader',
120
+ null,
121
+ ],
122
+ type: ['string', 'null'],
123
+ },
124
+ },
125
+ required: ['name', 'type'],
126
+ type: 'object',
127
+ },
128
+ minItems: 0,
129
+ type: 'array',
130
+ uniqueItems: true,
131
+ },
132
+ creators: {
133
+ items: {
134
+ additionalProperties: false,
135
+ properties: {
136
+ affiliation: {
137
+ minLength: 1,
138
+ type: ['string', 'null'],
139
+ },
140
+ name: {
141
+ description: 'Family name, given names',
142
+ minLength: 1,
143
+ type: 'string',
144
+ },
145
+ orcid: {
146
+ description: 'ORCID identifier',
147
+ examples: ['0000-0002-1825-0097'],
148
+ pattern: '[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]{1}',
149
+ type: 'string',
150
+ },
151
+ },
152
+ required: ['name'],
153
+ type: 'object',
154
+ },
155
+ type: 'array',
156
+ uniqueItems: true,
157
+ minItems: 1,
158
+ },
159
+ description: {
160
+ description: 'Description',
161
+ type: 'string',
162
+ },
163
+ doi: {
164
+ oneOf: [
165
+ {
166
+ examples: ['10.5281/zenodo.1003150'],
167
+ pattern: String.raw`^10\.\d{4,9}(\.\d+)?/[A-Za-z0-9:/_;\-\.\(\)\[\]\\]+$`,
168
+ type: 'string',
169
+ },
170
+ {
171
+ const: '',
172
+ },
173
+ ],
174
+ },
175
+ embargo_date: {
176
+ format: 'date',
177
+ type: 'string',
178
+ },
179
+ grants: {
180
+ items: {
181
+ additionalProperties: true,
182
+ examples: ['10.13039/501100000780::675191'],
183
+ properties: {
184
+ id: {
185
+ type: 'string',
186
+ },
187
+ },
188
+ required: [],
189
+ type: 'object',
190
+ },
191
+ minItems: 0,
192
+ type: 'array',
193
+ uniqueItems: true,
194
+ },
195
+ image_type: {
196
+ enum: ['diagram', 'drawing', 'figure', 'other', 'photo', 'plot'],
197
+ type: 'string',
198
+ },
199
+ imprint_isbn: {
200
+ type: 'string',
201
+ },
202
+ imprint_place: {
203
+ type: 'string',
204
+ },
205
+ imprint_publisher: {
206
+ type: 'string',
207
+ },
208
+ journal_issue: {
209
+ type: 'string',
210
+ },
211
+ journal_pages: {
212
+ type: 'string',
213
+ },
214
+ journal_title: {
215
+ type: 'string',
216
+ },
217
+ journal_volume: {
218
+ type: 'string',
219
+ },
220
+ keywords: {
221
+ items: {
222
+ type: 'string',
223
+ },
224
+ minItems: 0,
225
+ type: 'array',
226
+ uniqueItems: true,
227
+ },
228
+ language: {
229
+ description: 'ISO 639 language identifier.',
230
+ examples: ['ada', 'eng', 'bla'],
231
+ pattern: '^[a-z]{2,3}$',
232
+ type: 'string',
233
+ },
234
+ license: {
235
+ anyOf: [
236
+ licenseEnum,
237
+ { type: 'string' },
238
+ {
239
+ type: 'object',
240
+ properties: {
241
+ id: {
242
+ anyOf: [licenseEnum, { type: 'string' }],
243
+ },
244
+ },
245
+ required: ['id'],
246
+ additionalProperties: false,
247
+ },
248
+ ],
249
+ },
250
+ notes: {
251
+ minLength: 0,
252
+ type: 'string',
253
+ },
254
+ partof_pages: {
255
+ type: 'string',
256
+ },
257
+ partof_title: {
258
+ type: 'string',
259
+ },
260
+ publication_date: {
261
+ description:
262
+ 'Format: YYYY-MM-DD. In case your upload was already published elsewhere, please use the date of first publication.',
263
+ examples: ['2013-05-08'],
264
+ format: 'date',
265
+ type: 'string',
266
+ },
267
+ publication_type: {
268
+ enum: [
269
+ 'annotationcollection',
270
+ 'article',
271
+ 'book',
272
+ 'conferencepaper',
273
+ 'datamanagementplan',
274
+ 'deliverable',
275
+ 'milestone',
276
+ 'other',
277
+ 'patent',
278
+ 'preprint',
279
+ 'proposal',
280
+ 'report',
281
+ 'section',
282
+ 'softwaredocumentation',
283
+ 'taxonomictreatment',
284
+ 'technicalnote',
285
+ 'thesis',
286
+ 'workingpaper',
287
+ ],
288
+ type: 'string',
289
+ },
290
+ references: {
291
+ items: {
292
+ type: 'string',
293
+ },
294
+ minItems: 0,
295
+ type: 'array',
296
+ uniqueItems: true,
297
+ },
298
+ related_identifiers: {
299
+ items: {
300
+ additionalProperties: false,
301
+ properties: {
302
+ identifier: {
303
+ type: 'string',
304
+ },
305
+ relation: {
306
+ enum: [
307
+ 'cites',
308
+ 'compiles',
309
+ 'continues',
310
+ 'describes',
311
+ 'documents',
312
+ 'hasMetadata',
313
+ 'hasPart',
314
+ 'hasVersion',
315
+ 'isAlternateIdentifier',
316
+ 'isCitedBy',
317
+ 'isCompiledBy',
318
+ 'isContinuedBy',
319
+ 'isDerivedFrom',
320
+ 'isDescribedBy',
321
+ 'isDocumentedBy',
322
+ 'isIdenticalTo',
323
+ 'isMetadataFor',
324
+ 'isNewVersionOf',
325
+ 'isObsoletedBy',
326
+ 'isOriginalFormOf',
327
+ 'isPartOf',
328
+ 'isPreviousVersionOf',
329
+ 'isPublishedIn',
330
+ 'isReferencedBy',
331
+ 'isRequiredBy',
332
+ 'isReviewedBy',
333
+ 'isSourceOf',
334
+ 'isSupplementedBy',
335
+ 'isSupplementTo',
336
+ 'isVariantFormOf',
337
+ 'isVersionOf',
338
+ 'obsoletes',
339
+ 'references',
340
+ 'requires',
341
+ 'reviews',
342
+ ],
343
+ type: 'string',
344
+ },
345
+ resource_type: {
346
+ enum: [
347
+ 'dataset',
348
+ 'image-diagram',
349
+ 'image-drawing',
350
+ 'image-figure',
351
+ 'image-other',
352
+ 'image-photo',
353
+ 'image-plot',
354
+ 'lesson',
355
+ 'other',
356
+ 'physicalobject',
357
+ 'poster',
358
+ 'presentation',
359
+ 'publication',
360
+ 'publication-annotationcollection',
361
+ 'publication-article',
362
+ 'publication-book',
363
+ 'publication-conferencepaper',
364
+ 'publication-datamanagementplan',
365
+ 'publication-deliverable',
366
+ 'publication-milestone',
367
+ 'publication-other',
368
+ 'publication-patent',
369
+ 'publication-preprint',
370
+ 'publication-proposal',
371
+ 'publication-report',
372
+ 'publication-section',
373
+ 'publication-softwaredocumentation',
374
+ 'publication-taxonomictreatment',
375
+ 'publication-technicalnote',
376
+ 'publication-thesis',
377
+ 'publication-workingpaper',
378
+ 'software',
379
+ 'video',
380
+ ],
381
+ type: 'string',
382
+ },
383
+ scheme: {
384
+ enum: [
385
+ 'ads',
386
+ 'ark',
387
+ 'arxiv',
388
+ 'doi',
389
+ 'ean13',
390
+ 'handle',
391
+ 'isbn',
392
+ 'isni',
393
+ 'issn',
394
+ 'istc',
395
+ 'lsid',
396
+ 'orcid',
397
+ 'pmid',
398
+ 'purl',
399
+ 'url',
400
+ 'urn',
401
+ 'other',
402
+ ],
403
+ type: 'string',
404
+ },
405
+ },
406
+ required: ['identifier', 'relation'],
407
+ type: 'object',
408
+ },
409
+ minItems: 0,
410
+ type: 'array',
411
+ uniqueItems: true,
412
+ },
413
+ resource_type: {
414
+ properties: {
415
+ type: {
416
+ enum: [
417
+ 'dataset',
418
+ 'image-diagram',
419
+ 'image-drawing',
420
+ 'image-figure',
421
+ 'image-other',
422
+ 'image-photo',
423
+ 'image-plot',
424
+ 'lesson',
425
+ 'other',
426
+ 'physicalobject',
427
+ 'poster',
428
+ 'presentation',
429
+ 'publication',
430
+ 'publication-annotationcollection',
431
+ 'publication-article',
432
+ 'publication-book',
433
+ 'publication-conferencepaper',
434
+ 'publication-datamanagementplan',
435
+ 'publication-deliverable',
436
+ 'publication-milestone',
437
+ 'publication-other',
438
+ 'publication-patent',
439
+ 'publication-preprint',
440
+ 'publication-proposal',
441
+ 'publication-report',
442
+ 'publication-section',
443
+ 'publication-softwaredocumentation',
444
+ 'publication-taxonomictreatment',
445
+ 'publication-technicalnote',
446
+ 'publication-thesis',
447
+ 'publication-workingpaper',
448
+ 'software',
449
+ 'video',
450
+ ],
451
+ type: 'string',
452
+ },
453
+ title: {
454
+ type: 'string',
455
+ },
456
+ },
457
+ type: 'object',
458
+ },
459
+ relations: {
460
+ additionalProperties: false,
461
+ properties: {
462
+ version: {
463
+ type: 'array',
464
+ items: {
465
+ type: 'object',
466
+ properties: {
467
+ index: {
468
+ type: 'integer',
469
+ minimum: 0,
470
+ },
471
+ is_last: {
472
+ type: 'boolean',
473
+ },
474
+ parent: {
475
+ type: 'object',
476
+ properties: {
477
+ pid_type: {
478
+ type: 'string',
479
+ },
480
+ pid_value: {
481
+ type: 'string',
482
+ },
483
+ },
484
+ },
485
+ },
486
+ },
487
+ },
488
+ },
489
+ type: 'object',
490
+ },
491
+ subjects: {
492
+ items: {
493
+ additionalProperties: false,
494
+ properties: {
495
+ identifier: {
496
+ type: 'string',
497
+ },
498
+ scheme: {
499
+ enum: [
500
+ 'ads',
501
+ 'ark',
502
+ 'arxiv',
503
+ 'ascl',
504
+ 'bioproject',
505
+ 'biosample',
506
+ 'doi',
507
+ 'ean13',
508
+ 'ean8',
509
+ 'ensembl',
510
+ 'genome',
511
+ 'gnd',
512
+ 'hal',
513
+ 'handle',
514
+ 'isbn',
515
+ 'isni',
516
+ 'issn',
517
+ 'istc',
518
+ 'lsid',
519
+ 'orcid',
520
+ 'pmcid',
521
+ 'pmid',
522
+ 'purl',
523
+ 'refseq',
524
+ 'sra',
525
+ 'swh',
526
+ 'uniprot',
527
+ 'url',
528
+ 'urn',
529
+ ],
530
+ type: 'string',
531
+ },
532
+ term: {
533
+ type: 'string',
534
+ },
535
+ },
536
+ required: ['identifier', 'term'],
537
+ type: 'object',
538
+ },
539
+ minItems: 0,
540
+ type: 'array',
541
+ uniqueItems: true,
542
+ },
543
+ thesis_supervisors: {
544
+ items: {
545
+ additionalProperties: false,
546
+ properties: {
547
+ affiliation: {
548
+ minLength: 1,
549
+ type: ['string', 'null'],
550
+ },
551
+ name: {
552
+ description: 'Family name, given names',
553
+ minLength: 1,
554
+ type: 'string',
555
+ },
556
+ orcid: {
557
+ description: 'ORCID identifier',
558
+ examples: ['0000-0002-1825-0097'],
559
+ pattern: '[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]{1}',
560
+ type: 'string',
561
+ },
562
+ },
563
+ required: ['name'],
564
+ type: 'object',
565
+ },
566
+ minItems: 0,
567
+ type: 'array',
568
+ uniqueItems: true,
569
+ },
570
+ thesis_university: {
571
+ type: 'string',
572
+ },
573
+ title: {
574
+ type: 'string',
575
+ },
576
+ upload_type: {
577
+ enum: [
578
+ 'dataset',
579
+ 'image',
580
+ 'lesson',
581
+ 'other',
582
+ 'physicalobject',
583
+ 'poster',
584
+ 'presentation',
585
+ 'publication',
586
+ 'software',
587
+ 'video',
588
+ ],
589
+ type: 'string',
590
+ },
591
+ version: {
592
+ type: 'string',
593
+ },
594
+ prereserve_doi: {
595
+ type: 'object',
596
+ required: ['doi', 'recid'],
597
+ properties: {
598
+ doi: { type: 'string' },
599
+ recid: { type: 'integer' },
600
+ },
601
+ additionalProperties: false,
602
+ },
603
+ },
604
+ required: [],
605
+ type: 'object',
606
+ } as const;
607
+
608
+ export type ZenodoMetadata = FromSchema<typeof zenodoMetadataSchema>;
@@ -0,0 +1,75 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+
3
+ import { zenodoDepositionSchema } from './ZenodoDepositionSchema.ts';
4
+
5
+ const modifiedDepositionSchema = {
6
+ ...zenodoDepositionSchema,
7
+ additionalProperties: true, // Change this to match the record schema
8
+ properties: {
9
+ ...zenodoDepositionSchema.properties,
10
+ record_id: {
11
+ type: 'integer',
12
+ description: 'Record identifier. Present only for published depositions.',
13
+ },
14
+ },
15
+ } as const;
16
+
17
+ export const zenodoRecordSchema = {
18
+ $schema: 'http://json-schema.org/draft-07/schema#',
19
+ title: 'ZenodoRecord',
20
+ allOf: [
21
+ modifiedDepositionSchema,
22
+ {
23
+ type: 'object',
24
+ required: [],
25
+ properties: {
26
+ recid: { type: 'string' },
27
+ updated: { type: 'string', format: 'date-time' },
28
+ revision: { type: 'number' },
29
+ swh: {
30
+ type: 'object',
31
+ additionalProperties: true, // structure is not known
32
+ },
33
+ owners: {
34
+ type: 'array',
35
+ items: {
36
+ type: 'object',
37
+ properties: {
38
+ id: { type: 'string' },
39
+ },
40
+ required: ['id'],
41
+ additionalProperties: false,
42
+ },
43
+ },
44
+ status: { type: 'string' },
45
+ stats: {
46
+ type: 'object',
47
+ properties: {
48
+ downloads: { type: 'number' },
49
+ unique_downloads: { type: 'number' },
50
+ views: { type: 'number' },
51
+ unique_views: { type: 'number' },
52
+ version_downloads: { type: 'number' },
53
+ version_unique_downloads: { type: 'number' },
54
+ version_views: { type: 'number' },
55
+ version_unique_views: { type: 'number' },
56
+ },
57
+ required: [
58
+ 'downloads',
59
+ 'unique_downloads',
60
+ 'views',
61
+ 'unique_views',
62
+ 'version_downloads',
63
+ 'version_unique_downloads',
64
+ 'version_views',
65
+ 'version_unique_views',
66
+ ],
67
+ additionalProperties: false,
68
+ },
69
+ },
70
+ additionalProperties: true,
71
+ },
72
+ ],
73
+ } as const;
74
+
75
+ export type ZenodoRecord = FromSchema<typeof zenodoRecordSchema>;