@openneuro/server 4.47.7 → 5.0.0-alpha.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 (45) hide show
  1. package/package.json +10 -7
  2. package/src/app.ts +1 -1
  3. package/src/cache/__tests__/tree.spec.ts +212 -0
  4. package/src/cache/tree.ts +148 -0
  5. package/src/datalad/__tests__/dataRetentionNotifications.spec.ts +11 -0
  6. package/src/datalad/__tests__/files.spec.ts +249 -0
  7. package/src/datalad/dataRetentionNotifications.ts +5 -0
  8. package/src/datalad/dataset.ts +29 -1
  9. package/src/datalad/files.ts +362 -39
  10. package/src/datalad/snapshots.ts +29 -54
  11. package/src/graphql/resolvers/__tests__/response-status.spec.ts +42 -0
  12. package/src/graphql/resolvers/build-search-query.ts +391 -0
  13. package/src/graphql/resolvers/cache.ts +5 -1
  14. package/src/graphql/resolvers/dataset-search.ts +40 -23
  15. package/src/graphql/resolvers/datasetEvents.ts +48 -78
  16. package/src/graphql/resolvers/draft.ts +5 -2
  17. package/src/graphql/resolvers/holdDeletion.ts +21 -0
  18. package/src/graphql/resolvers/index.ts +6 -0
  19. package/src/graphql/resolvers/mutation.ts +2 -0
  20. package/src/graphql/resolvers/response-status.ts +43 -0
  21. package/src/graphql/resolvers/snapshots.ts +9 -18
  22. package/src/graphql/resolvers/summary.ts +17 -0
  23. package/src/graphql/schema.ts +54 -14
  24. package/src/handlers/datalad.ts +4 -0
  25. package/src/handlers/doi.ts +32 -36
  26. package/src/libs/doi/__tests__/doi.spec.ts +50 -12
  27. package/src/libs/doi/__tests__/validate.spec.ts +110 -0
  28. package/src/libs/doi/index.ts +108 -71
  29. package/src/libs/doi/metadata.ts +101 -0
  30. package/src/libs/doi/validate.ts +59 -0
  31. package/src/libs/presign.ts +137 -0
  32. package/src/models/dataset.ts +2 -0
  33. package/src/models/doi.ts +7 -0
  34. package/src/queues/producer-methods.ts +9 -5
  35. package/src/queues/queue-schedule.ts +1 -1
  36. package/src/queues/queues.ts +2 -2
  37. package/src/routes.ts +10 -2
  38. package/src/types/datacite/LICENSE +37 -0
  39. package/src/types/datacite/README.md +3 -0
  40. package/src/types/datacite/datacite-v4.5.json +643 -0
  41. package/src/types/datacite/datacite-v4.5.ts +281 -0
  42. package/src/types/datacite.ts +53 -63
  43. package/src/utils/datacite-mapper.ts +7 -3
  44. package/src/utils/datacite-utils.ts +12 -15
  45. package/src/libs/doi/__tests__/__snapshots__/doi.spec.ts.snap +0 -17
