arxiv-api-wrapper 2.0.0 → 2.0.2
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/package.json +1 -1
- package/src/oaiClient.ts +514 -425
- package/src/oaiParser.ts +264 -264
- package/src/oaiTypes.ts +260 -248
- package/tests/oai.integration.test.ts +247 -222
- package/tests/oai.test.ts +351 -248
package/src/oaiTypes.ts
CHANGED
|
@@ -1,248 +1,260 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OAI-PMH types for the arXiv OAI interface.
|
|
3
|
-
* @see https://info.arxiv.org/help/oa/index.html#open-archives-initiative-oai
|
|
4
|
-
* @see https://www.openarchives.org/OAI/openarchivesprotocol.html
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ArxivRateLimitConfig } from './types.js';
|
|
8
|
-
|
|
9
|
-
/** OAI-PMH error codes. */
|
|
10
|
-
export type OaiErrorCode =
|
|
11
|
-
| 'badArgument'
|
|
12
|
-
| 'badResumptionToken'
|
|
13
|
-
| 'badVerb'
|
|
14
|
-
| 'cannotDisseminateFormat'
|
|
15
|
-
| 'idDoesNotExist'
|
|
16
|
-
| 'noMetadataFormats'
|
|
17
|
-
| 'noRecordsMatch'
|
|
18
|
-
| 'noSetHierarchy';
|
|
19
|
-
|
|
20
|
-
/** Options shared by all OAI request functions. */
|
|
21
|
-
export interface OaiRequestOptions {
|
|
22
|
-
/** Request timeout in milliseconds (default: 10000). */
|
|
23
|
-
timeoutMs?: number;
|
|
24
|
-
/** Number of retry attempts for failed requests (default: 3). */
|
|
25
|
-
retries?: number;
|
|
26
|
-
/** Custom User-Agent header for requests. */
|
|
27
|
-
userAgent?: string;
|
|
28
|
-
/** Rate limiting configuration. */
|
|
29
|
-
rateLimit?: ArxivRateLimitConfig;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** Response to the Identify verb. */
|
|
33
|
-
export interface OaiIdentifyResponse {
|
|
34
|
-
repositoryName: string;
|
|
35
|
-
baseURL: string;
|
|
36
|
-
protocolVersion: string;
|
|
37
|
-
adminEmail: string[];
|
|
38
|
-
earliestDatestamp: string;
|
|
39
|
-
deletedRecord: 'no' | 'persistent' | 'transient';
|
|
40
|
-
granularity: 'YYYY-MM-DD' | 'YYYY-MM-DDThh:mm:ssZ';
|
|
41
|
-
compression?: string[];
|
|
42
|
-
description?: unknown[];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** A metadata format from ListMetadataFormats. */
|
|
46
|
-
export interface OaiMetadataFormat {
|
|
47
|
-
metadataPrefix: OaiMetadataPrefix;
|
|
48
|
-
schema: string;
|
|
49
|
-
metadataNamespace: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** A set from ListSets (for selective harvesting). */
|
|
53
|
-
export interface OaiSet {
|
|
54
|
-
setSpec: string;
|
|
55
|
-
setName: string;
|
|
56
|
-
setDescription?: unknown;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** Resumption token for paginated list responses. */
|
|
60
|
-
export interface OaiResumptionToken {
|
|
61
|
-
/** Opaque token value to pass to the next request. */
|
|
62
|
-
value: string;
|
|
63
|
-
/** When the token expires (UTC). */
|
|
64
|
-
expirationDate?: string;
|
|
65
|
-
/** Total size of the complete list (may be approximate). */
|
|
66
|
-
completeListSize?: number;
|
|
67
|
-
/** Cursor position (number of elements returned so far). */
|
|
68
|
-
cursor?: number;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** Record header (identifier, datestamp, setSpecs, optional deleted status). */
|
|
72
|
-
export interface OaiHeader {
|
|
73
|
-
identifier: string;
|
|
74
|
-
datestamp: string;
|
|
75
|
-
setSpec: string[];
|
|
76
|
-
/** Present and 'deleted' when the record has been withdrawn. */
|
|
77
|
-
status?: 'deleted';
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** arXiv OAI metadata prefixes supported by the repository. */
|
|
81
|
-
export type OaiMetadataPrefix = 'oai_dc' | 'arXiv' | 'arXivOld' | 'arXivRaw';
|
|
82
|
-
|
|
83
|
-
type OneOrMany<T> = T | T[];
|
|
84
|
-
|
|
85
|
-
/** oai_dc metadata (Dublin Core). */
|
|
86
|
-
export interface OaiDcMetadata {
|
|
87
|
-
dc: {
|
|
88
|
-
title?: OneOrMany<string>;
|
|
89
|
-
creator?: OneOrMany<string>;
|
|
90
|
-
subject?: OneOrMany<string>;
|
|
91
|
-
description?: OneOrMany<string>;
|
|
92
|
-
publisher?: OneOrMany<string>;
|
|
93
|
-
contributor?: OneOrMany<string>;
|
|
94
|
-
date?: OneOrMany<string>;
|
|
95
|
-
type?: OneOrMany<string>;
|
|
96
|
-
format?: OneOrMany<string>;
|
|
97
|
-
identifier?: OneOrMany<string>;
|
|
98
|
-
source?: OneOrMany<string>;
|
|
99
|
-
language?: OneOrMany<string>;
|
|
100
|
-
relation?: OneOrMany<string>;
|
|
101
|
-
coverage?: OneOrMany<string>;
|
|
102
|
-
rights?: OneOrMany<string>;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** arXiv author in the arXiv metadata format. */
|
|
107
|
-
export interface OaiArxivAuthor {
|
|
108
|
-
keyname: string;
|
|
109
|
-
forenames?: string;
|
|
110
|
-
suffix?: string;
|
|
111
|
-
affiliation?: OneOrMany<string>;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/** arXiv metadata (latest-version focused metadata). */
|
|
115
|
-
export interface OaiArxivMetadata {
|
|
116
|
-
arXiv: {
|
|
117
|
-
id: string;
|
|
118
|
-
created?: string;
|
|
119
|
-
updated?: string;
|
|
120
|
-
authors?: {
|
|
121
|
-
author: OneOrMany<OaiArxivAuthor>;
|
|
122
|
-
};
|
|
123
|
-
title?: string;
|
|
124
|
-
'msc-class'?: string;
|
|
125
|
-
'acm-class'?: string;
|
|
126
|
-
'report-no'?: string;
|
|
127
|
-
'journal-ref'?: string;
|
|
128
|
-
comments?: string;
|
|
129
|
-
abstract?: string;
|
|
130
|
-
categories?: string;
|
|
131
|
-
doi?: string;
|
|
132
|
-
proxy?: string;
|
|
133
|
-
license?: string;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/** arXivOld metadata (legacy arXiv internal format). */
|
|
138
|
-
export interface OaiArxivOldMetadata {
|
|
139
|
-
arXivOld: {
|
|
140
|
-
id: string;
|
|
141
|
-
title?: string;
|
|
142
|
-
authors?: string;
|
|
143
|
-
categories?: string;
|
|
144
|
-
comments?: string;
|
|
145
|
-
proxy?: string;
|
|
146
|
-
'report-no'?: string;
|
|
147
|
-
'msc-class'?: string;
|
|
148
|
-
'acm-class'?: string;
|
|
149
|
-
'journal-ref'?: string;
|
|
150
|
-
doi?: string;
|
|
151
|
-
abstract?: string;
|
|
152
|
-
license?: string;
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Version entry in arXivRaw metadata. */
|
|
157
|
-
export interface OaiArxivRawVersion {
|
|
158
|
-
version?: string;
|
|
159
|
-
date: string;
|
|
160
|
-
size?: string;
|
|
161
|
-
source_type?: string;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/** arXivRaw metadata (close to arXiv internal metadata with version history). */
|
|
165
|
-
export interface OaiArxivRawMetadata {
|
|
166
|
-
arXivRaw: {
|
|
167
|
-
id: string;
|
|
168
|
-
submitter: string;
|
|
169
|
-
version: OneOrMany<OaiArxivRawVersion>;
|
|
170
|
-
title?: string;
|
|
171
|
-
authors?: string;
|
|
172
|
-
categories: string;
|
|
173
|
-
comments?: string;
|
|
174
|
-
proxy?: string;
|
|
175
|
-
'report-no'?: string;
|
|
176
|
-
'acm-class'?: string;
|
|
177
|
-
'msc-class'?: string;
|
|
178
|
-
'journal-ref'?: string;
|
|
179
|
-
doi?: string;
|
|
180
|
-
license?: string;
|
|
181
|
-
abstract?: string;
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/** Mapping from metadataPrefix to metadata payload shape. */
|
|
186
|
-
export interface OaiMetadataByPrefix {
|
|
187
|
-
oai_dc: OaiDcMetadata;
|
|
188
|
-
arXiv: OaiArxivMetadata;
|
|
189
|
-
arXivOld: OaiArxivOldMetadata;
|
|
190
|
-
arXivRaw: OaiArxivRawMetadata;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/** Metadata part of a record (format-dependent: oai_dc, arXiv, arXivOld, arXivRaw). */
|
|
194
|
-
export type OaiMetadata = OaiMetadataByPrefix[keyof OaiMetadataByPrefix];
|
|
195
|
-
|
|
196
|
-
/** A single OAI record (header + optional metadata and about). */
|
|
197
|
-
export interface OaiRecord {
|
|
198
|
-
header: OaiHeader;
|
|
199
|
-
/** Omitted for deleted records. */
|
|
200
|
-
metadata?: OaiMetadata;
|
|
201
|
-
/** Optional about containers (e.g. provenance, rights). */
|
|
202
|
-
about?: unknown[];
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/** Result of ListIdentifiers (headers + optional resumption). */
|
|
206
|
-
export interface OaiListIdentifiersResult {
|
|
207
|
-
headers: OaiHeader[];
|
|
208
|
-
resumptionToken?: OaiResumptionToken;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/** Result of ListRecords (records + optional resumption). */
|
|
212
|
-
export interface OaiListRecordsResult {
|
|
213
|
-
records: OaiRecord[];
|
|
214
|
-
resumptionToken?: OaiResumptionToken;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/** Result of ListSets (sets + optional resumption). */
|
|
218
|
-
export interface OaiListSetsResult {
|
|
219
|
-
sets: OaiSet[];
|
|
220
|
-
resumptionToken?: OaiResumptionToken;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
1
|
+
/**
|
|
2
|
+
* OAI-PMH types for the arXiv OAI interface.
|
|
3
|
+
* @see https://info.arxiv.org/help/oa/index.html#open-archives-initiative-oai
|
|
4
|
+
* @see https://www.openarchives.org/OAI/openarchivesprotocol.html
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ArxivRateLimitConfig } from './types.js';
|
|
8
|
+
|
|
9
|
+
/** OAI-PMH error codes. */
|
|
10
|
+
export type OaiErrorCode =
|
|
11
|
+
| 'badArgument'
|
|
12
|
+
| 'badResumptionToken'
|
|
13
|
+
| 'badVerb'
|
|
14
|
+
| 'cannotDisseminateFormat'
|
|
15
|
+
| 'idDoesNotExist'
|
|
16
|
+
| 'noMetadataFormats'
|
|
17
|
+
| 'noRecordsMatch'
|
|
18
|
+
| 'noSetHierarchy';
|
|
19
|
+
|
|
20
|
+
/** Options shared by all OAI request functions. */
|
|
21
|
+
export interface OaiRequestOptions {
|
|
22
|
+
/** Request timeout in milliseconds (default: 10000). */
|
|
23
|
+
timeoutMs?: number;
|
|
24
|
+
/** Number of retry attempts for failed requests (default: 3). */
|
|
25
|
+
retries?: number;
|
|
26
|
+
/** Custom User-Agent header for requests. */
|
|
27
|
+
userAgent?: string;
|
|
28
|
+
/** Rate limiting configuration. */
|
|
29
|
+
rateLimit?: ArxivRateLimitConfig;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Response to the Identify verb. */
|
|
33
|
+
export interface OaiIdentifyResponse {
|
|
34
|
+
repositoryName: string;
|
|
35
|
+
baseURL: string;
|
|
36
|
+
protocolVersion: string;
|
|
37
|
+
adminEmail: string[];
|
|
38
|
+
earliestDatestamp: string;
|
|
39
|
+
deletedRecord: 'no' | 'persistent' | 'transient';
|
|
40
|
+
granularity: 'YYYY-MM-DD' | 'YYYY-MM-DDThh:mm:ssZ';
|
|
41
|
+
compression?: string[];
|
|
42
|
+
description?: unknown[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** A metadata format from ListMetadataFormats. */
|
|
46
|
+
export interface OaiMetadataFormat {
|
|
47
|
+
metadataPrefix: OaiMetadataPrefix;
|
|
48
|
+
schema: string;
|
|
49
|
+
metadataNamespace: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A set from ListSets (for selective harvesting). */
|
|
53
|
+
export interface OaiSet {
|
|
54
|
+
setSpec: string;
|
|
55
|
+
setName: string;
|
|
56
|
+
setDescription?: unknown;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Resumption token for paginated list responses. */
|
|
60
|
+
export interface OaiResumptionToken {
|
|
61
|
+
/** Opaque token value to pass to the next request. */
|
|
62
|
+
value: string;
|
|
63
|
+
/** When the token expires (UTC). */
|
|
64
|
+
expirationDate?: string;
|
|
65
|
+
/** Total size of the complete list (may be approximate). */
|
|
66
|
+
completeListSize?: number;
|
|
67
|
+
/** Cursor position (number of elements returned so far). */
|
|
68
|
+
cursor?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Record header (identifier, datestamp, setSpecs, optional deleted status). */
|
|
72
|
+
export interface OaiHeader {
|
|
73
|
+
identifier: string;
|
|
74
|
+
datestamp: string;
|
|
75
|
+
setSpec: string[];
|
|
76
|
+
/** Present and 'deleted' when the record has been withdrawn. */
|
|
77
|
+
status?: 'deleted';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** arXiv OAI metadata prefixes supported by the repository. */
|
|
81
|
+
export type OaiMetadataPrefix = 'oai_dc' | 'arXiv' | 'arXivOld' | 'arXivRaw';
|
|
82
|
+
|
|
83
|
+
type OneOrMany<T> = T | T[];
|
|
84
|
+
|
|
85
|
+
/** oai_dc metadata (Dublin Core). */
|
|
86
|
+
export interface OaiDcMetadata {
|
|
87
|
+
dc: {
|
|
88
|
+
title?: OneOrMany<string>;
|
|
89
|
+
creator?: OneOrMany<string>;
|
|
90
|
+
subject?: OneOrMany<string>;
|
|
91
|
+
description?: OneOrMany<string>;
|
|
92
|
+
publisher?: OneOrMany<string>;
|
|
93
|
+
contributor?: OneOrMany<string>;
|
|
94
|
+
date?: OneOrMany<string>;
|
|
95
|
+
type?: OneOrMany<string>;
|
|
96
|
+
format?: OneOrMany<string>;
|
|
97
|
+
identifier?: OneOrMany<string>;
|
|
98
|
+
source?: OneOrMany<string>;
|
|
99
|
+
language?: OneOrMany<string>;
|
|
100
|
+
relation?: OneOrMany<string>;
|
|
101
|
+
coverage?: OneOrMany<string>;
|
|
102
|
+
rights?: OneOrMany<string>;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** arXiv author in the arXiv metadata format. */
|
|
107
|
+
export interface OaiArxivAuthor {
|
|
108
|
+
keyname: string;
|
|
109
|
+
forenames?: string;
|
|
110
|
+
suffix?: string;
|
|
111
|
+
affiliation?: OneOrMany<string>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** arXiv metadata (latest-version focused metadata). */
|
|
115
|
+
export interface OaiArxivMetadata {
|
|
116
|
+
arXiv: {
|
|
117
|
+
id: string;
|
|
118
|
+
created?: string;
|
|
119
|
+
updated?: string;
|
|
120
|
+
authors?: {
|
|
121
|
+
author: OneOrMany<OaiArxivAuthor>;
|
|
122
|
+
};
|
|
123
|
+
title?: string;
|
|
124
|
+
'msc-class'?: string;
|
|
125
|
+
'acm-class'?: string;
|
|
126
|
+
'report-no'?: string;
|
|
127
|
+
'journal-ref'?: string;
|
|
128
|
+
comments?: string;
|
|
129
|
+
abstract?: string;
|
|
130
|
+
categories?: string;
|
|
131
|
+
doi?: string;
|
|
132
|
+
proxy?: string;
|
|
133
|
+
license?: string;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** arXivOld metadata (legacy arXiv internal format). */
|
|
138
|
+
export interface OaiArxivOldMetadata {
|
|
139
|
+
arXivOld: {
|
|
140
|
+
id: string;
|
|
141
|
+
title?: string;
|
|
142
|
+
authors?: string;
|
|
143
|
+
categories?: string;
|
|
144
|
+
comments?: string;
|
|
145
|
+
proxy?: string;
|
|
146
|
+
'report-no'?: string;
|
|
147
|
+
'msc-class'?: string;
|
|
148
|
+
'acm-class'?: string;
|
|
149
|
+
'journal-ref'?: string;
|
|
150
|
+
doi?: string;
|
|
151
|
+
abstract?: string;
|
|
152
|
+
license?: string;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Version entry in arXivRaw metadata. */
|
|
157
|
+
export interface OaiArxivRawVersion {
|
|
158
|
+
version?: string;
|
|
159
|
+
date: string;
|
|
160
|
+
size?: string;
|
|
161
|
+
source_type?: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** arXivRaw metadata (close to arXiv internal metadata with version history). */
|
|
165
|
+
export interface OaiArxivRawMetadata {
|
|
166
|
+
arXivRaw: {
|
|
167
|
+
id: string;
|
|
168
|
+
submitter: string;
|
|
169
|
+
version: OneOrMany<OaiArxivRawVersion>;
|
|
170
|
+
title?: string;
|
|
171
|
+
authors?: string;
|
|
172
|
+
categories: string;
|
|
173
|
+
comments?: string;
|
|
174
|
+
proxy?: string;
|
|
175
|
+
'report-no'?: string;
|
|
176
|
+
'acm-class'?: string;
|
|
177
|
+
'msc-class'?: string;
|
|
178
|
+
'journal-ref'?: string;
|
|
179
|
+
doi?: string;
|
|
180
|
+
license?: string;
|
|
181
|
+
abstract?: string;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Mapping from metadataPrefix to metadata payload shape. */
|
|
186
|
+
export interface OaiMetadataByPrefix {
|
|
187
|
+
oai_dc: OaiDcMetadata;
|
|
188
|
+
arXiv: OaiArxivMetadata;
|
|
189
|
+
arXivOld: OaiArxivOldMetadata;
|
|
190
|
+
arXivRaw: OaiArxivRawMetadata;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Metadata part of a record (format-dependent: oai_dc, arXiv, arXivOld, arXivRaw). */
|
|
194
|
+
export type OaiMetadata = OaiMetadataByPrefix[keyof OaiMetadataByPrefix];
|
|
195
|
+
|
|
196
|
+
/** A single OAI record (header + optional metadata and about). */
|
|
197
|
+
export interface OaiRecord {
|
|
198
|
+
header: OaiHeader;
|
|
199
|
+
/** Omitted for deleted records. */
|
|
200
|
+
metadata?: OaiMetadata;
|
|
201
|
+
/** Optional about containers (e.g. provenance, rights). */
|
|
202
|
+
about?: unknown[];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Result of ListIdentifiers (headers + optional resumption). */
|
|
206
|
+
export interface OaiListIdentifiersResult {
|
|
207
|
+
headers: OaiHeader[];
|
|
208
|
+
resumptionToken?: OaiResumptionToken;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** Result of ListRecords (records + optional resumption). */
|
|
212
|
+
export interface OaiListRecordsResult {
|
|
213
|
+
records: OaiRecord[];
|
|
214
|
+
resumptionToken?: OaiResumptionToken;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Result of ListSets (sets + optional resumption). */
|
|
218
|
+
export interface OaiListSetsResult {
|
|
219
|
+
sets: OaiSet[];
|
|
220
|
+
resumptionToken?: OaiResumptionToken;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
type OaiSelectiveHarvestOptions = {
|
|
224
|
+
/** Lower bound for datestamp-based selective harvesting (UTC). */
|
|
225
|
+
from?: string;
|
|
226
|
+
/** Upper bound for datestamp-based selective harvesting (UTC). */
|
|
227
|
+
until?: string;
|
|
228
|
+
/** Set spec for selective harvesting (e.g. cs:cs:AI, physics:hep-th). */
|
|
229
|
+
set?: string;
|
|
230
|
+
/** Resumption token must not be provided for an initial selective request. */
|
|
231
|
+
resumptionToken?: undefined;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
type OaiResumptionTokenOnlyOptions = {
|
|
235
|
+
/** Resumption token from a previous incomplete list response. */
|
|
236
|
+
resumptionToken: string;
|
|
237
|
+
/** Selective harvesting parameters are not allowed together with resumptionToken. */
|
|
238
|
+
from?: never;
|
|
239
|
+
until?: never;
|
|
240
|
+
set?: never;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/** Options for ListIdentifiers and ListRecords. */
|
|
244
|
+
export type OaiListOptions = OaiRequestOptions &
|
|
245
|
+
(OaiSelectiveHarvestOptions | OaiResumptionTokenOnlyOptions);
|
|
246
|
+
|
|
247
|
+
/** Error thrown when the OAI repository returns an error element. */
|
|
248
|
+
export class OaiError extends Error {
|
|
249
|
+
readonly code: OaiErrorCode;
|
|
250
|
+
readonly messageText: string;
|
|
251
|
+
|
|
252
|
+
constructor(code: OaiErrorCode, messageText: string = '') {
|
|
253
|
+
const msg = messageText ? `${code}: ${messageText}` : code;
|
|
254
|
+
super(msg);
|
|
255
|
+
this.name = 'OaiError';
|
|
256
|
+
this.code = code;
|
|
257
|
+
this.messageText = messageText;
|
|
258
|
+
Object.setPrototypeOf(this, OaiError.prototype);
|
|
259
|
+
}
|
|
260
|
+
}
|