ochre-sdk 1.0.10 → 1.0.11
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/dist/index.d.mts +1372 -1370
- package/dist/index.mjs +2992 -2970
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -186,1553 +186,1555 @@ declare class MultilingualString<T extends ReadonlyArray<string> = ReadonlyArray
|
|
|
186
186
|
toJSON(): MultilingualStringJSON<T>;
|
|
187
187
|
}
|
|
188
188
|
//#endregion
|
|
189
|
-
//#region src/types/
|
|
190
|
-
type
|
|
191
|
-
/**
|
|
192
|
-
* Language-code tuple or array used by OCHRE multilingual fields.
|
|
193
|
-
*
|
|
194
|
-
* Use the default when the consumer does not need to narrow a value to a
|
|
195
|
-
* specific language tuple.
|
|
196
|
-
*/
|
|
197
|
-
type LanguageCodes = ReadonlyArray<string>;
|
|
198
|
-
/**
|
|
199
|
-
* The category of an item in OCHRE
|
|
200
|
-
*/
|
|
201
|
-
type ItemCategory = "tree" | "bibliography" | "concept" | "spatialUnit" | "period" | "person" | "propertyVariable" | "propertyValue" | "resource" | "text" | "set";
|
|
202
|
-
/**
|
|
203
|
-
* OCHRE item categories that can contain other items in API payloads.
|
|
204
|
-
*/
|
|
205
|
-
type ItemContainerCategory = Extract<ItemCategory, "tree" | "set">;
|
|
206
|
-
/**
|
|
207
|
-
* The category of items in a Tree
|
|
208
|
-
*/
|
|
209
|
-
type TreeItemCategory = Exclude<ItemCategory, "tree">;
|
|
210
|
-
/**
|
|
211
|
-
* The category of items in a Set
|
|
212
|
-
*/
|
|
213
|
-
type SetItemCategory = ItemCategory;
|
|
214
|
-
type ContainedItemCategory<U extends ItemCategory = ItemCategory> = U extends "tree" ? TreeItemCategory : U extends "set" ? SetItemCategory : never;
|
|
215
|
-
type ContainedItemCategoryOption<U extends ItemCategory = ItemCategory> = U extends "tree" ? TreeItemCategory : U extends "set" ? SetItemCategory | ReadonlyArray<SetItemCategory> : never;
|
|
216
|
-
type ContainedItemCategoryFromOption<U extends ItemCategory = ItemCategory, V extends ContainedItemCategoryOption<U> | undefined = undefined> = V extends ReadonlyArray<infer W> ? Extract<W, ContainedItemCategory<U>> : V extends ContainedItemCategory<U> ? V : ContainedItemCategory<U>;
|
|
217
|
-
/**
|
|
218
|
-
* The category of items in a heading
|
|
219
|
-
*/
|
|
220
|
-
type HeadingItemCategory = Exclude<ItemCategory, "tree" | "bibliography" | "spatialUnit" | "concept" | "period">;
|
|
221
|
-
/**
|
|
222
|
-
* The category of items that expose recursive subitem structures.
|
|
223
|
-
*/
|
|
224
|
-
type RecursiveItemCategory = Exclude<ItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
|
|
225
|
-
/**
|
|
226
|
-
* The category names that can appear in OCHRE context paths
|
|
227
|
-
*/
|
|
228
|
-
type ContextItemCategory = Exclude<ItemCategory, "tree" | "person" | "set">;
|
|
229
|
-
/**
|
|
230
|
-
* Basic identification information
|
|
231
|
-
*/
|
|
232
|
-
type Identification<T extends LanguageCodes = LanguageCodes> = {
|
|
233
|
-
label: MultilingualString<T>;
|
|
234
|
-
abbreviation: MultilingualString<T> | null;
|
|
235
|
-
code: string | null;
|
|
236
|
-
email: string | null;
|
|
237
|
-
website: string | null;
|
|
238
|
-
};
|
|
189
|
+
//#region src/types/website.d.ts
|
|
190
|
+
type WebsitePropertyValueDataType = QueryablePropertyValueDataType;
|
|
239
191
|
/**
|
|
240
|
-
*
|
|
192
|
+
* Represents a context tree level item with a variable and value
|
|
241
193
|
*/
|
|
242
|
-
type
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
publisher: string;
|
|
246
|
-
identifier: string;
|
|
247
|
-
project: {
|
|
248
|
-
uuid: string;
|
|
249
|
-
identification: Identification<T>;
|
|
250
|
-
website: string | null;
|
|
251
|
-
dateFormat: string | null;
|
|
252
|
-
page: "item" | "entry" | null;
|
|
253
|
-
} | null;
|
|
254
|
-
collection: {
|
|
255
|
-
uuid: string;
|
|
256
|
-
identification: Identification<T>;
|
|
257
|
-
page: "item" | "entry";
|
|
258
|
-
} | null;
|
|
259
|
-
publication: {
|
|
260
|
-
uuid: string;
|
|
261
|
-
identification: Identification<T>;
|
|
262
|
-
page: "item" | "entry";
|
|
263
|
-
} | null;
|
|
264
|
-
item: {
|
|
265
|
-
identification: Identification<T>;
|
|
266
|
-
category: string;
|
|
267
|
-
type: string;
|
|
268
|
-
maxLength: number | null;
|
|
269
|
-
} | null;
|
|
270
|
-
defaultLanguage: T[number];
|
|
271
|
-
languages: T;
|
|
272
|
-
};
|
|
273
|
-
type BelongsTo = {
|
|
274
|
-
uuid: string;
|
|
275
|
-
abbreviation: string;
|
|
276
|
-
};
|
|
277
|
-
type ItemPayloadKind = "topLevel" | "embedded";
|
|
278
|
-
type ItemEnvelopeFields<T extends LanguageCodes, U extends ItemPayloadKind> = U extends "topLevel" ? {
|
|
279
|
-
belongsTo: BelongsTo;
|
|
280
|
-
metadata: Metadata<T>;
|
|
281
|
-
persistentUrl: string | null;
|
|
282
|
-
} : {
|
|
283
|
-
belongsTo: null;
|
|
284
|
-
metadata: null;
|
|
285
|
-
persistentUrl: null;
|
|
194
|
+
type ContextTreeLevelItem = {
|
|
195
|
+
variableUuid: string;
|
|
196
|
+
valueUuid: string | null;
|
|
286
197
|
};
|
|
287
198
|
/**
|
|
288
|
-
*
|
|
199
|
+
* Represents a context tree level with a context item
|
|
289
200
|
*/
|
|
290
|
-
type
|
|
291
|
-
|
|
292
|
-
|
|
201
|
+
type ContextTreeLevel<T extends LanguageCodes = LanguageCodes> = {
|
|
202
|
+
context: Array<ContextTreeLevelItem>;
|
|
203
|
+
identification: Identification<T>;
|
|
204
|
+
type: string;
|
|
293
205
|
};
|
|
294
206
|
/**
|
|
295
|
-
*
|
|
207
|
+
* Represents a filter context tree level with a context item
|
|
296
208
|
*/
|
|
297
|
-
type
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
209
|
+
type ContextTreeFilterLevel<T extends LanguageCodes = LanguageCodes> = {
|
|
210
|
+
context: Array<ContextTreeLevelItem>;
|
|
211
|
+
identification: Identification<T>;
|
|
212
|
+
type: string;
|
|
213
|
+
filterType: "property" | "coordinates" | "bibliography" | "period";
|
|
214
|
+
isInlineDisplayed: boolean;
|
|
215
|
+
isSidebarDisplayed: boolean;
|
|
216
|
+
isSidebarOpen: boolean;
|
|
302
217
|
};
|
|
303
218
|
/**
|
|
304
|
-
*
|
|
305
|
-
*/
|
|
306
|
-
type ContextNode<U extends ContextItemCategory = ContextItemCategory> = {
|
|
307
|
-
tree: ContextItem;
|
|
308
|
-
project: ContextItem;
|
|
309
|
-
heading: Array<ContextItem>;
|
|
310
|
-
} & Partial<Record<U, Array<ContextItem>>>;
|
|
311
|
-
/**
|
|
312
|
-
* Context in OCHRE
|
|
219
|
+
* Represents a context tree with levels grouped by behavior
|
|
313
220
|
*/
|
|
314
|
-
type
|
|
315
|
-
|
|
316
|
-
|
|
221
|
+
type ContextTree<T extends LanguageCodes = LanguageCodes> = {
|
|
222
|
+
flatten: Array<ContextTreeLevel<T>>;
|
|
223
|
+
suppress: Array<ContextTreeLevel<T>>;
|
|
224
|
+
filter: Array<ContextTreeFilterLevel<T>>;
|
|
225
|
+
sort: Array<ContextTreeLevel<T>>;
|
|
226
|
+
detail: Array<ContextTreeLevel<T>>;
|
|
227
|
+
download: Array<ContextTreeLevel<T>>;
|
|
228
|
+
label: Array<ContextTreeLevel<T>>;
|
|
229
|
+
prominent: Array<ContextTreeLevel<T>>;
|
|
317
230
|
};
|
|
318
231
|
/**
|
|
319
|
-
*
|
|
232
|
+
* Represents a scope with its UUID, type and identification
|
|
320
233
|
*/
|
|
321
|
-
type
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
} | null;
|
|
326
|
-
label: MultilingualString<T>;
|
|
327
|
-
comment: MultilingualString<T> | null;
|
|
328
|
-
agent: {
|
|
329
|
-
uuid: string;
|
|
330
|
-
label: MultilingualString<T>;
|
|
331
|
-
publicationDateTime: Date | null;
|
|
332
|
-
} | null;
|
|
333
|
-
location: {
|
|
334
|
-
uuid: string;
|
|
335
|
-
label: MultilingualString<T>;
|
|
336
|
-
publicationDateTime: Date | null;
|
|
337
|
-
} | null;
|
|
338
|
-
other: {
|
|
339
|
-
uuid: string | null;
|
|
340
|
-
category: string | null;
|
|
341
|
-
label: MultilingualString<T>;
|
|
342
|
-
} | null;
|
|
234
|
+
type Scope<T extends LanguageCodes = LanguageCodes> = {
|
|
235
|
+
uuid: string;
|
|
236
|
+
type: string;
|
|
237
|
+
identification: Identification<T>;
|
|
343
238
|
};
|
|
344
239
|
/**
|
|
345
|
-
*
|
|
240
|
+
* Represents a stylesheet item with its UUID and category
|
|
346
241
|
*/
|
|
347
|
-
type
|
|
348
|
-
|
|
242
|
+
type StylesheetCategory = Extract<ItemCategory, "propertyVariable" | "propertyValue">;
|
|
243
|
+
type StylesheetItem = {
|
|
349
244
|
uuid: string;
|
|
350
|
-
|
|
245
|
+
category: "propertyVariable";
|
|
246
|
+
icon: string | null;
|
|
247
|
+
styles: {
|
|
248
|
+
default: Array<Style>;
|
|
249
|
+
tablet: Array<Style>;
|
|
250
|
+
mobile: Array<Style>;
|
|
251
|
+
};
|
|
351
252
|
} | {
|
|
352
|
-
context: "related";
|
|
353
253
|
uuid: string;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
254
|
+
category: "propertyValue";
|
|
255
|
+
variableUuid: string;
|
|
256
|
+
icon: string | null;
|
|
257
|
+
styles: {
|
|
258
|
+
default: Array<Style>;
|
|
259
|
+
tablet: Array<Style>;
|
|
260
|
+
mobile: Array<Style>;
|
|
361
261
|
};
|
|
362
|
-
uuid: string;
|
|
363
|
-
label: MultilingualString<T>;
|
|
364
262
|
};
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
263
|
+
type WebsitePropertyQueryNode<T extends LanguageCodes = LanguageCodes> = {
|
|
264
|
+
target: "property";
|
|
265
|
+
propertyVariable: string;
|
|
266
|
+
dataType: WebsitePropertyValueDataType;
|
|
267
|
+
matchMode: "includes" | "exact";
|
|
268
|
+
isCaseSensitive: boolean;
|
|
269
|
+
language: T[number];
|
|
270
|
+
};
|
|
271
|
+
type WebsitePropertyQuery<T extends LanguageCodes = LanguageCodes> = WebsitePropertyQueryNode<T> | {
|
|
272
|
+
and: Array<WebsitePropertyQuery<T>>;
|
|
374
273
|
} | {
|
|
375
|
-
|
|
376
|
-
minimum: {
|
|
377
|
-
latitude: number;
|
|
378
|
-
longitude: number;
|
|
379
|
-
};
|
|
380
|
-
maximum: {
|
|
381
|
-
latitude: number;
|
|
382
|
-
longitude: number;
|
|
383
|
-
};
|
|
384
|
-
source: CoordinatesSource<T> | null;
|
|
274
|
+
or: Array<WebsitePropertyQuery<T>>;
|
|
385
275
|
};
|
|
386
276
|
/**
|
|
387
|
-
*
|
|
277
|
+
* Represents the OCHRE website type
|
|
388
278
|
*/
|
|
389
|
-
type
|
|
390
|
-
publicationDateTime: Date | null;
|
|
391
|
-
identification: Identification<T> | null;
|
|
392
|
-
href: string | null;
|
|
393
|
-
htmlImgSrcPrefix: string | null;
|
|
394
|
-
height: number | null;
|
|
395
|
-
width: number | null;
|
|
396
|
-
fileSize: number | null;
|
|
397
|
-
base64: string | null;
|
|
398
|
-
};
|
|
279
|
+
type WebsiteType = "traditional" | "digital-collection" | "plum" | "cedar" | "elm" | "maple" | "oak" | "palm";
|
|
399
280
|
/**
|
|
400
|
-
*
|
|
281
|
+
* Represents a website with its properties and elements
|
|
401
282
|
*/
|
|
402
|
-
type
|
|
283
|
+
type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
403
284
|
uuid: string;
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
285
|
+
type: "website" | "segment";
|
|
286
|
+
belongsTo: {
|
|
287
|
+
uuid: string;
|
|
288
|
+
abbreviation: string;
|
|
289
|
+
} | null;
|
|
290
|
+
metadata: Metadata<T>;
|
|
291
|
+
publicationDateTime: Date | null;
|
|
292
|
+
identification: Identification<T>;
|
|
293
|
+
creators: Array<Person<T, "embedded">>;
|
|
294
|
+
license: License | null;
|
|
295
|
+
items: Array<Webpage<T>>;
|
|
296
|
+
properties: {
|
|
297
|
+
type: WebsiteType;
|
|
298
|
+
status: "development" | "preview" | "production";
|
|
299
|
+
versionLabel: "experimental" | "alpha" | "beta" | "test" | "staging" | "pre-release" | "release";
|
|
300
|
+
privacy: "public" | "password" | "private";
|
|
301
|
+
contact: {
|
|
302
|
+
name: string;
|
|
303
|
+
email: string | null;
|
|
304
|
+
} | null;
|
|
305
|
+
loadingVariant: "spinner" | "skeleton" | "animation" | "none";
|
|
306
|
+
theme: {
|
|
307
|
+
isThemeToggleDisplayed: boolean;
|
|
308
|
+
defaultTheme: "light" | "dark" | "system";
|
|
416
309
|
};
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
310
|
+
icon: {
|
|
311
|
+
logoUuid: string | null;
|
|
312
|
+
faviconUuid: string | null;
|
|
313
|
+
appleTouchIconUuid: string | null;
|
|
314
|
+
};
|
|
315
|
+
navbar: {
|
|
316
|
+
isDisplayed: boolean;
|
|
317
|
+
variant: "default" | "floating" | "inline";
|
|
318
|
+
alignment: "start" | "center" | "end";
|
|
319
|
+
isProjectDisplayed: boolean;
|
|
320
|
+
searchBarBoundElementUuid: string | null;
|
|
321
|
+
items: Array<WebElement<T> | WebBlock<T>> | null;
|
|
322
|
+
};
|
|
323
|
+
footer: {
|
|
324
|
+
isDisplayed: boolean;
|
|
325
|
+
logoUuid: string | null;
|
|
326
|
+
items: Array<WebElement<T> | WebBlock<T>> | null;
|
|
327
|
+
};
|
|
328
|
+
sidebar: {
|
|
329
|
+
isDisplayed: boolean;
|
|
330
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
331
|
+
title: WebTitle<T>;
|
|
332
|
+
layout: "start" | "end";
|
|
333
|
+
mobileLayout: "default" | "inline";
|
|
334
|
+
cssStyles: {
|
|
335
|
+
default: Array<Style>;
|
|
336
|
+
tablet: Array<Style>;
|
|
337
|
+
mobile: Array<Style>;
|
|
338
|
+
};
|
|
339
|
+
} | null;
|
|
340
|
+
itemPage: {
|
|
341
|
+
isMainContentDisplayed: boolean;
|
|
342
|
+
isDescriptionDisplayed: boolean;
|
|
343
|
+
isDocumentDisplayed: boolean;
|
|
344
|
+
isNotesDisplayed: boolean;
|
|
345
|
+
isEventsDisplayed: boolean;
|
|
346
|
+
isPeriodsDisplayed: boolean;
|
|
347
|
+
isPropertiesDisplayed: boolean;
|
|
348
|
+
isBibliographyDisplayed: boolean;
|
|
349
|
+
isPropertyValuesGrouped: boolean;
|
|
350
|
+
isPublicationDateTimeDisplayed: boolean;
|
|
351
|
+
isPersistentIdentifierDisplayed: boolean;
|
|
352
|
+
iiifViewer: "universal-viewer" | "clover";
|
|
353
|
+
};
|
|
354
|
+
options: {
|
|
355
|
+
contextTree: ContextTree<T> | null;
|
|
356
|
+
scopes: Array<Scope<T>> | null;
|
|
357
|
+
labels: {
|
|
358
|
+
title: MultilingualString<T> | null;
|
|
359
|
+
};
|
|
360
|
+
stylesheets: {
|
|
361
|
+
properties: Array<StylesheetItem>;
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
};
|
|
430
365
|
};
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
*/
|
|
434
|
-
type Note<T extends LanguageCodes = LanguageCodes> = {
|
|
435
|
-
number: number;
|
|
436
|
-
title: MultilingualString<T> | null;
|
|
437
|
-
content: MultilingualString<T>;
|
|
438
|
-
authors: Array<Person<T, "embedded">>;
|
|
366
|
+
type WebsiteSegment<T extends LanguageCodes = LanguageCodes> = Website<T> & {
|
|
367
|
+
type: "segment";
|
|
439
368
|
};
|
|
440
369
|
/**
|
|
441
|
-
*
|
|
370
|
+
* Represents a webpage with its title, slug, properties, items and subpages
|
|
442
371
|
*/
|
|
443
|
-
type
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
label: MultilingualString<T> | null;
|
|
449
|
-
isUncertain: boolean;
|
|
450
|
-
category: string | null;
|
|
451
|
-
type: string | null;
|
|
452
|
-
uuid: string | null;
|
|
372
|
+
type Webpage<T extends LanguageCodes = LanguageCodes> = {
|
|
373
|
+
uuid: string;
|
|
374
|
+
type: "page";
|
|
375
|
+
title: MultilingualString<T>;
|
|
376
|
+
slug: string;
|
|
453
377
|
publicationDateTime: Date | null;
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
})>;
|
|
470
|
-
/**
|
|
471
|
-
* Property in OCHRE
|
|
472
|
-
*/
|
|
473
|
-
type Property<T extends LanguageCodes = LanguageCodes> = {
|
|
474
|
-
variable: {
|
|
475
|
-
uuid: string;
|
|
476
|
-
label: MultilingualString<T>;
|
|
477
|
-
publicationDateTime: Date | null;
|
|
378
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
379
|
+
segments: Array<WebsiteSegment<T>>;
|
|
380
|
+
properties: {
|
|
381
|
+
width: "full" | "large" | "narrow" | "default";
|
|
382
|
+
variant: "default" | "no-background";
|
|
383
|
+
isBreadcrumbsDisplayed: boolean;
|
|
384
|
+
isSidebarDisplayed: boolean;
|
|
385
|
+
isDisplayedInNavbar: boolean;
|
|
386
|
+
isNavbarSearchBarDisplayed: boolean;
|
|
387
|
+
backgroundImage: WebImage<T> | null;
|
|
388
|
+
cssStyles: {
|
|
389
|
+
default: Array<Style>;
|
|
390
|
+
tablet: Array<Style>;
|
|
391
|
+
mobile: Array<Style>;
|
|
392
|
+
};
|
|
478
393
|
};
|
|
479
|
-
|
|
480
|
-
comment: MultilingualString<T> | null;
|
|
481
|
-
properties: Array<Property<T>>;
|
|
394
|
+
webpages: Array<Webpage<T>>;
|
|
482
395
|
};
|
|
483
396
|
/**
|
|
484
|
-
*
|
|
485
|
-
* expose scalar labels rather than multilingual labels.
|
|
397
|
+
* Represents a title with its label and variant
|
|
486
398
|
*/
|
|
487
|
-
type
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
399
|
+
type WebTitle<T extends LanguageCodes = LanguageCodes> = {
|
|
400
|
+
label: MultilingualString<T>;
|
|
401
|
+
variant: "default" | "simple";
|
|
402
|
+
properties: {
|
|
403
|
+
isNameDisplayed: boolean;
|
|
404
|
+
isDescriptionDisplayed: boolean;
|
|
405
|
+
isDateDisplayed: boolean;
|
|
406
|
+
isCreatorsDisplayed: boolean;
|
|
407
|
+
isCountDisplayed: boolean;
|
|
492
408
|
};
|
|
493
|
-
values: Array<PropertyValueContent<T>>;
|
|
494
|
-
comment: MultilingualString<T> | null;
|
|
495
|
-
properties: Array<SimplifiedProperty<T>>;
|
|
496
409
|
};
|
|
497
410
|
/**
|
|
498
|
-
*
|
|
499
|
-
*/
|
|
500
|
-
type SetItemProperty<T extends LanguageCodes = LanguageCodes> = Omit<Property<T>, "properties">;
|
|
501
|
-
type SetItemSimplifiedProperty<T extends LanguageCodes = LanguageCodes> = Omit<SimplifiedProperty<T>, "properties">;
|
|
502
|
-
type PropertyLike<T extends LanguageCodes = LanguageCodes> = Property<T> | SetItemProperty<T> | SimplifiedProperty<T> | SetItemSimplifiedProperty<T>;
|
|
503
|
-
type ItemProperty<T extends LanguageCodes = LanguageCodes> = Property<T> | SetItemProperty<T>;
|
|
504
|
-
type PropertyValueDataType = PropertyValueContent["dataType"];
|
|
505
|
-
type QueryablePropertyValueDataType = Exclude<PropertyValueDataType, "coordinate">;
|
|
506
|
-
type WithSetItemProperties<U extends {
|
|
507
|
-
properties: Array<Property<T>>;
|
|
508
|
-
}, T extends LanguageCodes> = U extends {
|
|
509
|
-
properties: Array<Property<T>>;
|
|
510
|
-
} ? Prettify<Omit<U, "properties"> & {
|
|
511
|
-
properties: Array<SetItemProperty<T>>;
|
|
512
|
-
}> : never;
|
|
513
|
-
/**
|
|
514
|
-
* Base item in OCHRE
|
|
411
|
+
* Base properties for web elements
|
|
515
412
|
*/
|
|
516
|
-
type
|
|
413
|
+
type WebElement<T extends LanguageCodes = LanguageCodes> = {
|
|
517
414
|
uuid: string;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
creators: Array<Person<T, "embedded">>;
|
|
527
|
-
description: MultilingualString<T> | null;
|
|
528
|
-
events: Array<Event<T>>;
|
|
529
|
-
};
|
|
530
|
-
type ItemLinkCategory = ItemCategory | "dictionaryUnit";
|
|
415
|
+
type: "element";
|
|
416
|
+
title: WebTitle<T>;
|
|
417
|
+
cssStyles: {
|
|
418
|
+
default: Array<Style>;
|
|
419
|
+
tablet: Array<Style>;
|
|
420
|
+
mobile: Array<Style>;
|
|
421
|
+
};
|
|
422
|
+
} & WebElementComponent<T>;
|
|
531
423
|
/**
|
|
532
|
-
*
|
|
424
|
+
* Union type of all possible web element components
|
|
533
425
|
*/
|
|
534
|
-
type
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
type BibliographySourceDocument = {
|
|
544
|
-
uuid: string;
|
|
545
|
-
content: string;
|
|
426
|
+
type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
427
|
+
component: "3d-viewer";
|
|
428
|
+
linkUuid: string;
|
|
429
|
+
fileSize: number | null;
|
|
430
|
+
isInteractive: boolean;
|
|
431
|
+
isControlsDisplayed: boolean;
|
|
432
|
+
} | {
|
|
433
|
+
component: "advanced-search";
|
|
434
|
+
boundElementUuid: string | null;
|
|
546
435
|
href: string | null;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
436
|
+
} | {
|
|
437
|
+
component: "annotated-document";
|
|
438
|
+
linkUuid: string;
|
|
439
|
+
} | {
|
|
440
|
+
component: "annotated-image";
|
|
441
|
+
linkUuid: string;
|
|
442
|
+
isFilterInputDisplayed: boolean;
|
|
443
|
+
isOptionsDisplayed: boolean;
|
|
444
|
+
isAnnotationHighlightsDisplayed: boolean;
|
|
445
|
+
isAnnotationTooltipsDisplayed: boolean;
|
|
446
|
+
} | {
|
|
447
|
+
component: "audio-player";
|
|
448
|
+
linkUuid: string;
|
|
449
|
+
isSpeedControlsDisplayed: boolean;
|
|
450
|
+
isVolumeControlsDisplayed: boolean;
|
|
451
|
+
isSeekBarDisplayed: boolean;
|
|
452
|
+
} | {
|
|
453
|
+
component: "bibliography";
|
|
454
|
+
linkUuids: Array<string>;
|
|
455
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
456
|
+
layout: "long" | "short";
|
|
457
|
+
isSourceDocumentDisplayed: boolean;
|
|
458
|
+
} | {
|
|
459
|
+
component: "entries";
|
|
460
|
+
linkUuid: string;
|
|
461
|
+
variant: "entry" | "item";
|
|
462
|
+
isFilterInputDisplayed: boolean;
|
|
463
|
+
} | {
|
|
464
|
+
component: "button";
|
|
465
|
+
variant: "default" | "transparent" | "link";
|
|
466
|
+
href: string;
|
|
467
|
+
isExternal: boolean;
|
|
468
|
+
label: MultilingualString<T> | null;
|
|
469
|
+
startIcon: string | null;
|
|
470
|
+
endIcon: string | null;
|
|
471
|
+
image: WebImage<T> | null;
|
|
472
|
+
} | {
|
|
473
|
+
component: "collection";
|
|
474
|
+
linkUuids: Array<string>;
|
|
475
|
+
displayedProperties: Array<{
|
|
476
|
+
uuid: string;
|
|
477
|
+
label: MultilingualString<T> | null;
|
|
478
|
+
}> | null;
|
|
479
|
+
variant: "slide" | "table" | "card" | "tile" | "showcase";
|
|
480
|
+
paginationVariant: "default" | "numeric";
|
|
481
|
+
loadingVariant: "spinner" | "skeleton" | "animation" | "none";
|
|
482
|
+
imageLayout: "top" | "bottom" | "start" | "end" | null;
|
|
483
|
+
isSortDisplayed: boolean;
|
|
484
|
+
isUsingQueryParams: boolean;
|
|
485
|
+
filter: {
|
|
486
|
+
isSidebarDisplayed: boolean;
|
|
487
|
+
isResultsBarDisplayed: boolean;
|
|
488
|
+
isInputDisplayed: boolean;
|
|
489
|
+
isLimitedToInputFilter: boolean;
|
|
490
|
+
isLimitedToLeafPropertyValues: boolean;
|
|
491
|
+
sidebarSort: "default" | "alphabetical";
|
|
492
|
+
};
|
|
493
|
+
options: {
|
|
494
|
+
scopes: Array<Scope<T>> | null;
|
|
495
|
+
contextTree: ContextTree<T> | null;
|
|
496
|
+
labels: {
|
|
497
|
+
title: MultilingualString<T> | null;
|
|
498
|
+
};
|
|
499
|
+
};
|
|
500
|
+
} | {
|
|
501
|
+
component: "empty-space";
|
|
502
|
+
height: string | null;
|
|
503
|
+
width: string | null;
|
|
504
|
+
} | {
|
|
505
|
+
component: "iframe";
|
|
506
|
+
href: string;
|
|
507
|
+
height: string | null;
|
|
508
|
+
width: string | null;
|
|
509
|
+
} | {
|
|
510
|
+
component: "iiif-viewer";
|
|
511
|
+
linkUuid: string;
|
|
512
|
+
variant: "universal-viewer" | "clover";
|
|
513
|
+
} | {
|
|
514
|
+
component: "image";
|
|
515
|
+
images: Array<WebImage<T>>;
|
|
516
|
+
variant: "default" | "carousel" | "grid" | "hero";
|
|
517
|
+
width: number | null;
|
|
518
|
+
height: number | null;
|
|
519
|
+
isFullWidth: boolean;
|
|
520
|
+
isFullHeight: boolean;
|
|
521
|
+
imageQuality: "high" | "low";
|
|
522
|
+
captionSource: "name" | "abbreviation" | "description";
|
|
523
|
+
captionLayout: "top" | "bottom" | "inset" | "suppress";
|
|
524
|
+
altTextSource: "name" | "abbreviation" | "description";
|
|
525
|
+
isTransparentBackground: boolean;
|
|
526
|
+
isCover: boolean;
|
|
527
|
+
carouselOptions: {
|
|
528
|
+
secondsPerImage: number;
|
|
577
529
|
} | null;
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
530
|
+
heroOptions: {
|
|
531
|
+
isBackgroundImageDisplayed: boolean;
|
|
532
|
+
isDocumentDisplayed: boolean;
|
|
533
|
+
} | null;
|
|
534
|
+
} | {
|
|
535
|
+
component: "image-gallery";
|
|
536
|
+
linkUuid: string;
|
|
537
|
+
isFilterInputDisplayed: boolean;
|
|
538
|
+
} | {
|
|
539
|
+
component: "map";
|
|
540
|
+
linkUuid: string;
|
|
541
|
+
customBasemap: string | null;
|
|
542
|
+
initialBounds: [[number, number], [number, number]] | null;
|
|
543
|
+
maximumBounds: [[number, number], [number, number]] | null;
|
|
544
|
+
isControlsDisplayed: boolean;
|
|
545
|
+
isInteractive: boolean;
|
|
546
|
+
isClustered: boolean;
|
|
547
|
+
isUsingPins: boolean;
|
|
548
|
+
isFullHeight: boolean;
|
|
549
|
+
} | {
|
|
550
|
+
component: "query";
|
|
551
|
+
linkUuids: Array<string>;
|
|
552
|
+
items: Array<{
|
|
553
|
+
label: MultilingualString<T>;
|
|
554
|
+
queries: Array<WebsitePropertyQuery<T>>;
|
|
555
|
+
startIcon: string | null;
|
|
556
|
+
endIcon: string | null;
|
|
557
|
+
}>;
|
|
558
|
+
options: {
|
|
559
|
+
scopes: Array<Scope<T>> | null;
|
|
560
|
+
contextTree: ContextTree<T> | null;
|
|
561
|
+
labels: {
|
|
562
|
+
title: MultilingualString<T> | null;
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
collectionProperties: {
|
|
566
|
+
displayedProperties: Extract<WebElementComponent<T>, {
|
|
567
|
+
component: "collection";
|
|
568
|
+
}>["displayedProperties"];
|
|
569
|
+
variant: Extract<WebElementComponent<T>, {
|
|
570
|
+
component: "collection";
|
|
571
|
+
}>["variant"];
|
|
572
|
+
paginationVariant: Extract<WebElementComponent<T>, {
|
|
573
|
+
component: "collection";
|
|
574
|
+
}>["paginationVariant"];
|
|
575
|
+
loadingVariant: Extract<WebElementComponent<T>, {
|
|
576
|
+
component: "collection";
|
|
577
|
+
}>["loadingVariant"];
|
|
578
|
+
imageLayout: Extract<WebElementComponent<T>, {
|
|
579
|
+
component: "collection";
|
|
580
|
+
}>["imageLayout"];
|
|
581
|
+
};
|
|
582
|
+
} | {
|
|
583
|
+
component: "search-bar";
|
|
584
|
+
queryVariant: "submit" | "change";
|
|
585
|
+
placeholder: MultilingualString<T> | null;
|
|
586
|
+
baseFilterQueries: string | null;
|
|
587
|
+
boundElementUuid: string | null;
|
|
609
588
|
href: string | null;
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
589
|
+
} | {
|
|
590
|
+
component: "table";
|
|
591
|
+
linkUuid: string;
|
|
592
|
+
} | {
|
|
593
|
+
component: "text";
|
|
594
|
+
variant: {
|
|
595
|
+
name: "title" | "block" | "banner";
|
|
596
|
+
} | {
|
|
597
|
+
name: "paragraph";
|
|
598
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
599
|
+
} | {
|
|
600
|
+
name: "label";
|
|
601
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
602
|
+
} | {
|
|
603
|
+
name: "heading";
|
|
604
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
605
|
+
} | {
|
|
606
|
+
name: "display";
|
|
607
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
608
|
+
};
|
|
609
|
+
headingLevel: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
|
|
610
|
+
content: MultilingualString<T>;
|
|
611
|
+
} | {
|
|
612
|
+
component: "timeline";
|
|
613
|
+
linkUuid: string;
|
|
614
|
+
} | {
|
|
615
|
+
component: "video";
|
|
616
|
+
linkUuid: string;
|
|
617
|
+
isChaptersDisplayed: boolean;
|
|
618
|
+
};
|
|
619
|
+
type WebElementComponentName = WebElementComponent["component"];
|
|
620
|
+
type WebElementComponentOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElementComponent<T>, {
|
|
621
|
+
component: U;
|
|
618
622
|
}>;
|
|
619
|
-
type
|
|
620
|
-
|
|
621
|
-
text: string | null;
|
|
622
|
-
language: string | null;
|
|
623
|
-
image: Image<T> | null;
|
|
624
|
-
coordinates: Array<Coordinates<T>>;
|
|
623
|
+
type WebElementOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElement<T>, {
|
|
624
|
+
component: U;
|
|
625
625
|
}>;
|
|
626
|
-
type DictionaryUnitItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"dictionaryUnit", T>>;
|
|
627
626
|
/**
|
|
628
|
-
*
|
|
627
|
+
* Represents an image used in web elements
|
|
629
628
|
*/
|
|
630
|
-
type
|
|
629
|
+
type WebImage<T extends LanguageCodes = LanguageCodes> = {
|
|
630
|
+
uuid: string | null;
|
|
631
|
+
label: MultilingualString<T> | null;
|
|
632
|
+
description: MultilingualString<T> | null;
|
|
633
|
+
width: number;
|
|
634
|
+
height: number;
|
|
635
|
+
quality: "low" | "high";
|
|
636
|
+
};
|
|
631
637
|
/**
|
|
632
|
-
*
|
|
638
|
+
* Represents a CSS style with label and value
|
|
633
639
|
*/
|
|
634
|
-
type
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
640
|
+
type Style = {
|
|
641
|
+
label: string;
|
|
642
|
+
value: string;
|
|
643
|
+
};
|
|
644
|
+
type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "horizontal-flex" | "accordion";
|
|
638
645
|
/**
|
|
639
|
-
*
|
|
646
|
+
* Represents a block of vertical or horizontal content alignment
|
|
640
647
|
*/
|
|
641
|
-
type
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
648
|
+
type WebBlock<T extends LanguageCodes = LanguageCodes, U extends WebBlockLayout = WebBlockLayout> = {
|
|
649
|
+
uuid: string;
|
|
650
|
+
type: "block";
|
|
651
|
+
title: WebTitle<T>;
|
|
652
|
+
items: U extends "accordion" ? Array<Extract<WebElement<T>, {
|
|
653
|
+
component: "text";
|
|
654
|
+
}> & {
|
|
655
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
656
|
+
}> : Array<WebElement<T> | WebBlock<T>>;
|
|
657
|
+
properties: {
|
|
658
|
+
default: {
|
|
659
|
+
layout: U;
|
|
660
|
+
wrap: "nowrap" | "wrap" | "wrap-reverse";
|
|
661
|
+
/**
|
|
662
|
+
* valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
|
|
663
|
+
*/
|
|
664
|
+
spacing: string | null;
|
|
665
|
+
/**
|
|
666
|
+
* `gap` CSS property value
|
|
667
|
+
*/
|
|
668
|
+
gap: string | null;
|
|
669
|
+
isAccordionEnabled: U extends "accordion" ? boolean : never;
|
|
670
|
+
isAccordionExpandedByDefault: U extends "accordion" ? boolean : never;
|
|
671
|
+
isAccordionSidebarDisplayed: U extends "accordion" ? boolean : never;
|
|
672
|
+
};
|
|
673
|
+
tablet: Partial<WebBlock<T>["properties"]["default"]> | null;
|
|
674
|
+
mobile: Partial<WebBlock<T>["properties"]["default"]> | null;
|
|
675
|
+
};
|
|
676
|
+
cssStyles: {
|
|
677
|
+
default: Array<Style>;
|
|
678
|
+
tablet: Array<Style>;
|
|
679
|
+
mobile: Array<Style>;
|
|
680
|
+
};
|
|
645
681
|
};
|
|
682
|
+
type WebBlockByLayout<U extends WebBlockLayout = WebBlockLayout, T extends LanguageCodes = LanguageCodes> = WebBlock<T, U>;
|
|
683
|
+
type AccordionWebBlock<T extends LanguageCodes = LanguageCodes> = WebBlock<T, "accordion">;
|
|
684
|
+
//#endregion
|
|
685
|
+
//#region src/types/index.d.ts
|
|
686
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
646
687
|
/**
|
|
647
|
-
*
|
|
688
|
+
* Language-code tuple or array used by OCHRE multilingual fields.
|
|
689
|
+
*
|
|
690
|
+
* Use the default when the consumer does not need to narrow a value to a
|
|
691
|
+
* specific language tuple.
|
|
648
692
|
*/
|
|
649
|
-
type
|
|
650
|
-
type: string | null;
|
|
651
|
-
containedItemCategory: U | null;
|
|
652
|
-
links: ItemLinks<T>;
|
|
653
|
-
notes: Array<Note<T>>;
|
|
654
|
-
properties: Array<Property<T>>;
|
|
655
|
-
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
656
|
-
items: U extends HeadingItemCategory ? Array<Heading<U, T> | Item<U, never, T, "embedded">> : Array<Item<U, never, T, "embedded">>;
|
|
657
|
-
}>;
|
|
693
|
+
type LanguageCodes = ReadonlyArray<string>;
|
|
658
694
|
/**
|
|
659
|
-
*
|
|
695
|
+
* The category of an item in OCHRE
|
|
660
696
|
*/
|
|
661
|
-
type
|
|
662
|
-
containedItemCategories: Array<U>;
|
|
663
|
-
isTabularStructure: boolean;
|
|
664
|
-
isSuppressingBlanks: boolean;
|
|
665
|
-
links: ItemLinks<T>;
|
|
666
|
-
notes: Array<Note<T>>;
|
|
667
|
-
properties: Array<Property<T>>;
|
|
668
|
-
items: Array<SetItem<U, T>>;
|
|
669
|
-
}>;
|
|
670
|
-
type SetBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded"> extends infer U ? U extends {
|
|
671
|
-
properties: Array<Property<T>>;
|
|
672
|
-
} ? Prettify<Omit<U, "properties" | "items"> & {
|
|
673
|
-
properties: Array<SetItemProperty<T>>;
|
|
674
|
-
}> : never : never;
|
|
675
|
-
type SetConcept<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<Concept<T, "embedded">, "interpretations" | "items"> & {
|
|
676
|
-
properties: Array<SetItemProperty<T>>;
|
|
677
|
-
}>;
|
|
678
|
-
type SetSpatialUnit<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<SpatialUnit<T, "embedded">, "observations" | "items"> & {
|
|
679
|
-
properties: Array<SetItemProperty<T>>;
|
|
680
|
-
}>;
|
|
681
|
-
type SetPeriod<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Period<T, "embedded">, T>, "items">>;
|
|
682
|
-
type SetResource<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Resource<T, "embedded">, T>, "items">>;
|
|
683
|
-
type SetTree<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Tree<TreeItemCategory, T, "embedded">, T>, "items">>;
|
|
684
|
-
type SetItem<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = U extends "tree" ? SetTree<T> : U extends "bibliography" ? SetBibliography<T> : U extends "concept" ? SetConcept<T> : U extends "spatialUnit" ? SetSpatialUnit<T> : U extends "period" ? SetPeriod<T> : U extends "person" ? WithSetItemProperties<Person<T, "embedded">, T> : U extends "propertyVariable" ? PropertyVariable<T, "embedded"> : U extends "propertyValue" ? WithSetItemProperties<PropertyValue<T, "embedded">, T> : U extends "resource" ? SetResource<T> : U extends "text" ? Text<T, "embedded"> : U extends "set" ? Omit<WithSetItemProperties<Set<SetItemCategory, T, "embedded">, T>, "items"> : never;
|
|
697
|
+
type ItemCategory = "tree" | "bibliography" | "concept" | "spatialUnit" | "period" | "person" | "propertyVariable" | "propertyValue" | "resource" | "text" | "set";
|
|
685
698
|
/**
|
|
686
|
-
*
|
|
699
|
+
* OCHRE item categories that can contain other items in API payloads.
|
|
687
700
|
*/
|
|
688
|
-
type
|
|
689
|
-
type: string;
|
|
690
|
-
image: Image<T> | null;
|
|
691
|
-
address: {
|
|
692
|
-
country: string | null;
|
|
693
|
-
city: string | null;
|
|
694
|
-
state: string | null;
|
|
695
|
-
postalCode: string | null;
|
|
696
|
-
} | null;
|
|
697
|
-
coordinates: Array<Coordinates<T>>;
|
|
698
|
-
content: MultilingualString<T> | null;
|
|
699
|
-
periods: Array<Period<T, "embedded">>;
|
|
700
|
-
links: ItemLinks<T>;
|
|
701
|
-
notes: Array<Note<T>>;
|
|
702
|
-
properties: Array<Property<T>>;
|
|
703
|
-
}>;
|
|
701
|
+
type ItemContainerCategory = Extract<ItemCategory, "tree" | "set">;
|
|
704
702
|
/**
|
|
705
|
-
*
|
|
703
|
+
* The category of items in a Tree
|
|
706
704
|
*/
|
|
707
|
-
type
|
|
708
|
-
type: string | null;
|
|
709
|
-
coordinates: Array<Coordinates<T>>;
|
|
710
|
-
links: ItemLinks<T>;
|
|
711
|
-
notes: Array<Note<T>>;
|
|
712
|
-
properties: Array<Property<T>>;
|
|
713
|
-
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
714
|
-
items: Array<Period<T, "embedded">>;
|
|
715
|
-
}>;
|
|
705
|
+
type TreeItemCategory = Exclude<ItemCategory, "tree">;
|
|
716
706
|
/**
|
|
717
|
-
*
|
|
707
|
+
* The category of items in a Set
|
|
718
708
|
*/
|
|
719
|
-
type
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
referenceFormatDiv: string | null;
|
|
724
|
-
image: Image<T> | null;
|
|
725
|
-
sourceDocument: BibliographySourceDocument | null;
|
|
726
|
-
publicationInfo: {
|
|
727
|
-
publishers: Array<Person<T, "embedded">>;
|
|
728
|
-
startDate: Date | null;
|
|
729
|
-
} | null;
|
|
730
|
-
entryInfo: BibliographyEntryInfo | null;
|
|
731
|
-
source: ItemLink<TreeItemCategory, T> | null;
|
|
732
|
-
authors: Array<Person<T, "embedded">>;
|
|
733
|
-
periods: Array<Period<T, "embedded">>;
|
|
734
|
-
links: ItemLinks<T>;
|
|
735
|
-
notes: Array<Note<T>>;
|
|
736
|
-
properties: Array<Property<T>>;
|
|
737
|
-
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
738
|
-
items: Array<Bibliography<T, "embedded">>;
|
|
739
|
-
} & ({
|
|
740
|
-
type: "zotero";
|
|
741
|
-
zoteroId: string;
|
|
742
|
-
uuid: string | null;
|
|
743
|
-
} | {
|
|
744
|
-
type: string | null;
|
|
745
|
-
})>;
|
|
709
|
+
type SetItemCategory = ItemCategory;
|
|
710
|
+
type ContainedItemCategory<U extends ItemCategory = ItemCategory> = U extends "tree" ? TreeItemCategory : U extends "set" ? SetItemCategory : never;
|
|
711
|
+
type ContainedItemCategoryOption<U extends ItemCategory = ItemCategory> = U extends "tree" ? TreeItemCategory : U extends "set" ? SetItemCategory | ReadonlyArray<SetItemCategory> : never;
|
|
712
|
+
type ContainedItemCategoryFromOption<U extends ItemCategory = ItemCategory, V extends ContainedItemCategoryOption<U> | undefined = undefined> = V extends ReadonlyArray<infer W> ? Extract<W, ContainedItemCategory<U>> : V extends ContainedItemCategory<U> ? V : ContainedItemCategory<U>;
|
|
746
713
|
/**
|
|
747
|
-
*
|
|
714
|
+
* The category of items in a heading
|
|
748
715
|
*/
|
|
749
|
-
type
|
|
750
|
-
image: Image<T> | null;
|
|
751
|
-
interpretations: Array<Interpretation<T>>;
|
|
752
|
-
coordinates: Array<Coordinates<T>>;
|
|
753
|
-
items: Array<Concept<T, "embedded">>;
|
|
754
|
-
}>;
|
|
716
|
+
type HeadingItemCategory = Exclude<ItemCategory, "tree" | "bibliography" | "spatialUnit" | "concept" | "period">;
|
|
755
717
|
/**
|
|
756
|
-
*
|
|
718
|
+
* The category of items that expose recursive subitem structures.
|
|
757
719
|
*/
|
|
758
|
-
type
|
|
759
|
-
number: number;
|
|
760
|
-
date: Date | null;
|
|
761
|
-
observers: Array<Person<T, "embedded">>;
|
|
762
|
-
periods: Array<Period<T, "embedded">>;
|
|
763
|
-
links: ItemLinks<T>;
|
|
764
|
-
notes: Array<Note<T>>;
|
|
765
|
-
properties: Array<Property<T>>;
|
|
766
|
-
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
767
|
-
};
|
|
720
|
+
type RecursiveItemCategory = Exclude<ItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
|
|
768
721
|
/**
|
|
769
|
-
*
|
|
722
|
+
* The category names that can appear in OCHRE context paths
|
|
770
723
|
*/
|
|
771
|
-
type
|
|
772
|
-
image: Image<T> | null;
|
|
773
|
-
coordinates: Array<Coordinates<T>>;
|
|
774
|
-
mapData: {
|
|
775
|
-
geoJSON: {
|
|
776
|
-
multiPolygon: string;
|
|
777
|
-
EPSG: number;
|
|
778
|
-
};
|
|
779
|
-
} | null;
|
|
780
|
-
observations: Array<Observation<T>>;
|
|
781
|
-
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
782
|
-
items: Array<SpatialUnit<T, "embedded">>;
|
|
783
|
-
}>;
|
|
724
|
+
type ContextItemCategory = Exclude<ItemCategory, "tree" | "person" | "set">;
|
|
784
725
|
/**
|
|
785
|
-
*
|
|
726
|
+
* Basic identification information
|
|
786
727
|
*/
|
|
787
|
-
type
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
notes: Array<Note<T>>;
|
|
794
|
-
properties: Array<Property<T>>;
|
|
795
|
-
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
728
|
+
type Identification<T extends LanguageCodes = LanguageCodes> = {
|
|
729
|
+
label: MultilingualString<T>;
|
|
730
|
+
abbreviation: MultilingualString<T> | null;
|
|
731
|
+
code: string | null;
|
|
732
|
+
email: string | null;
|
|
733
|
+
website: string | null;
|
|
796
734
|
};
|
|
797
735
|
/**
|
|
798
|
-
*
|
|
736
|
+
* Metadata in OCHRE
|
|
799
737
|
*/
|
|
800
|
-
type
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
738
|
+
type Metadata<T extends LanguageCodes = LanguageCodes> = {
|
|
739
|
+
dataset: string;
|
|
740
|
+
description: string;
|
|
741
|
+
publisher: string;
|
|
742
|
+
identifier: string;
|
|
743
|
+
project: {
|
|
744
|
+
uuid: string;
|
|
745
|
+
identification: Identification<T>;
|
|
746
|
+
website: string | null;
|
|
747
|
+
dateFormat: string | null;
|
|
748
|
+
page: "item" | "entry" | null;
|
|
749
|
+
} | null;
|
|
750
|
+
collection: {
|
|
751
|
+
uuid: string;
|
|
752
|
+
identification: Identification<T>;
|
|
753
|
+
page: "item" | "entry";
|
|
754
|
+
} | null;
|
|
755
|
+
publication: {
|
|
756
|
+
uuid: string;
|
|
757
|
+
identification: Identification<T>;
|
|
758
|
+
page: "item" | "entry";
|
|
759
|
+
} | null;
|
|
760
|
+
item: {
|
|
761
|
+
identification: Identification<T>;
|
|
762
|
+
category: string;
|
|
763
|
+
type: string;
|
|
764
|
+
maxLength: number | null;
|
|
765
|
+
} | null;
|
|
766
|
+
defaultLanguage: T[number];
|
|
767
|
+
languages: T;
|
|
768
|
+
};
|
|
769
|
+
type BelongsTo = {
|
|
770
|
+
uuid: string;
|
|
771
|
+
abbreviation: string;
|
|
772
|
+
};
|
|
773
|
+
type ItemPayloadKind = "topLevel" | "embedded";
|
|
774
|
+
type ItemEnvelopeFields<T extends LanguageCodes, U extends ItemPayloadKind> = U extends "topLevel" ? {
|
|
775
|
+
belongsTo: BelongsTo;
|
|
776
|
+
metadata: Metadata<T>;
|
|
777
|
+
persistentUrl: string | null;
|
|
778
|
+
} : {
|
|
779
|
+
belongsTo: null;
|
|
780
|
+
metadata: null;
|
|
781
|
+
persistentUrl: null;
|
|
782
|
+
};
|
|
807
783
|
/**
|
|
808
|
-
*
|
|
784
|
+
* License in OCHRE
|
|
809
785
|
*/
|
|
810
|
-
type
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
properties: Array<Property<T>>;
|
|
815
|
-
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
816
|
-
}>;
|
|
786
|
+
type License = {
|
|
787
|
+
content: string;
|
|
788
|
+
target: string | null;
|
|
789
|
+
};
|
|
817
790
|
/**
|
|
818
|
-
*
|
|
791
|
+
* Context item in OCHRE
|
|
819
792
|
*/
|
|
820
|
-
type
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
height: number | null;
|
|
827
|
-
width: number | null;
|
|
828
|
-
image: Image<T> | null;
|
|
829
|
-
document: MultilingualString<T> | null;
|
|
830
|
-
imageMap: ImageMap | null;
|
|
831
|
-
coordinates: Array<Coordinates<T>>;
|
|
832
|
-
periods: Array<Period<T, "embedded">>;
|
|
833
|
-
links: ItemLinks<T>;
|
|
834
|
-
reverseLinks: ItemLinks<T>;
|
|
835
|
-
notes: Array<Note<T>>;
|
|
836
|
-
properties: Array<Property<T>>;
|
|
837
|
-
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
838
|
-
items: Array<Resource<T, "embedded">>;
|
|
839
|
-
}>;
|
|
793
|
+
type ContextItem = {
|
|
794
|
+
uuid: string | null;
|
|
795
|
+
publicationDateTime: Date | null;
|
|
796
|
+
index: number;
|
|
797
|
+
content: string;
|
|
798
|
+
};
|
|
840
799
|
/**
|
|
841
|
-
*
|
|
800
|
+
* Context node in OCHRE
|
|
842
801
|
*/
|
|
843
|
-
type
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
coordinates: Array<Coordinates<T>>;
|
|
849
|
-
links: ItemLinks<T>;
|
|
850
|
-
reverseLinks: ItemLinks<T>;
|
|
851
|
-
notes: Array<Note<T>>;
|
|
852
|
-
sections: Array<Section<T>>;
|
|
853
|
-
periods: Array<Period<T, "embedded">>;
|
|
854
|
-
creators: Array<Person<T, "embedded">>;
|
|
855
|
-
editions: Array<Person<T, "embedded">>;
|
|
856
|
-
}>;
|
|
802
|
+
type ContextNode<U extends ContextItemCategory = ContextItemCategory> = {
|
|
803
|
+
tree: ContextItem;
|
|
804
|
+
project: ContextItem;
|
|
805
|
+
heading: Array<ContextItem>;
|
|
806
|
+
} & Partial<Record<U, Array<ContextItem>>>;
|
|
857
807
|
/**
|
|
858
|
-
*
|
|
808
|
+
* Context in OCHRE
|
|
859
809
|
*/
|
|
860
|
-
type
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
identification: Identification<T>;
|
|
864
|
-
project: {
|
|
865
|
-
identification: Identification<T>;
|
|
866
|
-
} | null;
|
|
810
|
+
type Context<U extends ContextItemCategory = ContextItemCategory> = {
|
|
811
|
+
nodes: Array<ContextNode<U>>;
|
|
812
|
+
displayPath: string;
|
|
867
813
|
};
|
|
868
|
-
type EmbeddedTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, "embedded">;
|
|
869
|
-
type AnyTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, ItemPayloadKind>;
|
|
870
|
-
type EmbeddedSet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, "embedded">;
|
|
871
|
-
type AnySet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, ItemPayloadKind>;
|
|
872
|
-
type EmbeddedBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded">;
|
|
873
|
-
type AnyBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, ItemPayloadKind>;
|
|
874
|
-
type EmbeddedConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, "embedded">;
|
|
875
|
-
type AnyConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, ItemPayloadKind>;
|
|
876
|
-
type EmbeddedSpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, "embedded">;
|
|
877
|
-
type AnySpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, ItemPayloadKind>;
|
|
878
|
-
type EmbeddedPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, "embedded">;
|
|
879
|
-
type AnyPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, ItemPayloadKind>;
|
|
880
|
-
type EmbeddedPerson<T extends LanguageCodes = LanguageCodes> = Person<T, "embedded">;
|
|
881
|
-
type AnyPerson<T extends LanguageCodes = LanguageCodes> = Person<T, ItemPayloadKind>;
|
|
882
|
-
type EmbeddedPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, "embedded">;
|
|
883
|
-
type AnyPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, ItemPayloadKind>;
|
|
884
|
-
type EmbeddedPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, "embedded">;
|
|
885
|
-
type AnyPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, ItemPayloadKind>;
|
|
886
|
-
type EmbeddedResource<T extends LanguageCodes = LanguageCodes> = Resource<T, "embedded">;
|
|
887
|
-
type AnyResource<T extends LanguageCodes = LanguageCodes> = Resource<T, ItemPayloadKind>;
|
|
888
|
-
type EmbeddedText<T extends LanguageCodes = LanguageCodes> = Text<T, "embedded">;
|
|
889
|
-
type AnyText<T extends LanguageCodes = LanguageCodes> = Text<T, ItemPayloadKind>;
|
|
890
814
|
/**
|
|
891
|
-
*
|
|
815
|
+
* Event in OCHRE
|
|
892
816
|
*/
|
|
893
|
-
type
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
817
|
+
type Event<T extends LanguageCodes = LanguageCodes> = {
|
|
818
|
+
date: Date | {
|
|
819
|
+
start: Date;
|
|
820
|
+
end: Date;
|
|
821
|
+
} | null;
|
|
822
|
+
label: MultilingualString<T>;
|
|
823
|
+
comment: MultilingualString<T> | null;
|
|
824
|
+
agent: {
|
|
825
|
+
uuid: string;
|
|
826
|
+
label: MultilingualString<T>;
|
|
827
|
+
publicationDateTime: Date | null;
|
|
828
|
+
} | null;
|
|
829
|
+
location: {
|
|
830
|
+
uuid: string;
|
|
831
|
+
label: MultilingualString<T>;
|
|
832
|
+
publicationDateTime: Date | null;
|
|
833
|
+
} | null;
|
|
834
|
+
other: {
|
|
835
|
+
uuid: string | null;
|
|
836
|
+
category: string | null;
|
|
837
|
+
label: MultilingualString<T>;
|
|
838
|
+
} | null;
|
|
898
839
|
};
|
|
899
840
|
/**
|
|
900
|
-
*
|
|
841
|
+
* Source of coordinates in OCHRE
|
|
901
842
|
*/
|
|
902
|
-
type
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
843
|
+
type CoordinatesSource<T extends LanguageCodes = LanguageCodes> = {
|
|
844
|
+
context: "self";
|
|
845
|
+
uuid: string;
|
|
846
|
+
label: MultilingualString<T>;
|
|
847
|
+
} | {
|
|
848
|
+
context: "related";
|
|
849
|
+
uuid: string;
|
|
850
|
+
label: MultilingualString<T>;
|
|
851
|
+
value: MultilingualString<T>;
|
|
852
|
+
} | {
|
|
853
|
+
context: "inherited";
|
|
854
|
+
item: {
|
|
855
|
+
uuid: string | null;
|
|
856
|
+
label: MultilingualString<T>;
|
|
857
|
+
};
|
|
858
|
+
uuid: string;
|
|
859
|
+
label: MultilingualString<T>;
|
|
907
860
|
};
|
|
908
861
|
/**
|
|
909
|
-
*
|
|
862
|
+
* Coordinates in OCHRE
|
|
910
863
|
*/
|
|
911
|
-
type
|
|
912
|
-
|
|
913
|
-
|
|
864
|
+
type Coordinates<T extends LanguageCodes = LanguageCodes> = {
|
|
865
|
+
type: "point";
|
|
866
|
+
latitude: number;
|
|
867
|
+
longitude: number;
|
|
868
|
+
altitude: number | null;
|
|
869
|
+
source: CoordinatesSource<T> | null;
|
|
870
|
+
} | {
|
|
871
|
+
type: "plane";
|
|
872
|
+
minimum: {
|
|
873
|
+
latitude: number;
|
|
874
|
+
longitude: number;
|
|
875
|
+
};
|
|
876
|
+
maximum: {
|
|
877
|
+
latitude: number;
|
|
878
|
+
longitude: number;
|
|
879
|
+
};
|
|
880
|
+
source: CoordinatesSource<T> | null;
|
|
914
881
|
};
|
|
915
882
|
/**
|
|
916
|
-
*
|
|
917
|
-
*/
|
|
918
|
-
type SetItemsSortDirection = "asc" | "desc";
|
|
919
|
-
/**
|
|
920
|
-
* Represents sorting options for Set items
|
|
883
|
+
* Image in OCHRE
|
|
921
884
|
*/
|
|
922
|
-
type
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
dataType: QueryablePropertyValueDataType;
|
|
932
|
-
direction?: SetItemsSortDirection;
|
|
933
|
-
language?: string;
|
|
885
|
+
type Image<T extends LanguageCodes = LanguageCodes> = {
|
|
886
|
+
publicationDateTime: Date | null;
|
|
887
|
+
identification: Identification<T> | null;
|
|
888
|
+
href: string | null;
|
|
889
|
+
htmlImgSrcPrefix: string | null;
|
|
890
|
+
height: number | null;
|
|
891
|
+
width: number | null;
|
|
892
|
+
fileSize: number | null;
|
|
893
|
+
base64: string | null;
|
|
934
894
|
};
|
|
935
895
|
/**
|
|
936
|
-
*
|
|
896
|
+
* Area of an image map in OCHRE
|
|
937
897
|
*/
|
|
938
|
-
type
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
language: string;
|
|
959
|
-
isNegated?: boolean;
|
|
960
|
-
} | {
|
|
961
|
-
target: "property";
|
|
962
|
-
propertyVariable: string;
|
|
963
|
-
dataType: "date" | "dateTime";
|
|
964
|
-
value?: never;
|
|
965
|
-
from: string;
|
|
966
|
-
to?: string;
|
|
967
|
-
matchMode: "includes" | "exact";
|
|
968
|
-
isCaseSensitive: boolean;
|
|
969
|
-
language: string;
|
|
970
|
-
isNegated?: boolean;
|
|
971
|
-
} | {
|
|
972
|
-
target: "property";
|
|
973
|
-
propertyVariable: string;
|
|
974
|
-
dataType: "date" | "dateTime";
|
|
975
|
-
value?: never;
|
|
976
|
-
from?: string;
|
|
977
|
-
to: string;
|
|
978
|
-
matchMode: "includes" | "exact";
|
|
979
|
-
isCaseSensitive: boolean;
|
|
980
|
-
language: string;
|
|
981
|
-
isNegated?: boolean;
|
|
982
|
-
} | {
|
|
983
|
-
target: "property";
|
|
984
|
-
propertyVariable?: string;
|
|
985
|
-
dataType: "all";
|
|
986
|
-
value: string;
|
|
987
|
-
matchMode: "includes" | "exact";
|
|
988
|
-
isCaseSensitive: boolean;
|
|
989
|
-
language: string;
|
|
990
|
-
isNegated?: boolean;
|
|
991
|
-
} | {
|
|
992
|
-
target: "string";
|
|
993
|
-
value: string;
|
|
994
|
-
matchMode: "includes" | "exact";
|
|
995
|
-
isCaseSensitive: boolean;
|
|
996
|
-
language: string;
|
|
997
|
-
isNegated?: boolean;
|
|
998
|
-
} | {
|
|
999
|
-
target: "title" | "description" | "image" | "periods" | "bibliography" | "notes";
|
|
1000
|
-
value: string;
|
|
1001
|
-
matchMode: "includes" | "exact";
|
|
1002
|
-
isCaseSensitive: boolean;
|
|
1003
|
-
language: string;
|
|
1004
|
-
isNegated?: boolean;
|
|
898
|
+
type ImageMapArea = {
|
|
899
|
+
uuid: string;
|
|
900
|
+
publicationDateTime: Date | null;
|
|
901
|
+
type: string;
|
|
902
|
+
title: string;
|
|
903
|
+
slug: string | null;
|
|
904
|
+
items: Array<{
|
|
905
|
+
shape: "rectangle";
|
|
906
|
+
coords: [number, number, number, number];
|
|
907
|
+
} | {
|
|
908
|
+
shape: "circle";
|
|
909
|
+
center: {
|
|
910
|
+
x: number;
|
|
911
|
+
y: number;
|
|
912
|
+
};
|
|
913
|
+
radius: number;
|
|
914
|
+
} | {
|
|
915
|
+
shape: "polygon";
|
|
916
|
+
coords: Array<number>;
|
|
917
|
+
}>;
|
|
1005
918
|
};
|
|
1006
919
|
/**
|
|
1007
|
-
*
|
|
920
|
+
* Image map in OCHRE
|
|
1008
921
|
*/
|
|
1009
|
-
type
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
922
|
+
type ImageMap = {
|
|
923
|
+
areas: Array<ImageMapArea>;
|
|
924
|
+
width: number;
|
|
925
|
+
height: number;
|
|
1013
926
|
};
|
|
1014
927
|
/**
|
|
1015
|
-
*
|
|
928
|
+
* Note in OCHRE
|
|
1016
929
|
*/
|
|
1017
|
-
type
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
languages?: TLanguages;
|
|
1023
|
-
fetch?: FetchFunction$4;
|
|
930
|
+
type Note<T extends LanguageCodes = LanguageCodes> = {
|
|
931
|
+
number: number;
|
|
932
|
+
title: MultilingualString<T> | null;
|
|
933
|
+
content: MultilingualString<T>;
|
|
934
|
+
authors: Array<Person<T, "embedded">>;
|
|
1024
935
|
};
|
|
1025
|
-
type FetchGalleryLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
1026
936
|
/**
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1029
|
-
* @param params - The parameters for the fetch
|
|
1030
|
-
* @param params.uuid - The UUID of the gallery
|
|
1031
|
-
* @param params.filter - The filter to apply to the gallery
|
|
1032
|
-
* @param params.page - The page number to fetch
|
|
1033
|
-
* @param params.perPage - The number of items per page
|
|
1034
|
-
* @param options - The options for the fetch
|
|
1035
|
-
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1036
|
-
* @param options.fetch - The fetch function to use
|
|
1037
|
-
* @returns The parsed gallery or an error message if the fetch/parse fails
|
|
937
|
+
* Property value content in OCHRE
|
|
1038
938
|
*/
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
939
|
+
type PropertyValueContent<T extends LanguageCodes = LanguageCodes> = Prettify<{
|
|
940
|
+
hierarchy: {
|
|
941
|
+
isLeaf: boolean;
|
|
942
|
+
level: number | null;
|
|
943
|
+
};
|
|
944
|
+
label: MultilingualString<T> | null;
|
|
945
|
+
isUncertain: boolean;
|
|
946
|
+
category: string | null;
|
|
947
|
+
type: string | null;
|
|
948
|
+
uuid: string | null;
|
|
949
|
+
publicationDateTime: Date | null;
|
|
950
|
+
unit: string | null;
|
|
951
|
+
href: string | null;
|
|
952
|
+
height: number | null;
|
|
953
|
+
width: number | null;
|
|
954
|
+
fileSize: number | null;
|
|
955
|
+
slug: string | null;
|
|
956
|
+
} & ({
|
|
957
|
+
dataType: "string" | "coordinate" | "IDREF" | "date" | "dateTime";
|
|
958
|
+
content: string;
|
|
1048
959
|
} | {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
type FetchFunction$3 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1056
|
-
type FetchItemLinksBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
1057
|
-
languages?: TLanguages;
|
|
1058
|
-
fetch?: FetchFunction$3;
|
|
1059
|
-
};
|
|
1060
|
-
type FetchItemLinksLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
960
|
+
dataType: "integer" | "decimal" | "time";
|
|
961
|
+
content: number;
|
|
962
|
+
} | {
|
|
963
|
+
dataType: "boolean";
|
|
964
|
+
content: boolean;
|
|
965
|
+
})>;
|
|
1061
966
|
/**
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1064
|
-
* @param uuid - The UUID of the OCHRE item whose linked items should be fetched
|
|
1065
|
-
* @param options - Fetch and parser options
|
|
1066
|
-
* @param options.containedItemCategory - The category of items inside linked Trees/Sets to parse. Tree accepts one category; Set accepts one category or an array.
|
|
1067
|
-
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1068
|
-
* @param options.fetch - Custom fetch function to use instead of the default fetch
|
|
1069
|
-
* @returns An object containing parsed linked items
|
|
967
|
+
* Property in OCHRE
|
|
1070
968
|
*/
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
detailedError: string;
|
|
1081
|
-
}>;
|
|
1082
|
-
//#endregion
|
|
1083
|
-
//#region src/fetchers/item.d.ts
|
|
1084
|
-
type FetchFunction$2 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1085
|
-
type FetchItemBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
1086
|
-
languages?: TLanguages;
|
|
1087
|
-
fetch?: FetchFunction$2;
|
|
969
|
+
type Property<T extends LanguageCodes = LanguageCodes> = {
|
|
970
|
+
variable: {
|
|
971
|
+
uuid: string;
|
|
972
|
+
label: MultilingualString<T>;
|
|
973
|
+
publicationDateTime: Date | null;
|
|
974
|
+
};
|
|
975
|
+
values: Array<PropertyValueContent<T>>;
|
|
976
|
+
comment: MultilingualString<T> | null;
|
|
977
|
+
properties: Array<Property<T>>;
|
|
1088
978
|
};
|
|
1089
|
-
type FetchItemLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
1090
979
|
/**
|
|
1091
|
-
*
|
|
1092
|
-
*
|
|
1093
|
-
* Inline arrays can be passed directly to fetchItem:
|
|
1094
|
-
* `fetchItem(uuid, { languages: ["eng", "spa"] })`.
|
|
1095
|
-
*
|
|
1096
|
-
* Use this helper when the language set is stored separately:
|
|
1097
|
-
* `const languages = defineLanguages("eng", "spa")`.
|
|
980
|
+
* Simplified property in OCHRE website payloads. Simplified property variables
|
|
981
|
+
* expose scalar labels rather than multilingual labels.
|
|
1098
982
|
*/
|
|
1099
|
-
|
|
983
|
+
type SimplifiedProperty<T extends LanguageCodes = LanguageCodes> = {
|
|
984
|
+
variable: {
|
|
985
|
+
uuid: string;
|
|
986
|
+
label: string;
|
|
987
|
+
publicationDateTime: Date | null;
|
|
988
|
+
};
|
|
989
|
+
values: Array<PropertyValueContent<T>>;
|
|
990
|
+
comment: MultilingualString<T> | null;
|
|
991
|
+
properties: Array<SimplifiedProperty<T>>;
|
|
992
|
+
};
|
|
1100
993
|
/**
|
|
1101
|
-
*
|
|
1102
|
-
* defineLanguages("eng", "spa") for reusable language tuples.
|
|
994
|
+
* Property in a Set item. OCHRE exposes Set item properties as a flat list.
|
|
1103
995
|
*/
|
|
1104
|
-
|
|
996
|
+
type SetItemProperty<T extends LanguageCodes = LanguageCodes> = Omit<Property<T>, "properties">;
|
|
997
|
+
type SetItemSimplifiedProperty<T extends LanguageCodes = LanguageCodes> = Omit<SimplifiedProperty<T>, "properties">;
|
|
998
|
+
type PropertyLike<T extends LanguageCodes = LanguageCodes> = Property<T> | SetItemProperty<T> | SimplifiedProperty<T> | SetItemSimplifiedProperty<T>;
|
|
999
|
+
type ItemProperty<T extends LanguageCodes = LanguageCodes> = Property<T> | SetItemProperty<T>;
|
|
1000
|
+
type PropertyValueDataType = PropertyValueContent["dataType"];
|
|
1001
|
+
type QueryablePropertyValueDataType = Exclude<PropertyValueDataType, "coordinate">;
|
|
1002
|
+
type WithSetItemProperties<U extends {
|
|
1003
|
+
properties: Array<Property<T>>;
|
|
1004
|
+
}, T extends LanguageCodes> = U extends {
|
|
1005
|
+
properties: Array<Property<T>>;
|
|
1006
|
+
} ? Prettify<Omit<U, "properties"> & {
|
|
1007
|
+
properties: Array<SetItemProperty<T>>;
|
|
1008
|
+
}> : never;
|
|
1105
1009
|
/**
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
* @param uuid - The UUID of the OCHRE item to fetch
|
|
1109
|
-
* @param options - Required options object
|
|
1110
|
-
* @param options.category - The category of the OCHRE item to fetch
|
|
1111
|
-
* @param options.containedItemCategory - The category of items inside the OCHRE item to fetch. Only valid for Trees and Sets. Tree accepts one category; Set accepts one category or an array.
|
|
1112
|
-
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1113
|
-
* @param options.fetch - Custom fetch function to use instead of the default fetch
|
|
1114
|
-
* @returns An object containing the parsed item
|
|
1010
|
+
* Base item in OCHRE
|
|
1115
1011
|
*/
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
category: TCategory;
|
|
1130
|
-
containedItemCategory?: TContainedItemCategory;
|
|
1131
|
-
}): Promise<{
|
|
1132
|
-
item: Item<TCategory, ContainedItemCategoryFromOption<TCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>;
|
|
1133
|
-
error: null;
|
|
1134
|
-
detailedError: null;
|
|
1135
|
-
} | {
|
|
1136
|
-
item: null;
|
|
1137
|
-
error: string;
|
|
1138
|
-
detailedError: string;
|
|
1139
|
-
}>;
|
|
1140
|
-
declare function fetchItem<const TCategory extends ItemCategory, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & {
|
|
1141
|
-
category: TCategory;
|
|
1142
|
-
containedItemCategory?: never;
|
|
1143
|
-
}): Promise<{
|
|
1144
|
-
item: Item<TCategory, ContainedItemCategory<TCategory>, FetchItemLanguages<TLanguages>>;
|
|
1145
|
-
error: null;
|
|
1146
|
-
detailedError: null;
|
|
1147
|
-
} | {
|
|
1148
|
-
item: null;
|
|
1149
|
-
error: string;
|
|
1150
|
-
detailedError: string;
|
|
1151
|
-
}>;
|
|
1152
|
-
//#endregion
|
|
1153
|
-
//#region src/fetchers/set/items.d.ts
|
|
1154
|
-
type FetchFunction$1 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1155
|
-
type FetchSetItemsBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
1156
|
-
languages?: TLanguages;
|
|
1157
|
-
fetch?: FetchFunction$1;
|
|
1012
|
+
type BaseItem<U extends ItemCategory = ItemCategory, T extends LanguageCodes = LanguageCodes, V extends ItemPayloadKind = "topLevel"> = ItemEnvelopeFields<T, V> & {
|
|
1013
|
+
uuid: string;
|
|
1014
|
+
category: U;
|
|
1015
|
+
publicationDateTime: Date | null;
|
|
1016
|
+
context: Context<ContextItemCategory> | null;
|
|
1017
|
+
date: Date | null;
|
|
1018
|
+
license: License | null;
|
|
1019
|
+
copyright: MultilingualString<T> | null;
|
|
1020
|
+
watermark: MultilingualString<T> | null;
|
|
1021
|
+
identification: Identification<T>;
|
|
1022
|
+
creators: Array<Person<T, "embedded">>;
|
|
1023
|
+
description: MultilingualString<T> | null;
|
|
1024
|
+
events: Array<Event<T>>;
|
|
1158
1025
|
};
|
|
1159
|
-
type
|
|
1160
|
-
type FetchSetItemsCategory<TContainedItemCategories extends ReadonlyArray<SetItemCategory> | undefined> = TContainedItemCategories extends ReadonlyArray<infer U> ? Extract<U, SetItemCategory> : SetItemCategory;
|
|
1026
|
+
type ItemLinkCategory = ItemCategory | "dictionaryUnit";
|
|
1161
1027
|
/**
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
* @param params - The parameters for the fetch
|
|
1165
|
-
* @param params.setScopeUuids - The Set scope UUIDs to filter by
|
|
1166
|
-
* @param params.queries - Recursive query tree used to filter matching items
|
|
1167
|
-
* @param params.sort - Optional sorting configuration applied before pagination.
|
|
1168
|
-
* For propertyValue sorting, dataType is required and the sort key uses the first valid leaf value (value[not(@i)]).
|
|
1169
|
-
* @param params.page - The page number (1-indexed)
|
|
1170
|
-
* @param params.pageSize - The number of items per page
|
|
1171
|
-
* @param containedItemCategories - The categories of the items to fetch
|
|
1172
|
-
* @param options - Options for the fetch
|
|
1173
|
-
* @param options.fetch - The fetch function to use
|
|
1174
|
-
* @returns The parsed Set items or null if the fetch/parse fails
|
|
1028
|
+
* Base item data exposed by OCHRE link and reverse-link payloads.
|
|
1175
1029
|
*/
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1030
|
+
type BaseItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends LanguageCodes = LanguageCodes> = {
|
|
1031
|
+
uuid: string;
|
|
1032
|
+
category: U;
|
|
1033
|
+
publicationDateTime: Date | null;
|
|
1034
|
+
context: Context<ContextItemCategory> | null;
|
|
1035
|
+
date: Date | null;
|
|
1036
|
+
identification: Identification<T>;
|
|
1037
|
+
description: MultilingualString<T> | null;
|
|
1038
|
+
};
|
|
1039
|
+
type BibliographySourceDocument = {
|
|
1040
|
+
uuid: string;
|
|
1041
|
+
content: string;
|
|
1042
|
+
href: string | null;
|
|
1043
|
+
publicationDateTime: Date | null;
|
|
1044
|
+
};
|
|
1045
|
+
type BibliographyEntryInfo = {
|
|
1046
|
+
content: string | null;
|
|
1047
|
+
startIssue: string;
|
|
1048
|
+
startVolume: string;
|
|
1049
|
+
startPage: string;
|
|
1050
|
+
endPage: string;
|
|
1051
|
+
};
|
|
1052
|
+
type ItemLinks<T extends LanguageCodes = LanguageCodes> = Array<ItemLink<ItemLinkCategory, T>>;
|
|
1053
|
+
type TreeItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"tree", T> & {
|
|
1054
|
+
type: string | null;
|
|
1055
|
+
containedItemCategory: TreeItemCategory | null;
|
|
1196
1056
|
}>;
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1057
|
+
type SetItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"set", T> & {
|
|
1058
|
+
type: string | null;
|
|
1059
|
+
containedItemCategories: Array<SetItemCategory> | null;
|
|
1060
|
+
}>;
|
|
1061
|
+
type BibliographyItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"bibliography", T> & {
|
|
1062
|
+
type: string | null;
|
|
1063
|
+
zoteroId: string | null;
|
|
1064
|
+
citationDetails: string | null;
|
|
1065
|
+
citationFormat: MultilingualString<T> | null;
|
|
1066
|
+
citationFormatSpan: string | null;
|
|
1067
|
+
referenceFormatDiv: string | null;
|
|
1068
|
+
image: Image<T> | null;
|
|
1069
|
+
sourceDocument: BibliographySourceDocument | null;
|
|
1070
|
+
publicationInfo: {
|
|
1071
|
+
publishers: Array<ItemLink<"person", T>>;
|
|
1072
|
+
startDate: Date | null;
|
|
1073
|
+
} | null;
|
|
1074
|
+
entryInfo: BibliographyEntryInfo | null;
|
|
1075
|
+
source: ItemLink<TreeItemCategory, T> | null;
|
|
1076
|
+
authors: Array<ItemLink<"person", T>>;
|
|
1077
|
+
periods: Array<ItemLink<"period", T>>;
|
|
1078
|
+
properties: Array<Property<T>>;
|
|
1079
|
+
}>;
|
|
1080
|
+
type ConceptItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"concept", T> & {
|
|
1081
|
+
image: Image<T> | null;
|
|
1082
|
+
coordinates: Array<Coordinates<T>>;
|
|
1083
|
+
}>;
|
|
1084
|
+
type SpatialUnitItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"spatialUnit", T> & {
|
|
1085
|
+
image: Image<T> | null;
|
|
1086
|
+
coordinates: Array<Coordinates<T>>;
|
|
1087
|
+
}>;
|
|
1088
|
+
type PeriodItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"period", T> & {
|
|
1089
|
+
type: string | null;
|
|
1090
|
+
coordinates: Array<Coordinates<T>>;
|
|
1091
|
+
}>;
|
|
1092
|
+
type PersonItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"person", T> & {
|
|
1093
|
+
type: string | null;
|
|
1094
|
+
coordinates: Array<Coordinates<T>>;
|
|
1095
|
+
}>;
|
|
1096
|
+
type PropertyVariableItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"propertyVariable", T> & {
|
|
1097
|
+
type: string | null;
|
|
1098
|
+
coordinates: Array<Coordinates<T>>;
|
|
1099
|
+
}>;
|
|
1100
|
+
type PropertyValueItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"propertyValue", T> & {
|
|
1101
|
+
coordinates: Array<Coordinates<T>>;
|
|
1102
|
+
}>;
|
|
1103
|
+
type ResourceItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"resource", T> & {
|
|
1104
|
+
type: string | null;
|
|
1105
|
+
href: string | null;
|
|
1106
|
+
fileFormat: string | null;
|
|
1107
|
+
fileSize: number | null;
|
|
1108
|
+
isInline: boolean;
|
|
1109
|
+
isPrimary: boolean;
|
|
1110
|
+
height: number | null;
|
|
1111
|
+
width: number | null;
|
|
1112
|
+
image: Image<T> | null;
|
|
1113
|
+
coordinates: Array<Coordinates<T>>;
|
|
1239
1114
|
}>;
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1115
|
+
type TextItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"text", T> & {
|
|
1116
|
+
type: string | null;
|
|
1117
|
+
text: string | null;
|
|
1118
|
+
language: string | null;
|
|
1119
|
+
image: Image<T> | null;
|
|
1120
|
+
coordinates: Array<Coordinates<T>>;
|
|
1121
|
+
}>;
|
|
1122
|
+
type DictionaryUnitItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"dictionaryUnit", T>>;
|
|
1243
1123
|
/**
|
|
1244
|
-
*
|
|
1124
|
+
* An abridged item reference exposed inside OCHRE links and reverse links.
|
|
1245
1125
|
*/
|
|
1246
|
-
type
|
|
1247
|
-
variableUuid: string;
|
|
1248
|
-
valueUuid: string | null;
|
|
1249
|
-
};
|
|
1126
|
+
type ItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends LanguageCodes = LanguageCodes> = U extends ItemLinkCategory ? U extends "tree" ? TreeItemLink<T> : U extends "set" ? SetItemLink<T> : U extends "bibliography" ? BibliographyItemLink<T> : U extends "concept" ? ConceptItemLink<T> : U extends "spatialUnit" ? SpatialUnitItemLink<T> : U extends "period" ? PeriodItemLink<T> : U extends "person" ? PersonItemLink<T> : U extends "propertyVariable" ? PropertyVariableItemLink<T> : U extends "propertyValue" ? PropertyValueItemLink<T> : U extends "resource" ? ResourceItemLink<T> : U extends "text" ? TextItemLink<T> : U extends "dictionaryUnit" ? DictionaryUnitItemLink<T> : never : never;
|
|
1250
1127
|
/**
|
|
1251
|
-
*
|
|
1128
|
+
* An Item in OCHRE (can be a tree, set, bibliography, concept, spatial unit, period, person, property value, property variable, or resource)
|
|
1252
1129
|
*/
|
|
1253
|
-
type
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
};
|
|
1130
|
+
type Item<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes, W extends ItemPayloadKind = "topLevel"> = U extends ItemCategory ? U extends "tree" ? Tree<Extract<V, TreeItemCategory>, T, W> : U extends "set" ? Set<Extract<V, SetItemCategory>, T, W> : U extends "bibliography" ? Bibliography<T, W> : U extends "concept" ? Concept<T, W> : U extends "spatialUnit" ? SpatialUnit<T, W> : U extends "period" ? Period<T, W> : U extends "person" ? Person<T, W> : U extends "propertyVariable" ? PropertyVariable<T, W> : U extends "propertyValue" ? PropertyValue<T, W> : U extends "resource" ? Resource<T, W> : U extends "text" ? Text<T, W> : never : never;
|
|
1131
|
+
type TopLevelItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "topLevel">;
|
|
1132
|
+
type EmbeddedItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "embedded">;
|
|
1133
|
+
type AnyItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, ItemPayloadKind>;
|
|
1258
1134
|
/**
|
|
1259
|
-
*
|
|
1135
|
+
* Heading in OCHRE
|
|
1260
1136
|
*/
|
|
1261
|
-
type
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
filterType: "property" | "coordinates" | "bibliography" | "period";
|
|
1266
|
-
isInlineDisplayed: boolean;
|
|
1267
|
-
isSidebarDisplayed: boolean;
|
|
1268
|
-
isSidebarOpen: boolean;
|
|
1137
|
+
type Heading<U extends HeadingItemCategory = HeadingItemCategory, T extends LanguageCodes = LanguageCodes> = {
|
|
1138
|
+
name: string;
|
|
1139
|
+
headings: Array<Heading<U, T>>;
|
|
1140
|
+
items: Array<Item<U, never, T, "embedded">>;
|
|
1269
1141
|
};
|
|
1270
1142
|
/**
|
|
1271
|
-
*
|
|
1143
|
+
* Tree in OCHRE
|
|
1272
1144
|
*/
|
|
1273
|
-
type
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
};
|
|
1145
|
+
type Tree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes, V extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"tree", T, V> & {
|
|
1146
|
+
type: string | null;
|
|
1147
|
+
containedItemCategory: U | null;
|
|
1148
|
+
links: ItemLinks<T>;
|
|
1149
|
+
notes: Array<Note<T>>;
|
|
1150
|
+
properties: Array<Property<T>>;
|
|
1151
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1152
|
+
items: U extends HeadingItemCategory ? Array<Heading<U, T> | Item<U, never, T, "embedded">> : Array<Item<U, never, T, "embedded">>;
|
|
1153
|
+
}>;
|
|
1283
1154
|
/**
|
|
1284
|
-
*
|
|
1155
|
+
* Set in OCHRE
|
|
1285
1156
|
*/
|
|
1286
|
-
type
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1157
|
+
type Set<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes, V extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"set", T, V> & {
|
|
1158
|
+
containedItemCategories: Array<U>;
|
|
1159
|
+
isTabularStructure: boolean;
|
|
1160
|
+
isSuppressingBlanks: boolean;
|
|
1161
|
+
links: ItemLinks<T>;
|
|
1162
|
+
notes: Array<Note<T>>;
|
|
1163
|
+
properties: Array<Property<T>>;
|
|
1164
|
+
items: Array<SetItem<U, T>>;
|
|
1165
|
+
}>;
|
|
1166
|
+
type SetBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded"> extends infer U ? U extends {
|
|
1167
|
+
properties: Array<Property<T>>;
|
|
1168
|
+
} ? Prettify<Omit<U, "properties" | "items"> & {
|
|
1169
|
+
properties: Array<SetItemProperty<T>>;
|
|
1170
|
+
}> : never : never;
|
|
1171
|
+
type SetConcept<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<Concept<T, "embedded">, "interpretations" | "items"> & {
|
|
1172
|
+
properties: Array<SetItemProperty<T>>;
|
|
1173
|
+
}>;
|
|
1174
|
+
type SetSpatialUnit<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<SpatialUnit<T, "embedded">, "observations" | "items"> & {
|
|
1175
|
+
properties: Array<SetItemProperty<T>>;
|
|
1176
|
+
}>;
|
|
1177
|
+
type SetPeriod<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Period<T, "embedded">, T>, "items">>;
|
|
1178
|
+
type SetResource<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Resource<T, "embedded">, T>, "items">>;
|
|
1179
|
+
type SetTree<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Tree<TreeItemCategory, T, "embedded">, T>, "items">>;
|
|
1180
|
+
type SetItem<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = U extends "tree" ? SetTree<T> : U extends "bibliography" ? SetBibliography<T> : U extends "concept" ? SetConcept<T> : U extends "spatialUnit" ? SetSpatialUnit<T> : U extends "period" ? SetPeriod<T> : U extends "person" ? WithSetItemProperties<Person<T, "embedded">, T> : U extends "propertyVariable" ? PropertyVariable<T, "embedded"> : U extends "propertyValue" ? WithSetItemProperties<PropertyValue<T, "embedded">, T> : U extends "resource" ? SetResource<T> : U extends "text" ? Text<T, "embedded"> : U extends "set" ? Omit<WithSetItemProperties<Set<SetItemCategory, T, "embedded">, T>, "items"> : never;
|
|
1291
1181
|
/**
|
|
1292
|
-
*
|
|
1182
|
+
* Person in OCHRE
|
|
1293
1183
|
*/
|
|
1294
|
-
type
|
|
1295
|
-
type
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
default: Array<Style>;
|
|
1311
|
-
tablet: Array<Style>;
|
|
1312
|
-
mobile: Array<Style>;
|
|
1313
|
-
};
|
|
1314
|
-
};
|
|
1315
|
-
type WebsitePropertyQueryNode<T extends LanguageCodes = LanguageCodes> = {
|
|
1316
|
-
target: "property";
|
|
1317
|
-
propertyVariable: string;
|
|
1318
|
-
dataType: WebsitePropertyValueDataType;
|
|
1319
|
-
matchMode: "includes" | "exact";
|
|
1320
|
-
isCaseSensitive: boolean;
|
|
1321
|
-
language: T[number];
|
|
1322
|
-
};
|
|
1323
|
-
type WebsitePropertyQuery<T extends LanguageCodes = LanguageCodes> = WebsitePropertyQueryNode<T> | {
|
|
1324
|
-
and: Array<WebsitePropertyQuery<T>>;
|
|
1325
|
-
} | {
|
|
1326
|
-
or: Array<WebsitePropertyQuery<T>>;
|
|
1327
|
-
};
|
|
1184
|
+
type Person<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"person", T, U> & {
|
|
1185
|
+
type: string;
|
|
1186
|
+
image: Image<T> | null;
|
|
1187
|
+
address: {
|
|
1188
|
+
country: string | null;
|
|
1189
|
+
city: string | null;
|
|
1190
|
+
state: string | null;
|
|
1191
|
+
postalCode: string | null;
|
|
1192
|
+
} | null;
|
|
1193
|
+
coordinates: Array<Coordinates<T>>;
|
|
1194
|
+
content: MultilingualString<T> | null;
|
|
1195
|
+
periods: Array<Period<T, "embedded">>;
|
|
1196
|
+
links: ItemLinks<T>;
|
|
1197
|
+
notes: Array<Note<T>>;
|
|
1198
|
+
properties: Array<Property<T>>;
|
|
1199
|
+
}>;
|
|
1328
1200
|
/**
|
|
1329
|
-
*
|
|
1201
|
+
* Period in OCHRE
|
|
1330
1202
|
*/
|
|
1331
|
-
type
|
|
1203
|
+
type Period<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"period", T, U> & {
|
|
1204
|
+
type: string | null;
|
|
1205
|
+
coordinates: Array<Coordinates<T>>;
|
|
1206
|
+
links: ItemLinks<T>;
|
|
1207
|
+
notes: Array<Note<T>>;
|
|
1208
|
+
properties: Array<Property<T>>;
|
|
1209
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1210
|
+
items: Array<Period<T, "embedded">>;
|
|
1211
|
+
}>;
|
|
1332
1212
|
/**
|
|
1333
|
-
*
|
|
1213
|
+
* Bibliography in OCHRE
|
|
1334
1214
|
*/
|
|
1335
|
-
type
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
title: WebTitle<T>;
|
|
1384
|
-
layout: "start" | "end";
|
|
1385
|
-
mobileLayout: "default" | "inline";
|
|
1386
|
-
cssStyles: {
|
|
1387
|
-
default: Array<Style>;
|
|
1388
|
-
tablet: Array<Style>;
|
|
1389
|
-
mobile: Array<Style>;
|
|
1390
|
-
};
|
|
1391
|
-
} | null;
|
|
1392
|
-
itemPage: {
|
|
1393
|
-
isMainContentDisplayed: boolean;
|
|
1394
|
-
isDescriptionDisplayed: boolean;
|
|
1395
|
-
isDocumentDisplayed: boolean;
|
|
1396
|
-
isNotesDisplayed: boolean;
|
|
1397
|
-
isEventsDisplayed: boolean;
|
|
1398
|
-
isPeriodsDisplayed: boolean;
|
|
1399
|
-
isPropertiesDisplayed: boolean;
|
|
1400
|
-
isBibliographyDisplayed: boolean;
|
|
1401
|
-
isPropertyValuesGrouped: boolean;
|
|
1402
|
-
isPublicationDateTimeDisplayed: boolean;
|
|
1403
|
-
isPersistentIdentifierDisplayed: boolean;
|
|
1404
|
-
iiifViewer: "universal-viewer" | "clover";
|
|
1405
|
-
};
|
|
1406
|
-
options: {
|
|
1407
|
-
contextTree: ContextTree<T> | null;
|
|
1408
|
-
scopes: Array<Scope<T>> | null;
|
|
1409
|
-
labels: {
|
|
1410
|
-
title: MultilingualString<T> | null;
|
|
1411
|
-
};
|
|
1412
|
-
stylesheets: {
|
|
1413
|
-
properties: Array<StylesheetItem>;
|
|
1414
|
-
};
|
|
1415
|
-
};
|
|
1416
|
-
};
|
|
1417
|
-
};
|
|
1418
|
-
type WebsiteSegment<T extends LanguageCodes = LanguageCodes> = Website<T> & {
|
|
1419
|
-
type: "segment";
|
|
1215
|
+
type Bibliography<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"bibliography", T, U> & {
|
|
1216
|
+
citationDetails: string | null;
|
|
1217
|
+
citationFormat: MultilingualString<T> | null;
|
|
1218
|
+
citationFormatSpan: string | null;
|
|
1219
|
+
referenceFormatDiv: string | null;
|
|
1220
|
+
image: Image<T> | null;
|
|
1221
|
+
sourceDocument: BibliographySourceDocument | null;
|
|
1222
|
+
publicationInfo: {
|
|
1223
|
+
publishers: Array<Person<T, "embedded">>;
|
|
1224
|
+
startDate: Date | null;
|
|
1225
|
+
} | null;
|
|
1226
|
+
entryInfo: BibliographyEntryInfo | null;
|
|
1227
|
+
source: ItemLink<TreeItemCategory, T> | null;
|
|
1228
|
+
authors: Array<Person<T, "embedded">>;
|
|
1229
|
+
periods: Array<Period<T, "embedded">>;
|
|
1230
|
+
links: ItemLinks<T>;
|
|
1231
|
+
notes: Array<Note<T>>;
|
|
1232
|
+
properties: Array<Property<T>>;
|
|
1233
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1234
|
+
items: Array<Bibliography<T, "embedded">>;
|
|
1235
|
+
} & ({
|
|
1236
|
+
type: "zotero";
|
|
1237
|
+
zoteroId: string;
|
|
1238
|
+
uuid: string | null;
|
|
1239
|
+
} | {
|
|
1240
|
+
type: string | null;
|
|
1241
|
+
})>;
|
|
1242
|
+
/**
|
|
1243
|
+
* Concept in OCHRE
|
|
1244
|
+
*/
|
|
1245
|
+
type Concept<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"concept", T, U> & {
|
|
1246
|
+
image: Image<T> | null;
|
|
1247
|
+
interpretations: Array<Interpretation<T>>;
|
|
1248
|
+
coordinates: Array<Coordinates<T>>;
|
|
1249
|
+
items: Array<Concept<T, "embedded">>;
|
|
1250
|
+
}>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Interpretation in OCHRE
|
|
1253
|
+
*/
|
|
1254
|
+
type Interpretation<T extends LanguageCodes = LanguageCodes> = {
|
|
1255
|
+
number: number;
|
|
1256
|
+
date: Date | null;
|
|
1257
|
+
observers: Array<Person<T, "embedded">>;
|
|
1258
|
+
periods: Array<Period<T, "embedded">>;
|
|
1259
|
+
links: ItemLinks<T>;
|
|
1260
|
+
notes: Array<Note<T>>;
|
|
1261
|
+
properties: Array<Property<T>>;
|
|
1262
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1420
1263
|
};
|
|
1421
1264
|
/**
|
|
1422
|
-
*
|
|
1265
|
+
* Spatial unit in OCHRE
|
|
1423
1266
|
*/
|
|
1424
|
-
type
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
segments: Array<WebsiteSegment<T>>;
|
|
1432
|
-
properties: {
|
|
1433
|
-
width: "full" | "large" | "narrow" | "default";
|
|
1434
|
-
variant: "default" | "no-background";
|
|
1435
|
-
isBreadcrumbsDisplayed: boolean;
|
|
1436
|
-
isSidebarDisplayed: boolean;
|
|
1437
|
-
isDisplayedInNavbar: boolean;
|
|
1438
|
-
isNavbarSearchBarDisplayed: boolean;
|
|
1439
|
-
backgroundImage: WebImage<T> | null;
|
|
1440
|
-
cssStyles: {
|
|
1441
|
-
default: Array<Style>;
|
|
1442
|
-
tablet: Array<Style>;
|
|
1443
|
-
mobile: Array<Style>;
|
|
1267
|
+
type SpatialUnit<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"spatialUnit", T, U> & {
|
|
1268
|
+
image: Image<T> | null;
|
|
1269
|
+
coordinates: Array<Coordinates<T>>;
|
|
1270
|
+
mapData: {
|
|
1271
|
+
geoJSON: {
|
|
1272
|
+
multiPolygon: string;
|
|
1273
|
+
EPSG: number;
|
|
1444
1274
|
};
|
|
1445
|
-
};
|
|
1446
|
-
|
|
1447
|
-
|
|
1275
|
+
} | null;
|
|
1276
|
+
observations: Array<Observation<T>>;
|
|
1277
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1278
|
+
items: Array<SpatialUnit<T, "embedded">>;
|
|
1279
|
+
}>;
|
|
1448
1280
|
/**
|
|
1449
|
-
*
|
|
1281
|
+
* Observation in OCHRE
|
|
1450
1282
|
*/
|
|
1451
|
-
type
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
};
|
|
1283
|
+
type Observation<T extends LanguageCodes = LanguageCodes> = {
|
|
1284
|
+
number: number;
|
|
1285
|
+
date: Date | null;
|
|
1286
|
+
observers: Array<string> | Array<Person<T, "embedded">>;
|
|
1287
|
+
periods: Array<Period<T, "embedded">>;
|
|
1288
|
+
links: ItemLinks<T>;
|
|
1289
|
+
notes: Array<Note<T>>;
|
|
1290
|
+
properties: Array<Property<T>>;
|
|
1291
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1461
1292
|
};
|
|
1462
1293
|
/**
|
|
1463
|
-
*
|
|
1294
|
+
* Property variable in OCHRE
|
|
1464
1295
|
*/
|
|
1465
|
-
type
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
mobile: Array<Style>;
|
|
1473
|
-
};
|
|
1474
|
-
} & WebElementComponent<T>;
|
|
1296
|
+
type PropertyVariable<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"propertyVariable", T, U> & {
|
|
1297
|
+
type: string | null;
|
|
1298
|
+
coordinates: Array<Coordinates<T>>;
|
|
1299
|
+
links: ItemLinks<T>;
|
|
1300
|
+
notes: Array<Note<T>>;
|
|
1301
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1302
|
+
}>;
|
|
1475
1303
|
/**
|
|
1476
|
-
*
|
|
1304
|
+
* Property value in OCHRE
|
|
1477
1305
|
*/
|
|
1478
|
-
type
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1306
|
+
type PropertyValue<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"propertyValue", T, U> & {
|
|
1307
|
+
coordinates: Array<Coordinates<T>>;
|
|
1308
|
+
links: ItemLinks<T>;
|
|
1309
|
+
notes: Array<Note<T>>;
|
|
1310
|
+
properties: Array<Property<T>>;
|
|
1311
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1312
|
+
}>;
|
|
1313
|
+
/**
|
|
1314
|
+
* Resource in OCHRE
|
|
1315
|
+
*/
|
|
1316
|
+
type Resource<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"resource", T, U> & {
|
|
1317
|
+
type: string;
|
|
1487
1318
|
href: string | null;
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
isVolumeControlsDisplayed: boolean;
|
|
1503
|
-
isSeekBarDisplayed: boolean;
|
|
1504
|
-
} | {
|
|
1505
|
-
component: "bibliography";
|
|
1506
|
-
linkUuids: Array<string>;
|
|
1319
|
+
fileFormat: string | null;
|
|
1320
|
+
fileSize: number | null;
|
|
1321
|
+
isInline: boolean;
|
|
1322
|
+
height: number | null;
|
|
1323
|
+
width: number | null;
|
|
1324
|
+
image: Image<T> | null;
|
|
1325
|
+
document: MultilingualString<T> | null;
|
|
1326
|
+
imageMap: ImageMap | null;
|
|
1327
|
+
coordinates: Array<Coordinates<T>>;
|
|
1328
|
+
periods: Array<Period<T, "embedded">>;
|
|
1329
|
+
links: ItemLinks<T>;
|
|
1330
|
+
reverseLinks: ItemLinks<T>;
|
|
1331
|
+
notes: Array<Note<T>>;
|
|
1332
|
+
properties: Array<Property<T>>;
|
|
1507
1333
|
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1334
|
+
items: Array<Resource<T, "embedded">>;
|
|
1335
|
+
} & (U extends "topLevel" ? {
|
|
1336
|
+
view: Webpage<T> | null;
|
|
1337
|
+
} : unknown)>;
|
|
1338
|
+
/**
|
|
1339
|
+
* Text in OCHRE
|
|
1340
|
+
*/
|
|
1341
|
+
type Text<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"text", T, U> & {
|
|
1342
|
+
type: string;
|
|
1343
|
+
text: string | null;
|
|
1344
|
+
language: string | null;
|
|
1345
|
+
image: Image<T> | null;
|
|
1346
|
+
coordinates: Array<Coordinates<T>>;
|
|
1347
|
+
links: ItemLinks<T>;
|
|
1348
|
+
reverseLinks: ItemLinks<T>;
|
|
1349
|
+
notes: Array<Note<T>>;
|
|
1350
|
+
sections: Array<Section<T>>;
|
|
1351
|
+
periods: Array<Period<T, "embedded">>;
|
|
1352
|
+
creators: Array<Person<T, "embedded">>;
|
|
1353
|
+
editions: Array<Person<T, "embedded">>;
|
|
1354
|
+
}>;
|
|
1355
|
+
/**
|
|
1356
|
+
* Section in OCHRE
|
|
1357
|
+
*/
|
|
1358
|
+
type Section<T extends LanguageCodes = LanguageCodes> = {
|
|
1359
|
+
uuid: string;
|
|
1360
|
+
publicationDateTime: Date | null;
|
|
1361
|
+
identification: Identification<T>;
|
|
1362
|
+
project: {
|
|
1363
|
+
identification: Identification<T>;
|
|
1364
|
+
} | null;
|
|
1365
|
+
};
|
|
1366
|
+
type EmbeddedTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, "embedded">;
|
|
1367
|
+
type AnyTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, ItemPayloadKind>;
|
|
1368
|
+
type EmbeddedSet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, "embedded">;
|
|
1369
|
+
type AnySet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, ItemPayloadKind>;
|
|
1370
|
+
type EmbeddedBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded">;
|
|
1371
|
+
type AnyBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, ItemPayloadKind>;
|
|
1372
|
+
type EmbeddedConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, "embedded">;
|
|
1373
|
+
type AnyConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, ItemPayloadKind>;
|
|
1374
|
+
type EmbeddedSpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, "embedded">;
|
|
1375
|
+
type AnySpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, ItemPayloadKind>;
|
|
1376
|
+
type EmbeddedPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, "embedded">;
|
|
1377
|
+
type AnyPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, ItemPayloadKind>;
|
|
1378
|
+
type EmbeddedPerson<T extends LanguageCodes = LanguageCodes> = Person<T, "embedded">;
|
|
1379
|
+
type AnyPerson<T extends LanguageCodes = LanguageCodes> = Person<T, ItemPayloadKind>;
|
|
1380
|
+
type EmbeddedPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, "embedded">;
|
|
1381
|
+
type AnyPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, ItemPayloadKind>;
|
|
1382
|
+
type EmbeddedPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, "embedded">;
|
|
1383
|
+
type AnyPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, ItemPayloadKind>;
|
|
1384
|
+
type EmbeddedResource<T extends LanguageCodes = LanguageCodes> = Resource<T, "embedded">;
|
|
1385
|
+
type AnyResource<T extends LanguageCodes = LanguageCodes> = Resource<T, ItemPayloadKind>;
|
|
1386
|
+
type EmbeddedText<T extends LanguageCodes = LanguageCodes> = Text<T, "embedded">;
|
|
1387
|
+
type AnyText<T extends LanguageCodes = LanguageCodes> = Text<T, ItemPayloadKind>;
|
|
1388
|
+
/**
|
|
1389
|
+
* Represents a gallery with its identification, project identification, resources and max length
|
|
1390
|
+
*/
|
|
1391
|
+
type Gallery<T extends LanguageCodes = LanguageCodes> = {
|
|
1392
|
+
identification: Identification<T>;
|
|
1393
|
+
projectIdentification: Identification<T>;
|
|
1394
|
+
resources: Array<Resource<T, "embedded">>;
|
|
1395
|
+
maxLength: number;
|
|
1396
|
+
};
|
|
1397
|
+
/**
|
|
1398
|
+
* Represents a property query item with its UUID, raw value, count, and content
|
|
1399
|
+
*/
|
|
1400
|
+
type PropertyValueQueryItem = {
|
|
1401
|
+
count: number;
|
|
1402
|
+
dataType: QueryablePropertyValueDataType;
|
|
1403
|
+
content: string | number | boolean | null;
|
|
1404
|
+
label: MultilingualString | null;
|
|
1405
|
+
};
|
|
1406
|
+
/**
|
|
1407
|
+
* Represents a grouped Set attribute value query item
|
|
1408
|
+
*/
|
|
1409
|
+
type SetAttributeValueQueryItem = {
|
|
1410
|
+
count: number;
|
|
1411
|
+
content: string;
|
|
1412
|
+
};
|
|
1413
|
+
/**
|
|
1414
|
+
* Represents sorting direction for Set items
|
|
1415
|
+
*/
|
|
1416
|
+
type SetItemsSortDirection = "asc" | "desc";
|
|
1417
|
+
/**
|
|
1418
|
+
* Represents sorting options for Set items
|
|
1419
|
+
*/
|
|
1420
|
+
type SetItemsSort = {
|
|
1421
|
+
target: "none";
|
|
1561
1422
|
} | {
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1423
|
+
target: "title";
|
|
1424
|
+
direction?: SetItemsSortDirection;
|
|
1425
|
+
language?: string;
|
|
1565
1426
|
} | {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1427
|
+
target: "propertyValue";
|
|
1428
|
+
propertyVariableUuid: string;
|
|
1429
|
+
dataType: QueryablePropertyValueDataType;
|
|
1430
|
+
direction?: SetItemsSortDirection;
|
|
1431
|
+
language?: string;
|
|
1432
|
+
};
|
|
1433
|
+
/**
|
|
1434
|
+
* Represents a leaf query for Set items
|
|
1435
|
+
*/
|
|
1436
|
+
type QueryLeaf = {
|
|
1437
|
+
target: "property";
|
|
1438
|
+
propertyVariable?: string;
|
|
1439
|
+
dataType: Exclude<QueryablePropertyValueDataType, "date" | "dateTime">;
|
|
1440
|
+
value?: string;
|
|
1441
|
+
from?: never;
|
|
1442
|
+
to?: never;
|
|
1443
|
+
matchMode: "includes" | "exact";
|
|
1444
|
+
isCaseSensitive: boolean;
|
|
1445
|
+
language: string;
|
|
1446
|
+
isNegated?: boolean;
|
|
1586
1447
|
} | {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1448
|
+
target: "property";
|
|
1449
|
+
propertyVariable: string;
|
|
1450
|
+
dataType: "date" | "dateTime";
|
|
1451
|
+
value: string;
|
|
1452
|
+
from?: never;
|
|
1453
|
+
to?: never;
|
|
1454
|
+
matchMode: "includes" | "exact";
|
|
1455
|
+
isCaseSensitive: boolean;
|
|
1456
|
+
language: string;
|
|
1457
|
+
isNegated?: boolean;
|
|
1590
1458
|
} | {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1459
|
+
target: "property";
|
|
1460
|
+
propertyVariable: string;
|
|
1461
|
+
dataType: "date" | "dateTime";
|
|
1462
|
+
value?: never;
|
|
1463
|
+
from: string;
|
|
1464
|
+
to?: string;
|
|
1465
|
+
matchMode: "includes" | "exact";
|
|
1466
|
+
isCaseSensitive: boolean;
|
|
1467
|
+
language: string;
|
|
1468
|
+
isNegated?: boolean;
|
|
1601
1469
|
} | {
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
contextTree: ContextTree<T> | null;
|
|
1613
|
-
labels: {
|
|
1614
|
-
title: MultilingualString<T> | null;
|
|
1615
|
-
};
|
|
1616
|
-
};
|
|
1617
|
-
collectionProperties: {
|
|
1618
|
-
displayedProperties: Extract<WebElementComponent<T>, {
|
|
1619
|
-
component: "collection";
|
|
1620
|
-
}>["displayedProperties"];
|
|
1621
|
-
variant: Extract<WebElementComponent<T>, {
|
|
1622
|
-
component: "collection";
|
|
1623
|
-
}>["variant"];
|
|
1624
|
-
paginationVariant: Extract<WebElementComponent<T>, {
|
|
1625
|
-
component: "collection";
|
|
1626
|
-
}>["paginationVariant"];
|
|
1627
|
-
loadingVariant: Extract<WebElementComponent<T>, {
|
|
1628
|
-
component: "collection";
|
|
1629
|
-
}>["loadingVariant"];
|
|
1630
|
-
imageLayout: Extract<WebElementComponent<T>, {
|
|
1631
|
-
component: "collection";
|
|
1632
|
-
}>["imageLayout"];
|
|
1633
|
-
};
|
|
1470
|
+
target: "property";
|
|
1471
|
+
propertyVariable: string;
|
|
1472
|
+
dataType: "date" | "dateTime";
|
|
1473
|
+
value?: never;
|
|
1474
|
+
from?: string;
|
|
1475
|
+
to: string;
|
|
1476
|
+
matchMode: "includes" | "exact";
|
|
1477
|
+
isCaseSensitive: boolean;
|
|
1478
|
+
language: string;
|
|
1479
|
+
isNegated?: boolean;
|
|
1634
1480
|
} | {
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1481
|
+
target: "property";
|
|
1482
|
+
propertyVariable?: string;
|
|
1483
|
+
dataType: "all";
|
|
1484
|
+
value: string;
|
|
1485
|
+
matchMode: "includes" | "exact";
|
|
1486
|
+
isCaseSensitive: boolean;
|
|
1487
|
+
language: string;
|
|
1488
|
+
isNegated?: boolean;
|
|
1641
1489
|
} | {
|
|
1642
|
-
|
|
1643
|
-
|
|
1490
|
+
target: "string";
|
|
1491
|
+
value: string;
|
|
1492
|
+
matchMode: "includes" | "exact";
|
|
1493
|
+
isCaseSensitive: boolean;
|
|
1494
|
+
language: string;
|
|
1495
|
+
isNegated?: boolean;
|
|
1644
1496
|
} | {
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
} | {
|
|
1658
|
-
name: "display";
|
|
1659
|
-
size: "xs" | "sm" | "md" | "lg";
|
|
1660
|
-
};
|
|
1661
|
-
headingLevel: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
|
|
1662
|
-
content: MultilingualString<T>;
|
|
1497
|
+
target: "title" | "description" | "image" | "periods" | "bibliography" | "notes";
|
|
1498
|
+
value: string;
|
|
1499
|
+
matchMode: "includes" | "exact";
|
|
1500
|
+
isCaseSensitive: boolean;
|
|
1501
|
+
language: string;
|
|
1502
|
+
isNegated?: boolean;
|
|
1503
|
+
};
|
|
1504
|
+
/**
|
|
1505
|
+
* Represents a boolean query group for Set items
|
|
1506
|
+
*/
|
|
1507
|
+
type QueryGroup = {
|
|
1508
|
+
and: Array<Query>;
|
|
1663
1509
|
} | {
|
|
1664
|
-
|
|
1665
|
-
|
|
1510
|
+
or: Array<Query>;
|
|
1511
|
+
};
|
|
1512
|
+
/**
|
|
1513
|
+
* Represents a query for Set items
|
|
1514
|
+
*/
|
|
1515
|
+
type Query = QueryLeaf | QueryGroup;
|
|
1516
|
+
//#endregion
|
|
1517
|
+
//#region src/fetchers/gallery.d.ts
|
|
1518
|
+
type FetchFunction$4 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1519
|
+
type FetchGalleryBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
1520
|
+
languages?: TLanguages;
|
|
1521
|
+
fetch?: FetchFunction$4;
|
|
1522
|
+
};
|
|
1523
|
+
type FetchGalleryLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
1524
|
+
/**
|
|
1525
|
+
* Fetches and parses a gallery from the OCHRE API
|
|
1526
|
+
*
|
|
1527
|
+
* @param params - The parameters for the fetch
|
|
1528
|
+
* @param params.uuid - The UUID of the gallery
|
|
1529
|
+
* @param params.filter - The filter to apply to the gallery
|
|
1530
|
+
* @param params.page - The page number to fetch
|
|
1531
|
+
* @param params.perPage - The number of items per page
|
|
1532
|
+
* @param options - The options for the fetch
|
|
1533
|
+
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1534
|
+
* @param options.fetch - The fetch function to use
|
|
1535
|
+
* @returns The parsed gallery or an error message if the fetch/parse fails
|
|
1536
|
+
*/
|
|
1537
|
+
declare function fetchGallery<const TLanguages extends ReadonlyArray<string> | undefined = undefined>(params: {
|
|
1538
|
+
uuid: string;
|
|
1539
|
+
filter?: string;
|
|
1540
|
+
page: number;
|
|
1541
|
+
perPage: number;
|
|
1542
|
+
}, options?: FetchGalleryBaseOptions<TLanguages>): Promise<{
|
|
1543
|
+
gallery: Gallery<FetchGalleryLanguages<TLanguages>>;
|
|
1544
|
+
error: null;
|
|
1545
|
+
detailedError: null;
|
|
1666
1546
|
} | {
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
};
|
|
1671
|
-
type WebElementComponentName = WebElementComponent["component"];
|
|
1672
|
-
type WebElementComponentOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElementComponent<T>, {
|
|
1673
|
-
component: U;
|
|
1674
|
-
}>;
|
|
1675
|
-
type WebElementOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElement<T>, {
|
|
1676
|
-
component: U;
|
|
1547
|
+
gallery: null;
|
|
1548
|
+
error: string;
|
|
1549
|
+
detailedError: string;
|
|
1677
1550
|
}>;
|
|
1551
|
+
//#endregion
|
|
1552
|
+
//#region src/fetchers/item-links.d.ts
|
|
1553
|
+
type FetchFunction$3 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1554
|
+
type FetchItemLinksBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
1555
|
+
languages?: TLanguages;
|
|
1556
|
+
fetch?: FetchFunction$3;
|
|
1557
|
+
};
|
|
1558
|
+
type FetchItemLinksLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
1678
1559
|
/**
|
|
1679
|
-
*
|
|
1560
|
+
* Fetches linked OCHRE items by source-item UUID.
|
|
1561
|
+
*
|
|
1562
|
+
* @param uuid - The UUID of the OCHRE item whose linked items should be fetched
|
|
1563
|
+
* @param options - Fetch and parser options
|
|
1564
|
+
* @param options.containedItemCategory - The category of items inside linked Trees/Sets to parse. Tree accepts one category; Set accepts one category or an array.
|
|
1565
|
+
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1566
|
+
* @param options.fetch - Custom fetch function to use instead of the default fetch
|
|
1567
|
+
* @returns An object containing parsed linked items
|
|
1680
1568
|
*/
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1569
|
+
declare function fetchItemLinks<const TContainedItemCategory extends ContainedItemCategoryOption<ItemContainerCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options?: FetchItemLinksBaseOptions<TLanguages> & {
|
|
1570
|
+
containedItemCategory?: TContainedItemCategory;
|
|
1571
|
+
}): Promise<{
|
|
1572
|
+
items: Array<Item<ItemCategory, ContainedItemCategoryFromOption<ItemCategory, TContainedItemCategory>, FetchItemLinksLanguages<TLanguages>, "embedded">>;
|
|
1573
|
+
error: null;
|
|
1574
|
+
detailedError: null;
|
|
1575
|
+
} | {
|
|
1576
|
+
items: null;
|
|
1577
|
+
error: string;
|
|
1578
|
+
detailedError: string;
|
|
1579
|
+
}>;
|
|
1580
|
+
//#endregion
|
|
1581
|
+
//#region src/fetchers/item.d.ts
|
|
1582
|
+
type FetchFunction$2 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1583
|
+
type FetchItemBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
1584
|
+
languages?: TLanguages;
|
|
1585
|
+
fetch?: FetchFunction$2;
|
|
1688
1586
|
};
|
|
1587
|
+
type FetchItemLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
1689
1588
|
/**
|
|
1690
|
-
*
|
|
1589
|
+
* Defines a reusable languages tuple with validation and literal type inference.
|
|
1590
|
+
*
|
|
1591
|
+
* Inline arrays can be passed directly to fetchItem:
|
|
1592
|
+
* `fetchItem(uuid, { languages: ["eng", "spa"] })`.
|
|
1593
|
+
*
|
|
1594
|
+
* Use this helper when the language set is stored separately:
|
|
1595
|
+
* `const languages = defineLanguages("eng", "spa")`.
|
|
1691
1596
|
*/
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1597
|
+
declare function defineLanguages<const TLanguages extends ReadonlyArray<string>>(...languages: TLanguages): TLanguages;
|
|
1598
|
+
/**
|
|
1599
|
+
* @deprecated Pass inline language arrays directly to fetchItem, or use
|
|
1600
|
+
* defineLanguages("eng", "spa") for reusable language tuples.
|
|
1601
|
+
*/
|
|
1602
|
+
declare function withLanguages<const TLanguages extends ReadonlyArray<string>>(languages: TLanguages): TLanguages;
|
|
1603
|
+
/**
|
|
1604
|
+
* Fetches an OCHRE item by UUID from the OCHRE API
|
|
1605
|
+
*
|
|
1606
|
+
* @param uuid - The UUID of the OCHRE item to fetch
|
|
1607
|
+
* @param options - Required options object
|
|
1608
|
+
* @param options.category - The category of the OCHRE item to fetch
|
|
1609
|
+
* @param options.containedItemCategory - The category of items inside the OCHRE item to fetch. Only valid for Trees and Sets. Tree accepts one category; Set accepts one category or an array.
|
|
1610
|
+
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1611
|
+
* @param options.fetch - Custom fetch function to use instead of the default fetch
|
|
1612
|
+
* @returns An object containing the parsed item
|
|
1613
|
+
*/
|
|
1614
|
+
declare function fetchItem<const TContainedItemCategory extends ContainedItemCategoryOption<ItemContainerCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options?: FetchItemBaseOptions<TLanguages> & {
|
|
1615
|
+
category?: undefined;
|
|
1616
|
+
containedItemCategory?: TContainedItemCategory;
|
|
1617
|
+
}): Promise<{
|
|
1618
|
+
item: Item<ItemCategory, ContainedItemCategoryFromOption<ItemCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>;
|
|
1619
|
+
error: null;
|
|
1620
|
+
detailedError: null;
|
|
1621
|
+
} | {
|
|
1622
|
+
item: null;
|
|
1623
|
+
error: string;
|
|
1624
|
+
detailedError: string;
|
|
1625
|
+
}>;
|
|
1626
|
+
declare function fetchItem<const TCategory extends ItemContainerCategory, const TContainedItemCategory extends ContainedItemCategoryOption<TCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & {
|
|
1627
|
+
category: TCategory;
|
|
1628
|
+
containedItemCategory?: TContainedItemCategory;
|
|
1629
|
+
}): Promise<{
|
|
1630
|
+
item: Item<TCategory, ContainedItemCategoryFromOption<TCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>;
|
|
1631
|
+
error: null;
|
|
1632
|
+
detailedError: null;
|
|
1633
|
+
} | {
|
|
1634
|
+
item: null;
|
|
1635
|
+
error: string;
|
|
1636
|
+
detailedError: string;
|
|
1637
|
+
}>;
|
|
1638
|
+
declare function fetchItem<const TCategory extends ItemCategory, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & {
|
|
1639
|
+
category: TCategory;
|
|
1640
|
+
containedItemCategory?: never;
|
|
1641
|
+
}): Promise<{
|
|
1642
|
+
item: Item<TCategory, ContainedItemCategory<TCategory>, FetchItemLanguages<TLanguages>>;
|
|
1643
|
+
error: null;
|
|
1644
|
+
detailedError: null;
|
|
1645
|
+
} | {
|
|
1646
|
+
item: null;
|
|
1647
|
+
error: string;
|
|
1648
|
+
detailedError: string;
|
|
1649
|
+
}>;
|
|
1650
|
+
//#endregion
|
|
1651
|
+
//#region src/fetchers/set/items.d.ts
|
|
1652
|
+
type FetchFunction$1 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1653
|
+
type FetchSetItemsBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
1654
|
+
languages?: TLanguages;
|
|
1655
|
+
fetch?: FetchFunction$1;
|
|
1695
1656
|
};
|
|
1696
|
-
type
|
|
1657
|
+
type FetchSetItemsLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
1658
|
+
type FetchSetItemsCategory<TContainedItemCategories extends ReadonlyArray<SetItemCategory> | undefined> = TContainedItemCategories extends ReadonlyArray<infer U> ? Extract<U, SetItemCategory> : SetItemCategory;
|
|
1697
1659
|
/**
|
|
1698
|
-
*
|
|
1660
|
+
* Fetches and parses Set items from the OCHRE API
|
|
1661
|
+
*
|
|
1662
|
+
* @param params - The parameters for the fetch
|
|
1663
|
+
* @param params.setScopeUuids - The Set scope UUIDs to filter by
|
|
1664
|
+
* @param params.queries - Recursive query tree used to filter matching items
|
|
1665
|
+
* @param params.sort - Optional sorting configuration applied before pagination.
|
|
1666
|
+
* For propertyValue sorting, dataType is required and the sort key uses the first valid leaf value (value[not(@i)]).
|
|
1667
|
+
* @param params.page - The page number (1-indexed)
|
|
1668
|
+
* @param params.pageSize - The number of items per page
|
|
1669
|
+
* @param containedItemCategories - The categories of the items to fetch
|
|
1670
|
+
* @param options - Options for the fetch
|
|
1671
|
+
* @param options.fetch - The fetch function to use
|
|
1672
|
+
* @returns The parsed Set items or null if the fetch/parse fails
|
|
1699
1673
|
*/
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1674
|
+
declare function fetchSetItems<const TContainedItemCategories extends ReadonlyArray<SetItemCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(params: {
|
|
1675
|
+
setScopeUuids: Array<string>;
|
|
1676
|
+
queries?: Query | null;
|
|
1677
|
+
sort?: SetItemsSort;
|
|
1678
|
+
page: number;
|
|
1679
|
+
pageSize?: number;
|
|
1680
|
+
}, containedItemCategories?: TContainedItemCategories, options?: FetchSetItemsBaseOptions<TLanguages>): Promise<{
|
|
1681
|
+
totalCount: number;
|
|
1682
|
+
page: number;
|
|
1683
|
+
pageSize: number;
|
|
1684
|
+
items: Array<SetItem<FetchSetItemsCategory<TContainedItemCategories>, FetchSetItemsLanguages<TLanguages>>>;
|
|
1685
|
+
error: null;
|
|
1686
|
+
detailedError: null;
|
|
1687
|
+
} | {
|
|
1688
|
+
totalCount: null;
|
|
1689
|
+
page: null;
|
|
1690
|
+
pageSize: null;
|
|
1691
|
+
items: null;
|
|
1692
|
+
error: string;
|
|
1693
|
+
detailedError: string;
|
|
1694
|
+
}>;
|
|
1695
|
+
//#endregion
|
|
1696
|
+
//#region src/fetchers/set/property-values.d.ts
|
|
1697
|
+
/**
|
|
1698
|
+
* Fetches and parses Set property values from the OCHRE API
|
|
1699
|
+
*
|
|
1700
|
+
* @param params - The parameters for the fetch
|
|
1701
|
+
* @param params.setScopeUuids - An array of set scope UUIDs to filter by
|
|
1702
|
+
* @param params.queries - Recursive query tree used to filter matching items
|
|
1703
|
+
* @param params.attributes - Whether to return values for bibliographies and periods
|
|
1704
|
+
* @param params.attributes.bibliographies - Whether to return values for bibliographies
|
|
1705
|
+
* @param params.attributes.periods - Whether to return values for periods
|
|
1706
|
+
* @param params.isLimitedToLeafPropertyValues - Whether to limit the property values to leaf property values
|
|
1707
|
+
* @param options - Options for the fetch
|
|
1708
|
+
* @param options.fetch - The fetch function to use
|
|
1709
|
+
* @returns Parsed Set property values and requested attribute values.
|
|
1710
|
+
* Returns empty arrays/objects when no matches are found, and null outputs on fetch/parse errors.
|
|
1711
|
+
*/
|
|
1712
|
+
declare function fetchSetPropertyValues(params: {
|
|
1713
|
+
setScopeUuids: Array<string>;
|
|
1714
|
+
queries?: Query | null;
|
|
1715
|
+
attributes?: {
|
|
1716
|
+
bibliographies: boolean;
|
|
1717
|
+
periods: boolean;
|
|
1727
1718
|
};
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1719
|
+
isLimitedToLeafPropertyValues?: boolean;
|
|
1720
|
+
}, options?: {
|
|
1721
|
+
fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1722
|
+
}): Promise<{
|
|
1723
|
+
propertyValues: Array<PropertyValueQueryItem>;
|
|
1724
|
+
propertyValuesByPropertyVariableUuid: Record<string, Array<PropertyValueQueryItem>>;
|
|
1725
|
+
attributeValues: {
|
|
1726
|
+
bibliographies: Array<SetAttributeValueQueryItem> | null;
|
|
1727
|
+
periods: Array<SetAttributeValueQueryItem> | null;
|
|
1732
1728
|
};
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1729
|
+
error: null;
|
|
1730
|
+
detailedError: null;
|
|
1731
|
+
} | {
|
|
1732
|
+
propertyValues: null;
|
|
1733
|
+
propertyValuesByPropertyVariableUuid: null;
|
|
1734
|
+
attributeValues: null;
|
|
1735
|
+
error: string;
|
|
1736
|
+
detailedError: string;
|
|
1737
|
+
}>;
|
|
1736
1738
|
//#endregion
|
|
1737
1739
|
//#region src/fetchers/website.d.ts
|
|
1738
1740
|
type FetchFunction = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|