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
@@ -1 +0,0 @@
1
- {"version":3,"file":"depositionSchema.d.ts","sourceRoot":"","sources":["../../src/depositions/depositionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4ExB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAejC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -1,138 +0,0 @@
1
- import { z } from 'zod';
2
- import { zenodoFileSchema } from '../ZenodoFile';
3
- const creatorSchema = z.object({
4
- name: z.string(),
5
- affiliation: z.union([z.string().optional(), z.null()]),
6
- orcid: z.string().optional(),
7
- gnd: z.string().optional(),
8
- });
9
- const relatedIdentifierSchema = z.object({
10
- identifier: z.string(),
11
- relation: z.string(),
12
- resource_type: z.string().optional(),
13
- });
14
- const contributorSchema = z.object({
15
- name: z.string(),
16
- type: z.string(),
17
- affiliation: z.string().optional(),
18
- orcid: z.string().optional(),
19
- gnd: z.string().optional(),
20
- });
21
- const communitySchema = z.object({
22
- identifier: z.string(),
23
- });
24
- const grantSchema = z.object({
25
- id: z.string(),
26
- });
27
- const subjectSchema = z.object({
28
- term: z.string(),
29
- identifier: z.string(),
30
- scheme: z.string(),
31
- });
32
- const locationSchema = z.object({
33
- lat: z.number().optional(),
34
- lon: z.number().optional(),
35
- place: z.string(),
36
- description: z.string().optional(),
37
- });
38
- const dateIntervalSchema = z.object({
39
- start: z.string().optional(),
40
- end: z.string().optional(),
41
- type: z.string(),
42
- description: z.string().optional(),
43
- });
44
- // API returns microseconds in timestamps that is not supported for ISO 8601 default validation
45
- const iso8601WithMicroseconds = z
46
- .string()
47
- .refine((value) => !Number.isNaN(Date.parse(value)), {
48
- message: 'Invalid datetime format',
49
- });
50
- const linksSchema = z
51
- .object({
52
- self: z.string().url(),
53
- html: z.string().url(),
54
- badge: z.string().url(),
55
- files: z.string().url(),
56
- latest_draft: z.string().url(),
57
- latest_draft_html: z.string().url(),
58
- publish: z.string().url(),
59
- edit: z.string().url(),
60
- discard: z.string().url(),
61
- newversion: z.string().url(),
62
- registerconceptdoi: z.string().url(),
63
- })
64
- .catchall(z.string().url()); // Allows extra keys with URL values
65
- export const depositionMetadataSchema = z.object({
66
- upload_type: z.enum([
67
- 'publication',
68
- 'poster',
69
- 'presentation',
70
- 'dataset',
71
- 'image',
72
- 'video',
73
- 'software',
74
- 'lesson',
75
- 'physicalobject',
76
- 'other',
77
- ]),
78
- publication_type: z.string().optional(),
79
- image_type: z.string().optional(),
80
- publication_date: z.string().optional(),
81
- title: z.string(),
82
- creators: z.array(creatorSchema),
83
- description: z.string(),
84
- access_right: z.enum(['open', 'embargoed', 'restricted', 'closed']),
85
- license: z.string().optional(),
86
- embargo_date: z.string().optional(),
87
- access_conditions: z.string().optional(),
88
- doi: z.string().optional(),
89
- prereserve_doi: z.union([z.boolean(), z.record(z.unknown())]).optional(),
90
- keywords: z.array(z.string()).optional(),
91
- notes: z.string().optional(),
92
- related_identifiers: z.array(relatedIdentifierSchema).optional(),
93
- contributors: z.array(contributorSchema).optional(),
94
- references: z.array(z.string()).optional(),
95
- communities: z.array(communitySchema).optional(),
96
- grants: z.array(grantSchema).optional(),
97
- journal_title: z.string().optional(),
98
- journal_volume: z.string().optional(),
99
- journal_issue: z.string().optional(),
100
- journal_pages: z.string().optional(),
101
- conference_title: z.string().optional(),
102
- conference_acronym: z.string().optional(),
103
- conference_dates: z.string().optional(),
104
- conference_place: z.string().optional(),
105
- conference_url: z.string().optional(),
106
- conference_session: z.string().optional(),
107
- conference_session_part: z.string().optional(),
108
- imprint_publisher: z.string().optional(),
109
- imprint_isbn: z.string().optional(),
110
- imprint_place: z.string().optional(),
111
- partof_title: z.string().optional(),
112
- partof_pages: z.string().optional(),
113
- thesis_supervisors: z.array(creatorSchema).optional(),
114
- thesis_university: z.string().optional(),
115
- subjects: z.array(subjectSchema).optional(),
116
- version: z.string().optional(),
117
- language: z.string().optional(),
118
- locations: z.array(locationSchema).optional(),
119
- dates: z.array(dateIntervalSchema).optional(),
120
- method: z.string().optional(),
121
- });
122
- export const zenodoDepositionSchema = z.object({
123
- created: iso8601WithMicroseconds, // ISO8601 timestamp
124
- modified: iso8601WithMicroseconds, // ISO8601 timestamp
125
- id: z.number(),
126
- metadata: depositionMetadataSchema,
127
- title: z.string(),
128
- doi: z.string().optional(), // Present only for published depositions
129
- doi_url: z.string().url().optional(), // URL to DOI
130
- record_url: z.string().url().optional(), // URL to public version of record
131
- links: linksSchema,
132
- record_id: z.number().optional(), // Present only for published depositions
133
- owner: z.number(),
134
- files: z.array(zenodoFileSchema),
135
- state: z.enum(['unsubmitted', 'inprogress', 'done', 'error']),
136
- submitted: z.boolean(),
137
- });
138
- //# sourceMappingURL=depositionSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"depositionSchema.js","sourceRoot":"","sources":["../../src/depositions/depositionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,C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,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,uBAAuB,EAAE,oBAAoB;IACtD,QAAQ,EAAE,uBAAuB,EAAE,oBAAoB;IACvD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,QAAQ,EAAE,wBAAwB;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,yCAAyC;IACrE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,aAAa;IACnD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,kCAAkC;IAC3E,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,yCAAyC;IAC3E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7D,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { Zenodo } from './Zenodo';
2
- interface FetchZenodoOptions {
3
- route?: string;
4
- method?: string;
5
- contentType?: string;
6
- expectedStatus?: number;
7
- searchParams?: Record<string, string>;
8
- body?: string | FormData;
9
- }
10
- export declare function fetchZenodo(zenodo: Zenodo, options: FetchZenodoOptions): Promise<Response>;
11
- export {};
12
- //# sourceMappingURL=fetchZenodo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchZenodo.d.ts","sourceRoot":"","sources":["../src/fetchZenodo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC1B;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,qBAwC5E"}
@@ -1,31 +0,0 @@
1
- import { responseStatuses } from './responseStatuses';
2
- export async function fetchZenodo(zenodo, options) {
3
- const { body, route = 'deposit/depositions', method = 'GET', contentType = body instanceof FormData ? undefined : 'application/json', expectedStatus = 200, searchParams, } = options;
4
- let url;
5
- if (searchParams) {
6
- const urlSearchParams = new URLSearchParams(searchParams);
7
- url =
8
- zenodo.baseURL +
9
- route +
10
- (urlSearchParams ? `?${urlSearchParams.toString()}` : '');
11
- }
12
- else {
13
- url = zenodo.baseURL + route;
14
- }
15
- const headers = new Headers({
16
- Authorization: `Bearer ${zenodo.accessToken}`,
17
- });
18
- if (contentType) {
19
- headers.set('Content-Type', contentType);
20
- }
21
- const response = await fetch(url, {
22
- method,
23
- headers,
24
- body,
25
- });
26
- if (response.status !== expectedStatus) {
27
- throw new Error(responseStatuses[response.status]?.description || response.statusText, { cause: { url, method, contentType, body, response } });
28
- }
29
- return response;
30
- }
31
- //# sourceMappingURL=fetchZenodo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchZenodo.js","sourceRoot":"","sources":["../src/fetchZenodo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EA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,EAAE,EAAE,CACxD,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Zenodo';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
package/lib-esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- export * from './Zenodo';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,8 +0,0 @@
1
- interface ResponseStatusInfo {
2
- code: number;
3
- name: string;
4
- description: string;
5
- }
6
- export declare const responseStatuses: Record<number, ResponseStatusInfo>;
7
- export {};
8
- //# sourceMappingURL=responseStatuses.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"responseStatuses.d.ts","sourceRoot":"","sources":["../src/responseStatuses.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CA8E/D,CAAC"}
@@ -1,68 +0,0 @@
1
- export const responseStatuses = {
2
- 200: {
3
- code: 200,
4
- name: 'OK',
5
- description: 'Request succeeded. Response included. Usually sent for GET/PUT/PATCH requests.',
6
- },
7
- 201: {
8
- code: 201,
9
- name: 'Created',
10
- description: 'Request succeeded. Response included. Usually sent for POST requests.',
11
- },
12
- 202: {
13
- code: 202,
14
- name: 'Accepted',
15
- description: 'Request succeeded. Response included. Usually sent for POST requests, where background processing is needed to fulfill the request.',
16
- },
17
- 204: {
18
- code: 204,
19
- name: 'No Content',
20
- description: 'Request succeeded. No response included. Usually sent for DELETE requests.',
21
- },
22
- 400: {
23
- code: 400,
24
- name: 'Bad Request',
25
- description: 'Request failed. Error response included.',
26
- },
27
- 401: {
28
- code: 401,
29
- name: 'Unauthorized',
30
- description: 'Request failed, due to an invalid access token. Error response included.',
31
- },
32
- 403: {
33
- code: 403,
34
- name: 'Forbidden',
35
- description: 'Request failed, due to missing authorization (e.g. deleting an already submitted upload or missing scopes for your access token). Error response included.',
36
- },
37
- 404: {
38
- code: 404,
39
- name: 'Not Found',
40
- description: 'Request failed, due to the resource not being found. Error response included.',
41
- },
42
- 405: {
43
- code: 405,
44
- name: 'Method Not Allowed',
45
- description: 'Request failed, due to unsupported HTTP method. Error response included.',
46
- },
47
- 409: {
48
- code: 409,
49
- name: 'Conflict',
50
- description: 'Request failed, due to the current state of the resource (e.g. edit a deposition which is not fully integrated). Error response included.',
51
- },
52
- 415: {
53
- code: 415,
54
- name: 'Unsupported Media Type',
55
- description: 'Request failed, due to missing or invalid request header Content-Type. Error response included.',
56
- },
57
- 429: {
58
- code: 429,
59
- name: 'Too Many Requests',
60
- description: 'Request failed, due to rate limiting. Error response included.',
61
- },
62
- 500: {
63
- code: 500,
64
- name: 'Internal Server Error',
65
- description: 'Request failed, due to an internal server error. Error response NOT included. Don’t worry, Zenodo admins have been notified and will be dealing with the problem ASAP.',
66
- },
67
- };
68
- //# sourceMappingURL=responseStatuses.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"responseStatuses.js","sourceRoot":"","sources":["../src/responseStatuses.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,gBAAgB,GAAuC;IAClE,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,IAAI;QACV,WAAW,EACT,gFAAgF;KACnF;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,SAAS;QACf,WAAW,EACT,uEAAuE;KAC1E;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,qIAAqI;KACxI;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,4EAA4E;KAC/E;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,0CAA0C;KACxD;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,0EAA0E;KAC7E;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,4JAA4J;KAC/J;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,+EAA+E;KAClF;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,0EAA0E;KAC7E;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,2IAA2I;KAC9I;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,iGAAiG;KACpG;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,gEAAgE;KACnE;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,wKAAwK;KAC3K;CACF,CAAC"}
@@ -1,79 +0,0 @@
1
- /* eslint-disable no-await-in-loop */
2
- /* eslint-disable no-new */
3
- import { test, expect } from 'vitest';
4
-
5
- import { Zenodo } from '../Zenodo';
6
- import type { DepositionMetadata } from '../depositions/depositionSchema';
7
-
8
- import { getConfig } from './getConfig';
9
-
10
- const config = getConfig();
11
-
12
- test('no token', async () => {
13
- expect(() => {
14
- // @ts-expect-error we are testing the error
15
- new Zenodo({
16
- host: 'sandbox.zenodo.org',
17
- });
18
- }).toThrow('accessToken is required');
19
- });
20
-
21
- test('authenticate', async () => {
22
- const zenodo = new Zenodo({
23
- host: 'sandbox.zenodo.org',
24
- accessToken: config.accessToken || '',
25
- });
26
-
27
- const existing = await zenodo.listDepositions();
28
-
29
- const depositionMetadata: DepositionMetadata = {
30
- upload_type: 'dataset',
31
- description: 'test',
32
- access_right: 'open',
33
- title: 'test dataset from npm library zenodo',
34
- creators: [
35
- {
36
- name: 'test',
37
- },
38
- ],
39
- };
40
-
41
- const firstDeposition = await zenodo.createDeposition(depositionMetadata);
42
- // we could attach a file. We need a 'native' web file
43
- const firstFileData = new File(['Hello, world!'], 'example.txt', {
44
- type: 'text/plain',
45
- });
46
- const firstFile = await firstDeposition.createFile(firstFileData);
47
- expect(firstFile.value.filesize).toBe(13);
48
- expect(firstFile.value.checksum).toBe('6cd3556deb0da54bca060b4c39479839');
49
-
50
- const secondFileData = new File(['Hello, world 2!'], 'example2.txt', {
51
- type: 'text/plain',
52
- });
53
- const secondFile = await firstDeposition.createFile(secondFileData);
54
- expect(secondFile.value.filesize).toBe(15);
55
- expect(secondFile.value.checksum).toBe('9500d92e2fa89ecbdc90cd890ca16ed0');
56
-
57
- const files = await firstDeposition.listFiles();
58
- files.sort((a, b) => a.value.filename.localeCompare(b.value.filename));
59
-
60
- expect(files).toHaveLength(2);
61
-
62
- await firstDeposition.deleteFile(files[1].value.id);
63
- const filesAfterDelete = await firstDeposition.listFiles();
64
- expect(filesAfterDelete).toHaveLength(1);
65
-
66
- const retrievedFile = await firstDeposition.retrieveFile(files[0].value.id);
67
- expect(retrievedFile.value.filename).toBe('example.txt');
68
-
69
- const content = await retrievedFile
70
- .getContentResponse()
71
- .then((response) => response.text());
72
-
73
- expect(content).toBe('Hello, world!');
74
-
75
- // we delete everything
76
- for (const deposition of existing) {
77
- await zenodo.deleteDeposition(deposition.value.id);
78
- }
79
- });
@@ -1,9 +0,0 @@
1
- import dotenv from 'dotenv';
2
-
3
- dotenv.config();
4
-
5
- export function getConfig(): { accessToken?: string } {
6
- return {
7
- accessToken: process.env.ACCESS_TOKEN,
8
- };
9
- }
@@ -1,154 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- import { zenodoFileSchema } from '../ZenodoFile';
4
-
5
- const creatorSchema = z.object({
6
- name: z.string(),
7
- affiliation: z.union([z.string().optional(), z.null()]),
8
- orcid: z.string().optional(),
9
- gnd: z.string().optional(),
10
- });
11
-
12
- const relatedIdentifierSchema = z.object({
13
- identifier: z.string(),
14
- relation: z.string(),
15
- resource_type: z.string().optional(),
16
- });
17
-
18
- const contributorSchema = z.object({
19
- name: z.string(),
20
- type: z.string(),
21
- affiliation: z.string().optional(),
22
- orcid: z.string().optional(),
23
- gnd: z.string().optional(),
24
- });
25
-
26
- const communitySchema = z.object({
27
- identifier: z.string(),
28
- });
29
-
30
- const grantSchema = z.object({
31
- id: z.string(),
32
- });
33
-
34
- const subjectSchema = z.object({
35
- term: z.string(),
36
- identifier: z.string(),
37
- scheme: z.string(),
38
- });
39
-
40
- const locationSchema = z.object({
41
- lat: z.number().optional(),
42
- lon: z.number().optional(),
43
- place: z.string(),
44
- description: z.string().optional(),
45
- });
46
-
47
- const dateIntervalSchema = z.object({
48
- start: z.string().optional(),
49
- end: z.string().optional(),
50
- type: z.string(),
51
- description: z.string().optional(),
52
- });
53
-
54
- // API returns microseconds in timestamps that is not supported for ISO 8601 default validation
55
- const iso8601WithMicroseconds = z
56
- .string()
57
- .refine((value) => !Number.isNaN(Date.parse(value)), {
58
- message: 'Invalid datetime format',
59
- });
60
-
61
- const linksSchema = z
62
- .object({
63
- self: z.string().url(),
64
- html: z.string().url(),
65
- badge: z.string().url(),
66
- files: z.string().url(),
67
- latest_draft: z.string().url(),
68
- latest_draft_html: z.string().url(),
69
- publish: z.string().url(),
70
- edit: z.string().url(),
71
- discard: z.string().url(),
72
- newversion: z.string().url(),
73
- registerconceptdoi: z.string().url(),
74
- })
75
- .catchall(z.string().url()); // Allows extra keys with URL values
76
-
77
- export const depositionMetadataSchema = z.object({
78
- upload_type: z.enum([
79
- 'publication',
80
- 'poster',
81
- 'presentation',
82
- 'dataset',
83
- 'image',
84
- 'video',
85
- 'software',
86
- 'lesson',
87
- 'physicalobject',
88
- 'other',
89
- ]),
90
- publication_type: z.string().optional(),
91
- image_type: z.string().optional(),
92
- publication_date: z.string().optional(),
93
- title: z.string(),
94
- creators: z.array(creatorSchema),
95
- description: z.string(),
96
- access_right: z.enum(['open', 'embargoed', 'restricted', 'closed']),
97
- license: z.string().optional(),
98
- embargo_date: z.string().optional(),
99
- access_conditions: z.string().optional(),
100
- doi: z.string().optional(),
101
- prereserve_doi: z.union([z.boolean(), z.record(z.unknown())]).optional(),
102
- keywords: z.array(z.string()).optional(),
103
- notes: z.string().optional(),
104
- related_identifiers: z.array(relatedIdentifierSchema).optional(),
105
- contributors: z.array(contributorSchema).optional(),
106
- references: z.array(z.string()).optional(),
107
- communities: z.array(communitySchema).optional(),
108
- grants: z.array(grantSchema).optional(),
109
- journal_title: z.string().optional(),
110
- journal_volume: z.string().optional(),
111
- journal_issue: z.string().optional(),
112
- journal_pages: z.string().optional(),
113
- conference_title: z.string().optional(),
114
- conference_acronym: z.string().optional(),
115
- conference_dates: z.string().optional(),
116
- conference_place: z.string().optional(),
117
- conference_url: z.string().optional(),
118
- conference_session: z.string().optional(),
119
- conference_session_part: z.string().optional(),
120
- imprint_publisher: z.string().optional(),
121
- imprint_isbn: z.string().optional(),
122
- imprint_place: z.string().optional(),
123
- partof_title: z.string().optional(),
124
- partof_pages: z.string().optional(),
125
- thesis_supervisors: z.array(creatorSchema).optional(),
126
- thesis_university: z.string().optional(),
127
- subjects: z.array(subjectSchema).optional(),
128
- version: z.string().optional(),
129
- language: z.string().optional(),
130
- locations: z.array(locationSchema).optional(),
131
- dates: z.array(dateIntervalSchema).optional(),
132
- method: z.string().optional(),
133
- });
134
-
135
- export type DepositionMetadata = z.infer<typeof depositionMetadataSchema>;
136
-
137
- export const zenodoDepositionSchema = z.object({
138
- created: iso8601WithMicroseconds, // ISO8601 timestamp
139
- modified: iso8601WithMicroseconds, // ISO8601 timestamp
140
- id: z.number(),
141
- metadata: depositionMetadataSchema,
142
- title: z.string(),
143
- doi: z.string().optional(), // Present only for published depositions
144
- doi_url: z.string().url().optional(), // URL to DOI
145
- record_url: z.string().url().optional(), // URL to public version of record
146
- links: linksSchema,
147
- record_id: z.number().optional(), // Present only for published depositions
148
- owner: z.number(),
149
- files: z.array(zenodoFileSchema),
150
- state: z.enum(['unsubmitted', 'inprogress', 'done', 'error']),
151
- submitted: z.boolean(),
152
- });
153
-
154
- export type ZenodoDeposition = z.infer<typeof zenodoDepositionSchema>;