@@ -0,0 +1,643 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2019-09/schema#",
3
+ "id": "datacite-v4.5.json",
4
+ "title": "DataCite v4.5",
5
+ "description": "JSON representation of the DataCite v4.5 schema.",
6
+ "additionalProperties": false,
7
+ "definitions": {
8
+ "nameType": {
9
+ "type": "string",
10
+ "enum": [
11
+ "Organizational",
12
+ "Personal"
13
+ ]
14
+ },
15
+ "nameIdentifiers": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "properties": {
21
+ "nameIdentifier": { "type": "string" },
22
+ "nameIdentifierScheme": { "type": "string" },
23
+ "schemeUri": { "type": "string", "format": "uri" }
24
+ },
25
+ "required": ["nameIdentifier", "nameIdentifierScheme"]
26
+ },
27
+ "uniqueItems": true
28
+ },
29
+ "affiliation": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "properties": {
35
+ "name": { "type": "string" },
36
+ "affiliationIdentifier": { "type": "string" },
37
+ "affiliationIdentifierScheme": { "type": "string" },
38
+ "schemeUri": { "type": "string", "format": "uri" }
39
+ },
40
+ "required": ["name"]
41
+ },
42
+ "uniqueItems": true
43
+ },
44
+ "person": {
45
+ "type": "object",
46
+ "properties": {
47
+ "name": { "type": "string" },
48
+ "nameType": { "$ref": "#/definitions/nameType" },
49
+ "givenName": { "type": "string" },
50
+ "familyName": { "type": "string" },
51
+ "nameIdentifiers": { "$ref": "#/definitions/nameIdentifiers" },
52
+ "affiliation": { "$ref": "#/definitions/affiliation" },
53
+ "lang": { "type": "string" }
54
+ },
55
+ "required": ["name"]
56
+ },
57
+ "creator": {
58
+ "type": "object",
59
+ "allOf": [{ "$ref": "#/definitions/person" }],
60
+ "unevaluatedProperties": false
61
+ },
62
+ "contributor": {
63
+ "type": "object",
64
+ "allOf": [{ "$ref": "#/definitions/person" }],
65
+ "unevaluatedProperties": false,
66
+ "properties": {
67
+ "contributorType": { "$ref": "#/definitions/contributorType" }
68
+ },
69
+ "required": ["name", "contributorType"]
70
+ },
71
+ "contributorType": {
72
+ "type": "string",
73
+ "enum": [
74
+ "ContactPerson",
75
+ "DataCollector",
76
+ "DataCurator",
77
+ "DataManager",
78
+ "Distributor",
79
+ "Editor",
80
+ "HostingInstitution",
81
+ "Producer",
82
+ "ProjectLeader",
83
+ "ProjectManager",
84
+ "ProjectMember",
85
+ "RegistrationAgency",
86
+ "RegistrationAuthority",
87
+ "RelatedPerson",
88
+ "Researcher",
89
+ "ResearchGroup",
90
+ "RightsHolder",
91
+ "Sponsor",
92
+ "Supervisor",
93
+ "WorkPackageLeader",
94
+ "Other"
95
+ ]
96
+ },
97
+ "titleType": {
98
+ "type": "string",
99
+ "enum": [
100
+ "AlternativeTitle",
101
+ "Subtitle",
102
+ "TranslatedTitle",
103
+ "Other"
104
+ ]
105
+ },
106
+ "longitude": {
107
+ "type": "number",
108
+ "maximum": 180,
109
+ "minimum": -180
110
+ },
111
+ "latitude": {
112
+ "type": "number",
113
+ "maximum": 90,
114
+ "minimum": -90
115
+ },
116
+ "date": {
117
+ "type": "string",
118
+ "anyOf": [
119
+ { "format": "year" },
120
+ { "format": "yearmonth" },
121
+ { "format": "date" },
122
+ { "format": "datetime" },
123
+ { "format": "year-range" },
124
+ { "format": "yearmonth-range" },
125
+ { "format": "date-range" },
126
+ { "format": "datetime-range" }
127
+ ]
128
+ },
129
+ "dateType": {
130
+ "type": "string",
131
+ "enum": [
132
+ "Accepted",
133
+ "Available",
134
+ "Copyrighted",
135
+ "Collected",
136
+ "Created",
137
+ "Issued",
138
+ "Submitted",
139
+ "Updated",
140
+ "Valid",
141
+ "Withdrawn",
142
+ "Other"
143
+ ]
144
+ },
145
+ "resourceTypeGeneral": {
146
+ "type": "string",
147
+ "enum": [
148
+ "Audiovisual",
149
+ "Book",
150
+ "BookChapter",
151
+ "Collection",
152
+ "ComputationalNotebook",
153
+ "ConferencePaper",
154
+ "ConferenceProceeding",
155
+ "DataPaper",
156
+ "Dataset",
157
+ "Dissertation",
158
+ "Event",
159
+ "Image",
160
+ "Instrument",
161
+ "InteractiveResource",
162
+ "Journal",
163
+ "JournalArticle",
164
+ "Model",
165
+ "OutputManagementPlan",
166
+ "PeerReview",
167
+ "PhysicalObject",
168
+ "Preprint",
169
+ "Report",
170
+ "Service",
171
+ "Software",
172
+ "Sound",
173
+ "Standard",
174
+ "StudyRegistration",
175
+ "Text",
176
+ "Workflow",
177
+ "Other"
178
+ ]
179
+ },
180
+ "relatedIdentifierType": {
181
+ "type": "string",
182
+ "enum": [
183
+ "ARK",
184
+ "arXiv",
185
+ "bibcode",
186
+ "DOI",
187
+ "EAN13",
188
+ "EISSN",
189
+ "Handle",
190
+ "IGSN",
191
+ "ISBN",
192
+ "ISSN",
193
+ "ISTC",
194
+ "LISSN",
195
+ "LSID",
196
+ "PMID",
197
+ "PURL",
198
+ "UPC",
199
+ "URL",
200
+ "URN",
201
+ "w3id"
202
+ ]
203
+ },
204
+ "relationType": {
205
+ "type": "string",
206
+ "enum": [
207
+ "IsCitedBy",
208
+ "Cites",
209
+ "IsCollectedBy",
210
+ "Collects",
211
+ "IsSupplementTo",
212
+ "IsSupplementedBy",
213
+ "IsContinuedBy",
214
+ "Continues",
215
+ "IsDescribedBy",
216
+ "Describes",
217
+ "HasMetadata",
218
+ "IsMetadataFor",
219
+ "HasVersion",
220
+ "IsVersionOf",
221
+ "IsNewVersionOf",
222
+ "IsPartOf",
223
+ "IsPreviousVersionOf",
224
+ "IsPublishedIn",
225
+ "HasPart",
226
+ "IsReferencedBy",
227
+ "References",
228
+ "IsDocumentedBy",
229
+ "Documents",
230
+ "IsCompiledBy",
231
+ "Compiles",
232
+ "IsVariantFormOf",
233
+ "IsOriginalFormOf",
234
+ "IsIdenticalTo",
235
+ "IsReviewedBy",
236
+ "Reviews",
237
+ "IsDerivedFrom",
238
+ "IsSourceOf",
239
+ "IsRequiredBy",
240
+ "Requires",
241
+ "IsObsoletedBy",
242
+ "Obsoletes"
243
+ ]
244
+ },
245
+ "relatedObject": {
246
+ "type": "object",
247
+ "properties": {
248
+ "relationType": { "$ref": "#/definitions/relationType" },
249
+ "relatedMetadataScheme": { "type": "string" },
250
+ "schemeUri": { "type": "string", "format": "uri" },
251
+ "schemeType": { "type": "string" },
252
+ "resourceTypeGeneral": { "$ref": "#/definitions/resourceTypeGeneral" }
253
+ },
254
+ "required": ["relationType"]
255
+ },
256
+ "relatedObjectIf": {
257
+ "properties": {
258
+ "relationType": { "enum": ["HasMetadata", "IsMetadataFor"] }
259
+ }
260
+ },
261
+ "relatedObjectElse": {
262
+ "$comment": "these properties may only be used with relation types HasMetadata/IsMetadataFor",
263
+ "properties": {
264
+ "relatedMetadataScheme": false,
265
+ "schemeUri": false,
266
+ "schemeType": false
267
+ }
268
+ },
269
+ "descriptionType": {
270
+ "type": "string",
271
+ "enum": [
272
+ "Abstract",
273
+ "Methods",
274
+ "SeriesInformation",
275
+ "TableOfContents",
276
+ "TechnicalInfo",
277
+ "Other"
278
+ ]
279
+ },
280
+ "geoLocationPoint": {
281
+ "type": "object",
282
+ "additionalProperties": false,
283
+ "properties": {
284
+ "pointLongitude": { "$ref": "#/definitions/longitude" },
285
+ "pointLatitude": { "$ref": "#/definitions/latitude" }
286
+ },
287
+ "required": ["pointLongitude", "pointLatitude"]
288
+ },
289
+ "funderIdentifierType": {
290
+ "type": "string",
291
+ "enum": [
292
+ "ISNI",
293
+ "GRID",
294
+ "Crossref Funder ID",
295
+ "ROR",
296
+ "Other"
297
+ ]
298
+ },
299
+ "publicationYear": {
300
+ "type": "string",
301
+ "pattern": "^[0-9]{4}$"
302
+ }
303
+ },
304
+ "type": "object",
305
+ "properties": {
306
+ "doi": { "type": "string", "pattern": "^10[.][0-9]{4,9}[/][^\\s]+$" },
307
+ "prefix": { "type": "string", "pattern": "^10[.][0-9]{4,9}$" },
308
+ "suffix": { "type": "string", "pattern": "^[^\\s]+$" },
309
+ "event": {
310
+ "type": "string",
311
+ "enum": [
312
+ "hide",
313
+ "register",
314
+ "publish"
315
+ ]
316
+ },
317
+ "url": { "type": "string", "format": "uri" },
318
+ "types": {
319
+ "type": "object",
320
+ "additionalProperties": false,
321
+ "properties": {
322
+ "resourceType": { "type": "string" },
323
+ "resourceTypeGeneral": { "$ref": "#/definitions/resourceTypeGeneral" }
324
+ },
325
+ "required": ["resourceTypeGeneral"]
326
+ },
327
+ "creators": {
328
+ "type": "array",
329
+ "items": {
330
+ "type": "object",
331
+ "allOf": [{ "$ref": "#/definitions/creator" }],
332
+ "required": ["name"]
333
+ },
334
+ "minItems": 1
335
+ },
336
+ "titles": {
337
+ "type": "array",
338
+ "items": {
339
+ "type": "object",
340
+ "additionalProperties": false,
341
+ "properties": {
342
+ "title": { "type": "string" },
343
+ "titleType": { "$ref": "#/definitions/titleType" },
344
+ "lang": { "type": "string" }
345
+ },
346
+ "required": ["title"]
347
+ },
348
+ "minItems": 1,
349
+ "uniqueItems": true
350
+ },
351
+ "publisher": {
352
+ "type": "object",
353
+ "additionalProperties": false,
354
+ "properties": {
355
+ "name": { "type": "string" },
356
+ "publisherIdentifier": { "type": "string" },
357
+ "publisherIdentifierScheme": { "type": "string" },
358
+ "schemeUri": { "type": "string", "format": "uri" },
359
+ "lang": { "type": "string" }
360
+ },
361
+ "required": ["name"]
362
+ },
363
+ "publicationYear": { "$ref": "#/definitions/publicationYear" },
364
+ "subjects": {
365
+ "type": "array",
366
+ "items": {
367
+ "type": "object",
368
+ "additionalProperties": false,
369
+ "properties": {
370
+ "subject": { "type": "string" },
371
+ "subjectScheme": { "type": "string" },
372
+ "schemeUri": { "type": "string", "format": "uri" },
373
+ "valueUri": { "type": "string", "format": "uri" },
374
+ "classificationCode": { "type": "string" },
375
+ "lang": { "type": "string" }
376
+ },
377
+ "required": ["subject"]
378
+ },
379
+ "uniqueItems": true
380
+ },
381
+ "contributors": {
382
+ "type": "array",
383
+ "items": {
384
+ "type": "object",
385
+ "allOf": [{ "$ref": "#/definitions/contributor" }],
386
+ "required": ["contributorType", "name"]
387
+ }
388
+ },
389
+ "dates": {
390
+ "type": "array",
391
+ "items": {
392
+ "type": "object",
393
+ "additionalProperties": false,
394
+ "properties": {
395
+ "date": { "$ref": "#/definitions/date" },
396
+ "dateType": { "$ref": "#/definitions/dateType" },
397
+ "dateInformation": { "type": "string" }
398
+ },
399
+ "required": ["date", "dateType"]
400
+ },
401
+ "uniqueItems": true
402
+ },
403
+ "language": {
404
+ "type": "string",
405
+ "$comment": "Primary language of the resource. Allowed values are taken from IETF BCP 47, ISO 639-1 language codes."
406
+ },
407
+ "alternateIdentifiers": {
408
+ "type": "array",
409
+ "items": {
410
+ "type": "object",
411
+ "additionalProperties": false,
412
+ "properties": {
413
+ "alternateIdentifier": { "type": "string" },
414
+ "alternateIdentifierType": { "type": "string" }
415
+ },
416
+ "required": ["alternateIdentifier", "alternateIdentifierType"]
417
+ },
418
+ "uniqueItems": true
419
+ },
420
+ "relatedIdentifiers": {
421
+ "type": "array",
422
+ "items": {
423
+ "type": "object",
424
+ "allOf": [{ "$ref": "#/definitions/relatedObject" }],
425
+ "unevaluatedProperties": false,
426
+ "properties": {
427
+ "relatedIdentifier": { "type": "string" },
428
+ "relatedIdentifierType": {
429
+ "$ref": "#/definitions/relatedIdentifierType"
430
+ }
431
+ },
432
+ "required": [
433
+ "relatedIdentifier",
434
+ "relatedIdentifierType",
435
+ "relationType"
436
+ ],
437
+ "if": { "$ref": "#/definitions/relatedObjectIf" },
438
+ "else": { "$ref": "#/definitions/relatedObjectElse" }
439
+ }
440
+ },
441
+ "relatedItems": {
442
+ "type": "array",
443
+ "items": {
444
+ "type": "object",
445
+ "allOf": [{ "$ref": "#/definitions/relatedObject" }],
446
+ "unevaluatedProperties": false,
447
+ "properties": {
448
+ "relatedItemIdentifier": {
449
+ "type": "object",
450
+ "additionalProperties": false,
451
+ "properties": {
452
+ "relatedItemIdentifier": { "type": "string" },
453
+ "relatedItemIdentifierType": {
454
+ "$ref": "#/definitions/relatedIdentifierType"
455
+ }
456
+ },
457
+ "required": ["relatedItemIdentifier", "relatedItemIdentifierType"]
458
+ },
459
+ "relatedItemType": { "$ref": "#/definitions/resourceTypeGeneral" },
460
+ "creators": {
461
+ "type": "array",
462
+ "items": {
463
+ "type": "object",
464
+ "unevaluatedProperties": false,
465
+ "allOf": [{ "$ref": "#/definitions/creator" }],
466
+ "required": ["name"]
467
+ }
468
+ },
469
+ "contributors": {
470
+ "type": "array",
471
+ "items": {
472
+ "type": "object",
473
+ "unevaluatedProperties": false,
474
+ "allOf": [{ "$ref": "#/definitions/contributor" }],
475
+ "required": ["contributorType", "name"]
476
+ }
477
+ },
478
+ "titles": {
479
+ "type": "array",
480
+ "items": {
481
+ "type": "object",
482
+ "additionalProperties": false,
483
+ "properties": {
484
+ "title": { "type": "string" },
485
+ "titleType": { "$ref": "#/definitions/titleType" },
486
+ "lang": { "type": "string" }
487
+ },
488
+ "required": ["title"]
489
+ },
490
+ "minItems": 1,
491
+ "uniqueItems": true
492
+ },
493
+ "publicationYear": { "$ref": "#/definitions/publicationYear" },
494
+ "volume": { "type": "string" },
495
+ "issue": { "type": "string" },
496
+ "firstPage": { "type": "string" },
497
+ "lastPage": { "type": "string" },
498
+ "edition": { "type": "string" },
499
+ "publisher": { "type": "string" },
500
+ "number": { "type": "string" },
501
+ "numberType": {
502
+ "type": "string",
503
+ "enum": [
504
+ "Article",
505
+ "Chapter",
506
+ "Report",
507
+ "Other"
508
+ ]
509
+ }
510
+ },
511
+ "required": ["titles", "relatedItemType", "relationType"],
512
+ "if": { "$ref": "#/definitions/relatedObjectIf" },
513
+ "else": { "$ref": "#/definitions/relatedObjectElse" }
514
+ },
515
+ "uniqueItems": true
516
+ },
517
+ "sizes": {
518
+ "type": "array",
519
+ "items": {
520
+ "type": "string"
521
+ },
522
+ "uniqueItems": true
523
+ },
524
+ "formats": {
525
+ "type": "array",
526
+ "items": {
527
+ "type": "string"
528
+ },
529
+ "uniqueItems": true
530
+ },
531
+ "version": {
532
+ "type": "string"
533
+ },
534
+ "rightsList": {
535
+ "type": "array",
536
+ "items": {
537
+ "type": "object",
538
+ "additionalProperties": false,
539
+ "properties": {
540
+ "rights": { "type": "string" },
541
+ "rightsUri": { "type": "string", "format": "uri" },
542
+ "rightsIdentifier": { "type": "string" },
543
+ "rightsIdentifierScheme": { "type": "string" },
544
+ "schemeUri": { "type": "string", "format": "uri" },
545
+ "lang": { "type": "string" }
546
+ }
547
+ },
548
+ "uniqueItems": true
549
+ },
550
+ "descriptions": {
551
+ "type": "array",
552
+ "items": {
553
+ "type": "object",
554
+ "additionalProperties": false,
555
+ "properties": {
556
+ "description": { "type": "string" },
557
+ "descriptionType": { "$ref": "#/definitions/descriptionType" },
558
+ "lang": { "type": "string" }
559
+ },
560
+ "required": ["description", "descriptionType"]
561
+ },
562
+ "uniqueItems": true
563
+ },
564
+ "geoLocations": {
565
+ "type": "array",
566
+ "items": {
567
+ "type": "object",
568
+ "additionalProperties": false,
569
+ "properties": {
570
+ "geoLocationPlace": { "type": "string" },
571
+ "geoLocationPoint": { "$ref": "#/definitions/geoLocationPoint" },
572
+ "geoLocationBox": {
573
+ "type": "object",
574
+ "additionalProperties": false,
575
+ "properties": {
576
+ "westBoundLongitude": { "$ref": "#/definitions/longitude" },
577
+ "eastBoundLongitude": { "$ref": "#/definitions/longitude" },
578
+ "southBoundLatitude": { "$ref": "#/definitions/latitude" },
579
+ "northBoundLatitude": { "$ref": "#/definitions/latitude" }
580
+ },
581
+ "required": [
582
+ "westBoundLongitude",
583
+ "eastBoundLongitude",
584
+ "southBoundLatitude",
585
+ "northBoundLatitude"
586
+ ]
587
+ },
588
+ "geoLocationPolygon": {
589
+ "type": "array",
590
+ "items": {
591
+ "type": "object",
592
+ "additionalProperties": false,
593
+ "properties": {
594
+ "polygonPoint": { "$ref": "#/definitions/geoLocationPoint" },
595
+ "inPolygonPoint": { "$ref": "#/definitions/geoLocationPoint" }
596
+ }
597
+ }
598
+ }
599
+ }
600
+ },
601
+ "uniqueItems": true
602
+ },
603
+ "fundingReferences": {
604
+ "type": "array",
605
+ "items": {
606
+ "type": "object",
607
+ "additionalProperties": false,
608
+ "properties": {
609
+ "funderName": { "type": "string" },
610
+ "funderIdentifier": { "type": "string" },
611
+ "funderIdentifierType": {
612
+ "$ref": "#/definitions/funderIdentifierType"
613
+ },
614
+ "awardNumber": { "type": "string" },
615
+ "awardUri": { "type": "string", "format": "uri" },
616
+ "awardTitle": { "type": "string" }
617
+ },
618
+ "required": ["funderName"]
619
+ },
620
+ "uniqueItems": true
621
+ },
622
+ "schemaVersion": {
623
+ "type": "string",
624
+ "const": "http://datacite.org/schema/kernel-4"
625
+ },
626
+ "container": {
627
+ "type": "object",
628
+ "properties": {
629
+ "type": { "type": "string" },
630
+ "title": { "type": "string" },
631
+ "firstPage": { "type": "string" }
632
+ }
633
+ }
634
+ },
635
+ "required": [
636
+ "creators",
637
+ "titles",
638
+ "publisher",
639
+ "publicationYear",
640
+ "types",
641
+ "schemaVersion"
642
+ ]
643
+ }