zenodo 1.0.1 → 2.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.
- package/README.md +48 -0
- package/lib/Zenodo.d.ts +19 -0
- package/lib/Zenodo.d.ts.map +1 -0
- package/lib/Zenodo.js +55 -0
- package/lib/Zenodo.js.map +1 -0
- package/lib/ZenodoFile.d.ts +45 -0
- package/lib/ZenodoFile.d.ts.map +1 -0
- package/lib/ZenodoFile.js +37 -0
- package/lib/ZenodoFile.js.map +1 -0
- package/lib/depositions/Deposition.d.ts +14 -0
- package/lib/depositions/Deposition.d.ts.map +1 -0
- package/lib/depositions/Deposition.js +55 -0
- package/lib/depositions/Deposition.js.map +1 -0
- package/lib/depositions/ListDepositionsOptions.d.ts +32 -0
- package/lib/depositions/ListDepositionsOptions.d.ts.map +1 -0
- package/lib/depositions/ListDepositionsOptions.js +3 -0
- package/lib/depositions/ListDepositionsOptions.js.map +1 -0
- package/lib/depositions/depositionSchema.d.ts +982 -0
- package/lib/depositions/depositionSchema.d.ts.map +1 -0
- package/lib/depositions/depositionSchema.js +141 -0
- package/lib/depositions/depositionSchema.js.map +1 -0
- package/lib/fetchZenodo.d.ts +12 -0
- package/lib/fetchZenodo.d.ts.map +1 -0
- package/lib/fetchZenodo.js +34 -0
- package/lib/fetchZenodo.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/responseStatuses.d.ts +8 -0
- package/lib/responseStatuses.d.ts.map +1 -0
- package/lib/responseStatuses.js +71 -0
- package/lib/responseStatuses.js.map +1 -0
- package/lib-esm/Zenodo.d.ts +19 -0
- package/lib-esm/Zenodo.d.ts.map +1 -0
- package/lib-esm/Zenodo.js +51 -0
- package/lib-esm/Zenodo.js.map +1 -0
- package/lib-esm/ZenodoFile.d.ts +45 -0
- package/lib-esm/ZenodoFile.d.ts.map +1 -0
- package/lib-esm/ZenodoFile.js +33 -0
- package/lib-esm/ZenodoFile.js.map +1 -0
- package/lib-esm/depositions/Deposition.d.ts +14 -0
- package/lib-esm/depositions/Deposition.d.ts.map +1 -0
- package/lib-esm/depositions/Deposition.js +51 -0
- package/lib-esm/depositions/Deposition.js.map +1 -0
- package/lib-esm/depositions/ListDepositionsOptions.d.ts +32 -0
- package/lib-esm/depositions/ListDepositionsOptions.d.ts.map +1 -0
- package/lib-esm/depositions/ListDepositionsOptions.js +2 -0
- package/lib-esm/depositions/ListDepositionsOptions.js.map +1 -0
- package/lib-esm/depositions/depositionSchema.d.ts +982 -0
- package/lib-esm/depositions/depositionSchema.d.ts.map +1 -0
- package/lib-esm/depositions/depositionSchema.js +138 -0
- package/lib-esm/depositions/depositionSchema.js.map +1 -0
- package/lib-esm/fetchZenodo.d.ts +12 -0
- package/lib-esm/fetchZenodo.d.ts.map +1 -0
- package/lib-esm/fetchZenodo.js +31 -0
- package/lib-esm/fetchZenodo.js.map +1 -0
- package/lib-esm/index.d.ts +2 -0
- package/lib-esm/index.d.ts.map +1 -0
- package/lib-esm/index.js +2 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/responseStatuses.d.ts +8 -0
- package/lib-esm/responseStatuses.d.ts.map +1 -0
- package/lib-esm/responseStatuses.js +68 -0
- package/lib-esm/responseStatuses.js.map +1 -0
- package/package.json +36 -7
- package/src/Zenodo.ts +68 -0
- package/src/ZenodoFile.ts +40 -0
- package/src/__tests__/Zenodo.test.ts +79 -0
- package/src/__tests__/getConfig.ts +9 -0
- package/src/depositions/Deposition.ts +60 -0
- package/src/depositions/ListDepositionsOptions.ts +36 -0
- package/src/depositions/depositionSchema.ts +154 -0
- package/src/fetchZenodo.ts +53 -0
- package/src/index.ts +1 -0
- package/src/responseStatuses.ts +85 -0
- package/History.md +0 -66
- package/src/index.js +0 -170
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"depositionSchema.d.ts","sourceRoot":"","sources":["../../src/depositions/depositionS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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAejC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.zenodoDepositionSchema = exports.depositionMetadataSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ZenodoFile_1 = require("../ZenodoFile");
|
|
6
|
+
const creatorSchema = zod_1.z.object({
|
|
7
|
+
name: zod_1.z.string(),
|
|
8
|
+
affiliation: zod_1.z.union([zod_1.z.string().optional(), zod_1.z.null()]),
|
|
9
|
+
orcid: zod_1.z.string().optional(),
|
|
10
|
+
gnd: zod_1.z.string().optional(),
|
|
11
|
+
});
|
|
12
|
+
const relatedIdentifierSchema = zod_1.z.object({
|
|
13
|
+
identifier: zod_1.z.string(),
|
|
14
|
+
relation: zod_1.z.string(),
|
|
15
|
+
resource_type: zod_1.z.string().optional(),
|
|
16
|
+
});
|
|
17
|
+
const contributorSchema = zod_1.z.object({
|
|
18
|
+
name: zod_1.z.string(),
|
|
19
|
+
type: zod_1.z.string(),
|
|
20
|
+
affiliation: zod_1.z.string().optional(),
|
|
21
|
+
orcid: zod_1.z.string().optional(),
|
|
22
|
+
gnd: zod_1.z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
const communitySchema = zod_1.z.object({
|
|
25
|
+
identifier: zod_1.z.string(),
|
|
26
|
+
});
|
|
27
|
+
const grantSchema = zod_1.z.object({
|
|
28
|
+
id: zod_1.z.string(),
|
|
29
|
+
});
|
|
30
|
+
const subjectSchema = zod_1.z.object({
|
|
31
|
+
term: zod_1.z.string(),
|
|
32
|
+
identifier: zod_1.z.string(),
|
|
33
|
+
scheme: zod_1.z.string(),
|
|
34
|
+
});
|
|
35
|
+
const locationSchema = zod_1.z.object({
|
|
36
|
+
lat: zod_1.z.number().optional(),
|
|
37
|
+
lon: zod_1.z.number().optional(),
|
|
38
|
+
place: zod_1.z.string(),
|
|
39
|
+
description: zod_1.z.string().optional(),
|
|
40
|
+
});
|
|
41
|
+
const dateIntervalSchema = zod_1.z.object({
|
|
42
|
+
start: zod_1.z.string().optional(),
|
|
43
|
+
end: zod_1.z.string().optional(),
|
|
44
|
+
type: zod_1.z.string(),
|
|
45
|
+
description: zod_1.z.string().optional(),
|
|
46
|
+
});
|
|
47
|
+
// API returns microseconds in timestamps that is not supported for ISO 8601 default validation
|
|
48
|
+
const iso8601WithMicroseconds = zod_1.z
|
|
49
|
+
.string()
|
|
50
|
+
.refine((value) => !Number.isNaN(Date.parse(value)), {
|
|
51
|
+
message: 'Invalid datetime format',
|
|
52
|
+
});
|
|
53
|
+
const linksSchema = zod_1.z
|
|
54
|
+
.object({
|
|
55
|
+
self: zod_1.z.string().url(),
|
|
56
|
+
html: zod_1.z.string().url(),
|
|
57
|
+
badge: zod_1.z.string().url(),
|
|
58
|
+
files: zod_1.z.string().url(),
|
|
59
|
+
latest_draft: zod_1.z.string().url(),
|
|
60
|
+
latest_draft_html: zod_1.z.string().url(),
|
|
61
|
+
publish: zod_1.z.string().url(),
|
|
62
|
+
edit: zod_1.z.string().url(),
|
|
63
|
+
discard: zod_1.z.string().url(),
|
|
64
|
+
newversion: zod_1.z.string().url(),
|
|
65
|
+
registerconceptdoi: zod_1.z.string().url(),
|
|
66
|
+
})
|
|
67
|
+
.catchall(zod_1.z.string().url()); // Allows extra keys with URL values
|
|
68
|
+
exports.depositionMetadataSchema = zod_1.z.object({
|
|
69
|
+
upload_type: zod_1.z.enum([
|
|
70
|
+
'publication',
|
|
71
|
+
'poster',
|
|
72
|
+
'presentation',
|
|
73
|
+
'dataset',
|
|
74
|
+
'image',
|
|
75
|
+
'video',
|
|
76
|
+
'software',
|
|
77
|
+
'lesson',
|
|
78
|
+
'physicalobject',
|
|
79
|
+
'other',
|
|
80
|
+
]),
|
|
81
|
+
publication_type: zod_1.z.string().optional(),
|
|
82
|
+
image_type: zod_1.z.string().optional(),
|
|
83
|
+
publication_date: zod_1.z.string().optional(),
|
|
84
|
+
title: zod_1.z.string(),
|
|
85
|
+
creators: zod_1.z.array(creatorSchema),
|
|
86
|
+
description: zod_1.z.string(),
|
|
87
|
+
access_right: zod_1.z.enum(['open', 'embargoed', 'restricted', 'closed']),
|
|
88
|
+
license: zod_1.z.string().optional(),
|
|
89
|
+
embargo_date: zod_1.z.string().optional(),
|
|
90
|
+
access_conditions: zod_1.z.string().optional(),
|
|
91
|
+
doi: zod_1.z.string().optional(),
|
|
92
|
+
prereserve_doi: zod_1.z.union([zod_1.z.boolean(), zod_1.z.record(zod_1.z.unknown())]).optional(),
|
|
93
|
+
keywords: zod_1.z.array(zod_1.z.string()).optional(),
|
|
94
|
+
notes: zod_1.z.string().optional(),
|
|
95
|
+
related_identifiers: zod_1.z.array(relatedIdentifierSchema).optional(),
|
|
96
|
+
contributors: zod_1.z.array(contributorSchema).optional(),
|
|
97
|
+
references: zod_1.z.array(zod_1.z.string()).optional(),
|
|
98
|
+
communities: zod_1.z.array(communitySchema).optional(),
|
|
99
|
+
grants: zod_1.z.array(grantSchema).optional(),
|
|
100
|
+
journal_title: zod_1.z.string().optional(),
|
|
101
|
+
journal_volume: zod_1.z.string().optional(),
|
|
102
|
+
journal_issue: zod_1.z.string().optional(),
|
|
103
|
+
journal_pages: zod_1.z.string().optional(),
|
|
104
|
+
conference_title: zod_1.z.string().optional(),
|
|
105
|
+
conference_acronym: zod_1.z.string().optional(),
|
|
106
|
+
conference_dates: zod_1.z.string().optional(),
|
|
107
|
+
conference_place: zod_1.z.string().optional(),
|
|
108
|
+
conference_url: zod_1.z.string().optional(),
|
|
109
|
+
conference_session: zod_1.z.string().optional(),
|
|
110
|
+
conference_session_part: zod_1.z.string().optional(),
|
|
111
|
+
imprint_publisher: zod_1.z.string().optional(),
|
|
112
|
+
imprint_isbn: zod_1.z.string().optional(),
|
|
113
|
+
imprint_place: zod_1.z.string().optional(),
|
|
114
|
+
partof_title: zod_1.z.string().optional(),
|
|
115
|
+
partof_pages: zod_1.z.string().optional(),
|
|
116
|
+
thesis_supervisors: zod_1.z.array(creatorSchema).optional(),
|
|
117
|
+
thesis_university: zod_1.z.string().optional(),
|
|
118
|
+
subjects: zod_1.z.array(subjectSchema).optional(),
|
|
119
|
+
version: zod_1.z.string().optional(),
|
|
120
|
+
language: zod_1.z.string().optional(),
|
|
121
|
+
locations: zod_1.z.array(locationSchema).optional(),
|
|
122
|
+
dates: zod_1.z.array(dateIntervalSchema).optional(),
|
|
123
|
+
method: zod_1.z.string().optional(),
|
|
124
|
+
});
|
|
125
|
+
exports.zenodoDepositionSchema = zod_1.z.object({
|
|
126
|
+
created: iso8601WithMicroseconds, // ISO8601 timestamp
|
|
127
|
+
modified: iso8601WithMicroseconds, // ISO8601 timestamp
|
|
128
|
+
id: zod_1.z.number(),
|
|
129
|
+
metadata: exports.depositionMetadataSchema,
|
|
130
|
+
title: zod_1.z.string(),
|
|
131
|
+
doi: zod_1.z.string().optional(), // Present only for published depositions
|
|
132
|
+
doi_url: zod_1.z.string().url().optional(), // URL to DOI
|
|
133
|
+
record_url: zod_1.z.string().url().optional(), // URL to public version of record
|
|
134
|
+
links: linksSchema,
|
|
135
|
+
record_id: zod_1.z.number().optional(), // Present only for published depositions
|
|
136
|
+
owner: zod_1.z.number(),
|
|
137
|
+
files: zod_1.z.array(ZenodoFile_1.zenodoFileSchema),
|
|
138
|
+
state: zod_1.z.enum(['unsubmitted', 'inprogress', 'done', 'error']),
|
|
139
|
+
submitted: zod_1.z.boolean(),
|
|
140
|
+
});
|
|
141
|
+
//# sourceMappingURL=depositionSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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kB,CAAC,CAAC,QAAQ,EAAE;IAC7C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAIU,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,uBAAuB,EAAE,oBAAoB;IACtD,QAAQ,EAAE,uBAAuB,EAAE,oBAAoB;IACvD,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,QAAQ,EAAE,gCAAwB;IAClC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,yCAAyC;IACrE,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,aAAa;IACnD,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,kCAAkC;IAC3E,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,yCAAyC;IAC3E,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,6BAAgB,CAAC;IAChC,KAAK,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7D,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchZenodo = fetchZenodo;
|
|
4
|
+
const responseStatuses_1 = require("./responseStatuses");
|
|
5
|
+
async function fetchZenodo(zenodo, options) {
|
|
6
|
+
const { body, route = 'deposit/depositions', method = 'GET', contentType = body instanceof FormData ? undefined : 'application/json', expectedStatus = 200, searchParams, } = options;
|
|
7
|
+
let url;
|
|
8
|
+
if (searchParams) {
|
|
9
|
+
const urlSearchParams = new URLSearchParams(searchParams);
|
|
10
|
+
url =
|
|
11
|
+
zenodo.baseURL +
|
|
12
|
+
route +
|
|
13
|
+
(urlSearchParams ? `?${urlSearchParams.toString()}` : '');
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
url = zenodo.baseURL + route;
|
|
17
|
+
}
|
|
18
|
+
const headers = new Headers({
|
|
19
|
+
Authorization: `Bearer ${zenodo.accessToken}`,
|
|
20
|
+
});
|
|
21
|
+
if (contentType) {
|
|
22
|
+
headers.set('Content-Type', contentType);
|
|
23
|
+
}
|
|
24
|
+
const response = await fetch(url, {
|
|
25
|
+
method,
|
|
26
|
+
headers,
|
|
27
|
+
body,
|
|
28
|
+
});
|
|
29
|
+
if (response.status !== expectedStatus) {
|
|
30
|
+
throw new Error(responseStatuses_1.responseStatuses[response.status]?.description || response.statusText, { cause: { url, method, contentType, body, response } });
|
|
31
|
+
}
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=fetchZenodo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchZenodo.js","sourceRoot":"","sources":["../src/fetchZenodo.ts"],"names":[],"mappings":";;AAYA,kCAwCC;AAnDD,yDAAsD;AAW/C,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,OAA2B;IAC3E,MAAM,EACJ,IAAI,EACJ,KAAK,GAAG,qBAAqB,EAC7B,MAAM,GAAG,KAAK,EACd,WAAW,GAAG,IAAI,YAAY,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,EACvE,cAAc,GAAG,GAAG,EACpB,YAAY,GACb,GAAG,OAAO,CAAC;IAEZ,IAAI,GAAG,CAAC;IACR,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,YAAY,CAAC,CAAC;QAC1D,GAAG;YACD,MAAM,CAAC,OAAO;gBACd,KAAK;gBACL,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;QAC1B,aAAa,EAAE,UAAU,MAAM,CAAC,WAAW,EAAE;KAC9C,CAAC,CAAC;IACH,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,mCAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,IAAI,QAAQ,CAAC,UAAU,EACrE,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CACxD,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Zenodo"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.responseStatuses = void 0;
|
|
4
|
+
exports.responseStatuses = {
|
|
5
|
+
200: {
|
|
6
|
+
code: 200,
|
|
7
|
+
name: 'OK',
|
|
8
|
+
description: 'Request succeeded. Response included. Usually sent for GET/PUT/PATCH requests.',
|
|
9
|
+
},
|
|
10
|
+
201: {
|
|
11
|
+
code: 201,
|
|
12
|
+
name: 'Created',
|
|
13
|
+
description: 'Request succeeded. Response included. Usually sent for POST requests.',
|
|
14
|
+
},
|
|
15
|
+
202: {
|
|
16
|
+
code: 202,
|
|
17
|
+
name: 'Accepted',
|
|
18
|
+
description: 'Request succeeded. Response included. Usually sent for POST requests, where background processing is needed to fulfill the request.',
|
|
19
|
+
},
|
|
20
|
+
204: {
|
|
21
|
+
code: 204,
|
|
22
|
+
name: 'No Content',
|
|
23
|
+
description: 'Request succeeded. No response included. Usually sent for DELETE requests.',
|
|
24
|
+
},
|
|
25
|
+
400: {
|
|
26
|
+
code: 400,
|
|
27
|
+
name: 'Bad Request',
|
|
28
|
+
description: 'Request failed. Error response included.',
|
|
29
|
+
},
|
|
30
|
+
401: {
|
|
31
|
+
code: 401,
|
|
32
|
+
name: 'Unauthorized',
|
|
33
|
+
description: 'Request failed, due to an invalid access token. Error response included.',
|
|
34
|
+
},
|
|
35
|
+
403: {
|
|
36
|
+
code: 403,
|
|
37
|
+
name: 'Forbidden',
|
|
38
|
+
description: 'Request failed, due to missing authorization (e.g. deleting an already submitted upload or missing scopes for your access token). Error response included.',
|
|
39
|
+
},
|
|
40
|
+
404: {
|
|
41
|
+
code: 404,
|
|
42
|
+
name: 'Not Found',
|
|
43
|
+
description: 'Request failed, due to the resource not being found. Error response included.',
|
|
44
|
+
},
|
|
45
|
+
405: {
|
|
46
|
+
code: 405,
|
|
47
|
+
name: 'Method Not Allowed',
|
|
48
|
+
description: 'Request failed, due to unsupported HTTP method. Error response included.',
|
|
49
|
+
},
|
|
50
|
+
409: {
|
|
51
|
+
code: 409,
|
|
52
|
+
name: 'Conflict',
|
|
53
|
+
description: 'Request failed, due to the current state of the resource (e.g. edit a deposition which is not fully integrated). Error response included.',
|
|
54
|
+
},
|
|
55
|
+
415: {
|
|
56
|
+
code: 415,
|
|
57
|
+
name: 'Unsupported Media Type',
|
|
58
|
+
description: 'Request failed, due to missing or invalid request header Content-Type. Error response included.',
|
|
59
|
+
},
|
|
60
|
+
429: {
|
|
61
|
+
code: 429,
|
|
62
|
+
name: 'Too Many Requests',
|
|
63
|
+
description: 'Request failed, due to rate limiting. Error response included.',
|
|
64
|
+
},
|
|
65
|
+
500: {
|
|
66
|
+
code: 500,
|
|
67
|
+
name: 'Internal Server Error',
|
|
68
|
+
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.',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=responseStatuses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responseStatuses.js","sourceRoot":"","sources":["../src/responseStatuses.ts"],"names":[],"mappings":";;;AAMa,QAAA,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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Deposition } from './depositions/Deposition';
|
|
2
|
+
import type { ListDepositionsOptions } from './depositions/ListDepositionsOptions';
|
|
3
|
+
import type { DepositionMetadata } from './depositions/depositionSchema';
|
|
4
|
+
interface ZenodoOptions {
|
|
5
|
+
accessToken: string;
|
|
6
|
+
host?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class Zenodo {
|
|
9
|
+
host: string;
|
|
10
|
+
accessToken: string;
|
|
11
|
+
baseURL: string;
|
|
12
|
+
constructor(options: ZenodoOptions);
|
|
13
|
+
listDepositions(options?: ListDepositionsOptions): Promise<Deposition[]>;
|
|
14
|
+
createDeposition(metadata: DepositionMetadata): Promise<Deposition>;
|
|
15
|
+
retrieveDeposition(id: number): Promise<Deposition>;
|
|
16
|
+
deleteDeposition(id: number): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=Zenodo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Zenodo.d.ts","sourceRoot":"","sources":["../src/Zenodo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,UAAU,aAAa;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,qBAAa,MAAM;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;gBAEJ,OAAO,EAAE,aAAa;IAU5B,eAAe,CACnB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,UAAU,EAAE,CAAC;IAelB,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;IAWnE,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAQnD,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOlD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Deposition } from './depositions/Deposition';
|
|
2
|
+
import { fetchZenodo } from './fetchZenodo';
|
|
3
|
+
export class Zenodo {
|
|
4
|
+
host;
|
|
5
|
+
accessToken;
|
|
6
|
+
baseURL;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
const { accessToken, host = 'sandbox.zenodo.org' } = options;
|
|
9
|
+
this.host = host;
|
|
10
|
+
this.baseURL = `https://${host}/api/`;
|
|
11
|
+
if (!accessToken) {
|
|
12
|
+
throw new Error('accessToken is required');
|
|
13
|
+
}
|
|
14
|
+
this.accessToken = accessToken;
|
|
15
|
+
}
|
|
16
|
+
async listDepositions(options = {}) {
|
|
17
|
+
// all the values must be string
|
|
18
|
+
const optionsWithStrings = Object.fromEntries(Object.entries(options).map(([key, value]) => [key, String(value)]));
|
|
19
|
+
const response = await fetchZenodo(this, {
|
|
20
|
+
route: 'deposit/depositions',
|
|
21
|
+
searchParams: optionsWithStrings,
|
|
22
|
+
});
|
|
23
|
+
const depositions = (await response.json());
|
|
24
|
+
return depositions.map((deposition) => new Deposition(this, deposition));
|
|
25
|
+
}
|
|
26
|
+
async createDeposition(metadata) {
|
|
27
|
+
const response = await fetchZenodo(this, {
|
|
28
|
+
route: 'deposit/depositions',
|
|
29
|
+
expectedStatus: 201,
|
|
30
|
+
method: 'POST',
|
|
31
|
+
body: JSON.stringify({ metadata }),
|
|
32
|
+
});
|
|
33
|
+
const deposition = new Deposition(this, await response.json());
|
|
34
|
+
return deposition;
|
|
35
|
+
}
|
|
36
|
+
async retrieveDeposition(id) {
|
|
37
|
+
const response = await fetchZenodo(this, {
|
|
38
|
+
route: `deposit/depositions/${id}`,
|
|
39
|
+
});
|
|
40
|
+
const deposition = await response.json();
|
|
41
|
+
return new Deposition(this, deposition);
|
|
42
|
+
}
|
|
43
|
+
async deleteDeposition(id) {
|
|
44
|
+
await fetchZenodo(this, {
|
|
45
|
+
method: 'DELETE',
|
|
46
|
+
route: `deposit/depositions/${id}`,
|
|
47
|
+
expectedStatus: 204,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=Zenodo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Zenodo.js","sourceRoot":"","sources":["../src/Zenodo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,MAAM,OAAO,MAAM;IACjB,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,OAAO,CAAS;IAEhB,YAAY,OAAsB;QAChC,MAAM,EAAE,WAAW,EAAE,IAAI,GAAG,oBAAoB,EAAE,GAAG,OAAO,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,WAAW,IAAI,OAAO,CAAC;QACtC,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,UAAkC,EAAE;QAEpC,gCAAgC;QAChC,MAAM,kBAAkB,GAAG,MAAM,CAAC,WAAW,C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M,WAAW,CAAC,IAAI,EAAE;YACtB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,uBAAuB,EAAE,EAAE;YAClC,cAAc,EAAE,GAAG;SACpB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Zenodo } from './Zenodo';
|
|
3
|
+
export declare const zenodoFileSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
filename: z.ZodString;
|
|
6
|
+
filesize: z.ZodNumber;
|
|
7
|
+
checksum: z.ZodString;
|
|
8
|
+
links: z.ZodObject<{
|
|
9
|
+
download: z.ZodString;
|
|
10
|
+
self: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
download: string;
|
|
13
|
+
self: string;
|
|
14
|
+
}, {
|
|
15
|
+
download: string;
|
|
16
|
+
self: string;
|
|
17
|
+
}>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
id: string;
|
|
20
|
+
filename: string;
|
|
21
|
+
filesize: number;
|
|
22
|
+
checksum: string;
|
|
23
|
+
links: {
|
|
24
|
+
download: string;
|
|
25
|
+
self: string;
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
id: string;
|
|
29
|
+
filename: string;
|
|
30
|
+
filesize: number;
|
|
31
|
+
checksum: string;
|
|
32
|
+
links: {
|
|
33
|
+
download: string;
|
|
34
|
+
self: string;
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
37
|
+
type ZenodoFileType = z.infer<typeof zenodoFileSchema>;
|
|
38
|
+
export declare class ZenodoFile {
|
|
39
|
+
private zenodo;
|
|
40
|
+
value: ZenodoFileType;
|
|
41
|
+
constructor(zenodo: Zenodo, file: unknown);
|
|
42
|
+
getContentResponse(): Promise<Response>;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=ZenodoFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZenodoFile.d.ts","sourceRoot":"","sources":["../src/ZenodoFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS3B,CAAC;AAEH,KAAK,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEvD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAS;IAChB,KAAK,EAAE,cAAc,CAAC;gBAEjB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;IAKnC,kBAAkB;CAYzB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Define the Zod schema
|
|
3
|
+
export const zenodoFileSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
filename: z.string(),
|
|
6
|
+
filesize: z.number(),
|
|
7
|
+
checksum: z.string(),
|
|
8
|
+
links: z.object({
|
|
9
|
+
download: z.string().url(),
|
|
10
|
+
self: z.string().url(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
export class ZenodoFile {
|
|
14
|
+
zenodo;
|
|
15
|
+
value;
|
|
16
|
+
constructor(zenodo, file) {
|
|
17
|
+
this.value = zenodoFileSchema.parse(file);
|
|
18
|
+
this.zenodo = zenodo;
|
|
19
|
+
}
|
|
20
|
+
async getContentResponse() {
|
|
21
|
+
const link = this.value.links.download;
|
|
22
|
+
const response = await fetch(link, {
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: `Bearer ${this.zenodo.accessToken}`,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
throw new Error(`Failed to fetch ${link}`);
|
|
29
|
+
}
|
|
30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BAAmB,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Zenodo } from '../Zenodo';
|
|
2
|
+
import { ZenodoFile } from '../ZenodoFile';
|
|
3
|
+
import type { DepositionMetadata, ZenodoDeposition } from './depositionSchema';
|
|
4
|
+
export declare class Deposition {
|
|
5
|
+
private zenodo;
|
|
6
|
+
value: ZenodoDeposition;
|
|
7
|
+
constructor(zenodo: Zenodo, deposition: unknown);
|
|
8
|
+
createFile(file: File): Promise<ZenodoFile>;
|
|
9
|
+
listFiles(): Promise<ZenodoFile[]>;
|
|
10
|
+
deleteFile(fileId: string): Promise<void>;
|
|
11
|
+
retrieveFile(fileId: string): Promise<ZenodoFile>;
|
|
12
|
+
update(metadata: DepositionMetadata): Promise<Deposition>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Deposition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Deposition.d.ts","sourceRoot":"","sources":["../../src/depositions/Deposition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAS;IAChB,KAAK,EAAE,gBAAgB,CAAC;gBAEnB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO;IAKzC,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;IAY3C,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAQlC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAOjD,MAAM,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;CAQhE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ZenodoFile } from '../ZenodoFile';
|
|
2
|
+
import { fetchZenodo } from '../fetchZenodo';
|
|
3
|
+
import { zenodoDepositionSchema } from './depositionSchema';
|
|
4
|
+
export class Deposition {
|
|
5
|
+
zenodo;
|
|
6
|
+
value;
|
|
7
|
+
constructor(zenodo, deposition) {
|
|
8
|
+
this.zenodo = zenodo;
|
|
9
|
+
this.value = zenodoDepositionSchema.parse(deposition);
|
|
10
|
+
}
|
|
11
|
+
async createFile(file) {
|
|
12
|
+
const formData = new FormData();
|
|
13
|
+
formData.append('file', file);
|
|
14
|
+
const response = await fetchZenodo(this.zenodo, {
|
|
15
|
+
route: `deposit/depositions/${this.value.id}/files`,
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: formData,
|
|
18
|
+
expectedStatus: 201,
|
|
19
|
+
});
|
|
20
|
+
return new ZenodoFile(this.zenodo, await response.json());
|
|
21
|
+
}
|
|
22
|
+
async listFiles() {
|
|
23
|
+
const response = await fetchZenodo(this.zenodo, {
|
|
24
|
+
route: `deposit/depositions/${this.value.id}/files`,
|
|
25
|
+
});
|
|
26
|
+
const files = (await response.json());
|
|
27
|
+
return files.map((file) => new ZenodoFile(this.zenodo, file));
|
|
28
|
+
}
|
|
29
|
+
async deleteFile(fileId) {
|
|
30
|
+
await fetchZenodo(this.zenodo, {
|
|
31
|
+
route: `deposit/depositions/${this.value.id}/files/${fileId}`,
|
|
32
|
+
method: 'DELETE',
|
|
33
|
+
expectedStatus: 204,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async retrieveFile(fileId) {
|
|
37
|
+
const response = await fetchZenodo(this.zenodo, {
|
|
38
|
+
route: `deposit/depositions/${this.value.id}/files/${fileId}`,
|
|
39
|
+
});
|
|
40
|
+
return new ZenodoFile(this.zenodo, await response.json());
|
|
41
|
+
}
|
|
42
|
+
async update(metadata) {
|
|
43
|
+
const response = await fetchZenodo(this.zenodo, {
|
|
44
|
+
route: `deposit/depositions/${this.value.id}`,
|
|
45
|
+
method: 'PUT',
|
|
46
|
+
body: JSON.stringify({ metadata }),
|
|
47
|
+
});
|
|
48
|
+
return new Deposition(this.zenodo, await response.json());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=Deposition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Deposition.js","sourceRoot":"","sources":["../../src/depositions/Deposition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,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,sBAAsB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAU;QACzB,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAChC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9B,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;YAC9C,KAAK,EAAE,uBAAuB,IAAI,CAAC,KAAK,CAAC,EAAE,QAAQ;YACnD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,QAAQ;YACd,cAAc,EAAE,GAAG;SACpB,CAAC,CAAC;QACH,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,MAA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AQ,EAAE,CAAC;SACnC,CAAC,CAAC;QACH,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ListDepositionsOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Search query (using Elasticsearch query string syntax).
|
|
4
|
+
* Some characters have special meaning here, including `/`, which is also present in full DOIs.
|
|
5
|
+
*/
|
|
6
|
+
q?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Filter result based on deposit status.
|
|
9
|
+
* Possible values: 'draft' | 'published'
|
|
10
|
+
*/
|
|
11
|
+
status?: 'draft' | 'published';
|
|
12
|
+
/**
|
|
13
|
+
* Sort order.
|
|
14
|
+
* Possible values: 'bestmatch' | 'mostrecent'
|
|
15
|
+
* Prefix with minus to change from ascending to descending (e.g., '-mostrecent').
|
|
16
|
+
*/
|
|
17
|
+
sort?: 'bestmatch' | 'mostrecent' | `-${'bestmatch' | 'mostrecent'}`;
|
|
18
|
+
/**
|
|
19
|
+
* Page number for pagination.
|
|
20
|
+
*/
|
|
21
|
+
page?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Number of results to return per page.
|
|
24
|
+
*/
|
|
25
|
+
size?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Show or hide all versions of deposits.
|
|
28
|
+
* Possible values: 'true' | 'false' | 1 | 0
|
|
29
|
+
*/
|
|
30
|
+
all_versions?: 'true' | 'false' | 1 | 0;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ListDepositionsOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,IAAI,WAAW,GAAG,YAAY,EAAE,CAAC;IAErE;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;CACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListDepositionsOptions.js","sourceRoot":"","sources":["../../src/depositions/ListDepositionsOptions.ts"],"names":[],"mappings":""}
|