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