ochre-sdk 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/constants.d.mts +17 -0
  2. package/dist/constants.mjs +85 -0
  3. package/dist/fetchers/gallery.d.mts +38 -0
  4. package/dist/fetchers/gallery.mjs +91 -0
  5. package/dist/fetchers/item-links.d.mts +32 -0
  6. package/dist/fetchers/item-links.mjs +120 -0
  7. package/dist/fetchers/item.d.mts +74 -0
  8. package/dist/fetchers/item.mjs +146 -0
  9. package/dist/fetchers/set/items.d.mts +48 -0
  10. package/dist/fetchers/set/items.mjs +268 -0
  11. package/dist/fetchers/set/property-values.d.mts +46 -0
  12. package/dist/fetchers/set/property-values.mjs +514 -0
  13. package/dist/fetchers/website.d.mts +25 -0
  14. package/dist/fetchers/website.mjs +38 -0
  15. package/dist/getters.d.mts +193 -0
  16. package/dist/getters.mjs +341 -0
  17. package/dist/helpers.d.mts +18 -0
  18. package/dist/helpers.mjs +33 -0
  19. package/dist/index.d.mts +12 -1971
  20. package/dist/index.mjs +9 -7236
  21. package/dist/parsers/helpers.d.mts +27 -0
  22. package/dist/parsers/helpers.mjs +53 -0
  23. package/dist/parsers/index.d.mts +65 -0
  24. package/dist/parsers/index.mjs +1338 -0
  25. package/dist/parsers/mdx.d.mts +4 -0
  26. package/dist/parsers/mdx.mjs +9 -0
  27. package/dist/parsers/multilingual.d.mts +189 -0
  28. package/dist/parsers/multilingual.mjs +410 -0
  29. package/dist/parsers/string.d.mts +29 -0
  30. package/dist/parsers/string.mjs +445 -0
  31. package/dist/parsers/website/index.d.mts +20 -0
  32. package/dist/parsers/website/index.mjs +1245 -0
  33. package/dist/parsers/website/reader.d.mts +29 -0
  34. package/dist/parsers/website/reader.mjs +75 -0
  35. package/dist/query.d.mts +13 -0
  36. package/dist/query.mjs +827 -0
  37. package/dist/schemas.d.mts +79 -0
  38. package/dist/schemas.mjs +223 -0
  39. package/dist/types/index.d.mts +840 -0
  40. package/dist/types/index.mjs +1 -0
  41. package/dist/types/website.d.mts +501 -0
  42. package/dist/types/website.mjs +1 -0
  43. package/dist/utils.d.mts +34 -0
  44. package/dist/utils.mjs +172 -0
  45. package/dist/xml/metadata.d.mts +5 -0
  46. package/dist/xml/metadata.mjs +30 -0
  47. package/dist/xml/schemas.d.mts +13 -0
  48. package/dist/xml/schemas.mjs +849 -0
  49. package/dist/xml/types.d.mts +901 -0
  50. package/dist/xml/types.mjs +1 -0
  51. package/package.json +19 -17
package/dist/index.d.mts CHANGED
@@ -1,1971 +1,12 @@
1
- //#region src/parsers/multilingual.d.ts
2
- /**
3
- * One text entry for a language. When OCHRE exposes multiple entries for the
4
- * same language, the first one is primary.
5
- */
6
- type MultilingualStringEntry = {
7
- text: string;
8
- richText: string;
9
- isPrimary: boolean;
10
- };
11
- type MultilingualStringText = {
12
- text: string;
13
- richText: string;
14
- };
15
- type MultilingualStringInput = string | {
16
- text: string;
17
- richText?: string;
18
- };
19
- type MultilingualStringJSON<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
20
- content: Partial<Record<T[number], Array<MultilingualStringEntry>>>;
21
- aliases: Array<string>;
22
- };
23
- type MultilingualStringObject<T extends ReadonlyArray<string> = ReadonlyArray<string>> = Partial<Record<T[number], MultilingualStringInput>>;
24
- type MultilingualStringEntries<T extends ReadonlyArray<string> = ReadonlyArray<string>> = Partial<Record<T[number], ReadonlyArray<MultilingualStringInput>>>;
25
- /**
26
- * Options for creating and working with multilingual strings
27
- */
28
- type MultilingualOptions = {
29
- /** Default language to use for fallbacks */defaultLanguage?: string; /** Available languages for this string */
30
- availableLanguages?: ReadonlyArray<string>; /** Alias values carried by OCHRE as zxx content */
31
- aliases?: ReadonlyArray<string>;
32
- };
33
- type MultilingualContent<T extends ReadonlyArray<string>> = Partial<Record<T[number], ReadonlyArray<MultilingualStringEntry>>>;
34
- declare const MULTILINGUAL_STRING_INTERNAL_INIT: unique symbol;
35
- type MultilingualStringInternalInit<T extends ReadonlyArray<string>> = {
36
- readonly [MULTILINGUAL_STRING_INTERNAL_INIT]: true;
37
- content: MultilingualContent<T>;
38
- options: Required<MultilingualOptions>;
39
- availableLanguages: ReadonlyArray<T[number]>;
40
- };
41
- /**
42
- * Multilingual string
43
- */
44
- declare class MultilingualString<T extends ReadonlyArray<string> = ReadonlyArray<string>> {
45
- private readonly _content;
46
- private readonly _options;
47
- private readonly _availableLanguages;
48
- private readonly _aliases;
49
- /**
50
- * Create a new multilingual string from an object of language codes to text.
51
- */
52
- /** @internal */
53
- constructor(init: MultilingualStringInternalInit<T>);
54
- constructor(content: MultilingualStringObject<T>, languages: T, options?: MultilingualOptions);
55
- constructor(content?: Partial<Record<string, MultilingualStringInput>>, languages?: undefined, options?: MultilingualOptions);
56
- private static fromNormalized;
57
- /**
58
- * Create a new multilingual string from an object of language codes to text
59
- */
60
- static fromObject<U extends ReadonlyArray<string>>(content: MultilingualStringObject<U>, languages: U, options?: MultilingualOptions): MultilingualString<U>;
61
- static fromObject(content: Partial<Record<string, MultilingualStringInput>>, languages?: undefined, options?: MultilingualOptions): MultilingualString<ReadonlyArray<string>>;
62
- /**
63
- * Create a new multilingual string from language entries.
64
- */
65
- static fromEntries<U extends ReadonlyArray<string>>(content: MultilingualStringEntries<U>, languages: U, options?: MultilingualOptions): MultilingualString<U>;
66
- static fromEntries(content: Partial<Record<string, ReadonlyArray<MultilingualStringInput>>>, languages?: undefined, options?: MultilingualOptions): MultilingualString<ReadonlyArray<string>>;
67
- /**
68
- * Create a new multilingual string for a single language
69
- */
70
- static create<U extends ReadonlyArray<string>>(language: U[number], text: MultilingualStringInput, languages: U, options?: MultilingualOptions): MultilingualString<U>;
71
- static create(language: string, text: MultilingualStringInput, languages?: undefined, options?: MultilingualOptions): MultilingualString<ReadonlyArray<string>>;
72
- /**
73
- * Create an empty multilingual string
74
- */
75
- static empty<U extends ReadonlyArray<string>>(languages: U, options?: MultilingualOptions): MultilingualString<U>;
76
- static empty(languages?: undefined, options?: MultilingualOptions): MultilingualString<ReadonlyArray<string>>;
77
- /**
78
- * Recreate a multilingual string from its JSON representation.
79
- */
80
- static fromJSON<U extends ReadonlyArray<string>>(json: MultilingualStringJSON<U>, languages: U, options?: Omit<MultilingualOptions, "aliases">): MultilingualString<U>;
81
- static fromJSON(json: MultilingualStringJSON, languages?: undefined, options?: Omit<MultilingualOptions, "aliases">): MultilingualString<ReadonlyArray<string>>;
82
- private getPrimaryEntry;
83
- /**
84
- * Get text in a specific language with automatic fallback
85
- */
86
- getText(language?: T[number]): string;
87
- /**
88
- * Get rich text in a specific language with automatic fallback
89
- */
90
- getRichText(language?: T[number]): string;
91
- /**
92
- * Get primary text in a specific language without fallback
93
- */
94
- getExactText(language: T[number]): string | null;
95
- /**
96
- * Get primary rich text in a specific language without fallback
97
- */
98
- getExactRichText(language: T[number]): string | null;
99
- /**
100
- * Get all text entries in a specific language without fallback
101
- */
102
- getExactTexts(language: T[number]): Array<string>;
103
- /**
104
- * Get all rich text entries in a specific language without fallback
105
- */
106
- getExactRichTexts(language: T[number]): Array<string>;
107
- /**
108
- * Get all text entries in a specific language with fallback
109
- */
110
- getTexts(language?: T[number]): Array<string>;
111
- /**
112
- * Get all rich text entries in a specific language with fallback
113
- */
114
- getRichTexts(language?: T[number]): Array<string>;
115
- /**
116
- * Get all entries in a specific language without fallback
117
- */
118
- getExactEntries(language: T[number]): Array<MultilingualStringEntry>;
119
- /**
120
- * Get all entries in a specific language with fallback
121
- */
122
- getEntries(language?: T[number]): Array<MultilingualStringEntry>;
123
- /**
124
- * Get aliases carried by OCHRE as zxx content
125
- */
126
- getAliases(): Array<string>;
127
- /**
128
- * Check if text exists for a specific language
129
- */
130
- hasLanguage(language: T[number]): boolean;
131
- /**
132
- * Check if aliases exist
133
- */
134
- hasAliases(): boolean;
135
- /**
136
- * Get all available languages
137
- */
138
- getAvailableLanguages(): ReadonlyArray<T[number]>;
139
- /**
140
- * Get all supported languages (the full language array passed to constructor)
141
- */
142
- getSupportedLanguages(): T;
143
- /**
144
- * Check if the multilingual string is empty (no content in any language)
145
- */
146
- isEmpty(): boolean;
147
- /**
148
- * Check if the multilingual string has any content
149
- */
150
- hasContent(): boolean;
151
- /**
152
- * Get the default language
153
- */
154
- getDefaultLanguage(): T[number];
155
- /**
156
- * Add or update the primary text for a language (returns new instance)
157
- */
158
- withText(language: T[number], text: MultilingualStringInput): MultilingualString<T>;
159
- /**
160
- * Add another text entry for a language (returns new instance)
161
- */
162
- withEntry(language: T[number], text: MultilingualStringInput): MultilingualString<T>;
163
- /**
164
- * Replace aliases (returns new instance)
165
- */
166
- withAliases(aliases: ReadonlyArray<string>): MultilingualString<T>;
167
- /**
168
- * Remove text for a language (returns new instance)
169
- */
170
- withoutLanguage(language: T[number]): MultilingualString<T>;
171
- /**
172
- * Transform all language versions (returns new instance)
173
- */
174
- map(fn: (text: string, language: T[number]) => string): MultilingualString<T>;
175
- /**
176
- * Filter languages based on predicate (returns new instance)
177
- */
178
- filter(predicate: (text: string, language: T[number]) => boolean): MultilingualString<T>;
179
- /**
180
- * Get the string representation (uses default language)
181
- */
182
- toString(): string;
183
- /**
184
- * Get JSON representation
185
- */
186
- toJSON(): MultilingualStringJSON<T>;
187
- }
188
- //#endregion
189
- //#region src/types/website.d.ts
190
- type WebsitePropertyValueDataType = QueryablePropertyValueDataType;
191
- /**
192
- * Represents a context tree level item with a variable and value
193
- */
194
- type ContextTreeLevelItem = {
195
- variableUuid: string;
196
- valueUuid: string | null;
197
- };
198
- /**
199
- * Represents a context tree level with a context item
200
- */
201
- type ContextTreeLevel<T extends LanguageCodes = LanguageCodes> = {
202
- context: Array<ContextTreeLevelItem>;
203
- identification: Identification<T>;
204
- type: string;
205
- };
206
- /**
207
- * Represents a filter context tree level with a context item
208
- */
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;
217
- };
218
- /**
219
- * Represents a context tree with levels grouped by behavior
220
- */
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>>;
230
- };
231
- /**
232
- * Represents a scope with its UUID, type and identification
233
- */
234
- type Scope<T extends LanguageCodes = LanguageCodes> = {
235
- uuid: string;
236
- type: string;
237
- identification: Identification<T>;
238
- };
239
- /**
240
- * Represents a stylesheet item with its UUID and category
241
- */
242
- type StylesheetCategory = Extract<ItemCategory, "propertyVariable" | "propertyValue">;
243
- type StylesheetItem = {
244
- uuid: string;
245
- category: "propertyVariable";
246
- icon: string | null;
247
- styles: {
248
- default: Array<Style>;
249
- tablet: Array<Style>;
250
- mobile: Array<Style>;
251
- };
252
- } | {
253
- uuid: string;
254
- category: "propertyValue";
255
- variableUuid: string;
256
- icon: string | null;
257
- styles: {
258
- default: Array<Style>;
259
- tablet: Array<Style>;
260
- mobile: Array<Style>;
261
- };
262
- };
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>>;
273
- } | {
274
- or: Array<WebsitePropertyQuery<T>>;
275
- };
276
- /**
277
- * Represents the OCHRE website type
278
- */
279
- type WebsiteType = "traditional" | "digital-collection" | "plum" | "cedar" | "elm" | "maple" | "oak" | "palm";
280
- /**
281
- * Represents a website with its properties and elements
282
- */
283
- type Website<T extends LanguageCodes = LanguageCodes> = {
284
- uuid: string;
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";
309
- };
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
- };
365
- };
366
- type WebsiteSegment<T extends LanguageCodes = LanguageCodes> = Website<T> & {
367
- type: "segment";
368
- };
369
- /**
370
- * Represents a webpage with its title, slug, properties, items and subpages
371
- */
372
- type Webpage<T extends LanguageCodes = LanguageCodes> = {
373
- uuid: string;
374
- type: "page";
375
- title: MultilingualString<T>;
376
- slug: string;
377
- 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
- };
393
- };
394
- webpages: Array<Webpage<T>>;
395
- };
396
- /**
397
- * Represents a title with its label and variant
398
- */
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;
408
- };
409
- };
410
- /**
411
- * Base properties for web elements
412
- */
413
- type WebElement<T extends LanguageCodes = LanguageCodes> = {
414
- uuid: string;
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>;
423
- /**
424
- * Union type of all possible web element components
425
- */
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;
435
- href: string | null;
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;
530
- } | null;
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;
589
- href: string | null;
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;
623
- }>;
624
- type WebElementOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElement<T>, {
625
- component: U;
626
- }>;
627
- /**
628
- * Represents an image used in web elements
629
- */
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
- };
638
- /**
639
- * Represents a CSS style with label and value
640
- */
641
- type Style = {
642
- label: string;
643
- value: string;
644
- };
645
- type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "horizontal-flex" | "accordion";
646
- /**
647
- * Represents a block of vertical or horizontal content alignment
648
- */
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
- };
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] } & {};
688
- /**
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.
693
- */
694
- type LanguageCodes = ReadonlyArray<string>;
695
- /**
696
- * The category of an item in OCHRE
697
- */
698
- type ItemCategory = "tree" | "bibliography" | "concept" | "spatialUnit" | "period" | "person" | "propertyVariable" | "propertyValue" | "resource" | "text" | "set";
699
- /**
700
- * OCHRE item categories that can contain other items in API payloads.
701
- */
702
- type ItemContainerCategory = Extract<ItemCategory, "tree" | "set">;
703
- /**
704
- * The category of items in a Tree
705
- */
706
- type TreeItemCategory = Exclude<ItemCategory, "tree">;
707
- /**
708
- * The category of items in a Set
709
- */
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>;
714
- /**
715
- * The category of items in a heading
716
- */
717
- type HeadingItemCategory = Exclude<ItemCategory, "tree" | "bibliography" | "spatialUnit" | "concept" | "period">;
718
- /**
719
- * The category of items that expose recursive subitem structures.
720
- */
721
- type RecursiveItemCategory = Exclude<ItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
722
- /**
723
- * The category names that can appear in OCHRE context paths
724
- */
725
- type ContextItemCategory = Exclude<ItemCategory, "tree" | "person" | "set">;
726
- /**
727
- * Basic identification information
728
- */
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;
735
- };
736
- /**
737
- * Metadata in OCHRE
738
- */
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
- };
784
- /**
785
- * License in OCHRE
786
- */
787
- type License = {
788
- content: string;
789
- target: string | null;
790
- };
791
- /**
792
- * Context item in OCHRE
793
- */
794
- type ContextItem = {
795
- uuid: string | null;
796
- publicationDateTime: Date | null;
797
- index: number;
798
- content: string;
799
- };
800
- /**
801
- * Context node in OCHRE
802
- */
803
- type ContextNode<U extends ContextItemCategory = ContextItemCategory> = {
804
- tree: ContextItem;
805
- project: ContextItem;
806
- heading: Array<ContextItem>;
807
- } & Partial<Record<U, Array<ContextItem>>>;
808
- /**
809
- * Context in OCHRE
810
- */
811
- type Context<U extends ContextItemCategory = ContextItemCategory> = {
812
- nodes: Array<ContextNode<U>>;
813
- displayPath: string;
814
- };
815
- /**
816
- * Event in OCHRE
817
- */
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;
840
- };
841
- /**
842
- * Source of coordinates in OCHRE
843
- */
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>;
861
- };
862
- /**
863
- * Coordinates in OCHRE
864
- */
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;
882
- };
883
- /**
884
- * Image in OCHRE
885
- */
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;
895
- };
896
- /**
897
- * Area of an image map in OCHRE
898
- */
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
- }>;
919
- };
920
- /**
921
- * Image map in OCHRE
922
- */
923
- type ImageMap = {
924
- areas: Array<ImageMapArea>;
925
- width: number;
926
- height: number;
927
- };
928
- /**
929
- * Note in OCHRE
930
- */
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">>;
936
- };
937
- /**
938
- * Property value content in OCHRE
939
- */
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;
960
- } | {
961
- dataType: "integer" | "decimal" | "time";
962
- content: number;
963
- } | {
964
- dataType: "boolean";
965
- content: boolean;
966
- })>;
967
- /**
968
- * Property in OCHRE
969
- */
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>>;
979
- };
980
- /**
981
- * Simplified property in OCHRE website payloads. Simplified property variables
982
- * expose scalar labels rather than multilingual labels.
983
- */
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
- };
994
- /**
995
- * Property in a Set item. OCHRE exposes Set item properties as a flat list.
996
- */
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;
1010
- /**
1011
- * Base item in OCHRE
1012
- */
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>>;
1026
- };
1027
- type ItemLinkCategory = ItemCategory | "dictionaryUnit";
1028
- /**
1029
- * Base item data exposed by OCHRE link and reverse-link payloads.
1030
- */
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;
1057
- }>;
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>>;
1115
- }>;
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>>;
1124
- /**
1125
- * An abridged item reference exposed inside OCHRE links and reverse links.
1126
- */
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;
1128
- /**
1129
- * An Item in OCHRE (can be a tree, set, bibliography, concept, spatial unit, period, person, property value, property variable, or resource)
1130
- */
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
- /**
1133
- * A Tree or Set fetched without its embedded item hierarchy.
1134
- */
1135
- type ItemWithoutEmbeddedItems<U extends ItemContainerCategory = ItemContainerCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes, W extends ItemPayloadKind = "topLevel"> = U extends ItemContainerCategory ? U extends "tree" ? Prettify<Omit<Tree<Extract<V, TreeItemCategory>, T, W>, "items">> : U extends "set" ? Prettify<Omit<Set<Extract<V, SetItemCategory>, T, W>, "items">> : never : never;
1136
- type TopLevelItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "topLevel">;
1137
- type EmbeddedItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "embedded">;
1138
- type AnyItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, ItemPayloadKind>;
1139
- /**
1140
- * Heading in OCHRE
1141
- */
1142
- type Heading<U extends HeadingItemCategory = HeadingItemCategory, T extends LanguageCodes = LanguageCodes> = {
1143
- name: string;
1144
- headings: Array<Heading<U, T>>;
1145
- items: Array<Item<U, never, T, "embedded">>;
1146
- };
1147
- /**
1148
- * Tree in OCHRE
1149
- */
1150
- type Tree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes, V extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"tree", T, V> & {
1151
- type: string | null;
1152
- containedItemCategory: U | null;
1153
- links: ItemLinks<T>;
1154
- notes: Array<Note<T>>;
1155
- properties: Array<Property<T>>;
1156
- bibliographies: Array<Bibliography<T, "embedded">>;
1157
- items: U extends HeadingItemCategory ? Array<Heading<U, T> | Item<U, never, T, "embedded">> : Array<Item<U, never, T, "embedded">>;
1158
- }>;
1159
- /**
1160
- * Set in OCHRE
1161
- */
1162
- type Set<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes, V extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"set", T, V> & {
1163
- containedItemCategories: Array<U>;
1164
- isTabularStructure: boolean;
1165
- isSuppressingBlanks: boolean;
1166
- links: ItemLinks<T>;
1167
- notes: Array<Note<T>>;
1168
- properties: Array<Property<T>>;
1169
- items: Array<SetItem<U, T>>;
1170
- }>;
1171
- type SetBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded"> extends infer U ? U extends {
1172
- properties: Array<Property<T>>;
1173
- } ? Prettify<Omit<U, "properties" | "items"> & {
1174
- properties: Array<SetItemProperty<T>>;
1175
- }> : never : never;
1176
- type SetConcept<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<Concept<T, "embedded">, "interpretations" | "items"> & {
1177
- properties: Array<SetItemProperty<T>>;
1178
- }>;
1179
- type SetSpatialUnit<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<SpatialUnit<T, "embedded">, "observations" | "items"> & {
1180
- properties: Array<SetItemProperty<T>>;
1181
- }>;
1182
- type SetPeriod<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Period<T, "embedded">, T>, "items">>;
1183
- type SetResource<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Resource<T, "embedded">, T>, "items">>;
1184
- type SetTree<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Tree<TreeItemCategory, T, "embedded">, T>, "items">>;
1185
- 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;
1186
- /**
1187
- * Person in OCHRE
1188
- */
1189
- type Person<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"person", T, U> & {
1190
- type: string;
1191
- image: Image<T> | null;
1192
- address: {
1193
- country: string | null;
1194
- city: string | null;
1195
- state: string | null;
1196
- postalCode: string | null;
1197
- } | null;
1198
- coordinates: Array<Coordinates<T>>;
1199
- content: MultilingualString<T> | null;
1200
- periods: Array<Period<T, "embedded">>;
1201
- links: ItemLinks<T>;
1202
- notes: Array<Note<T>>;
1203
- properties: Array<Property<T>>;
1204
- }>;
1205
- /**
1206
- * Period in OCHRE
1207
- */
1208
- type Period<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"period", T, U> & {
1209
- type: string | null;
1210
- coordinates: Array<Coordinates<T>>;
1211
- links: ItemLinks<T>;
1212
- notes: Array<Note<T>>;
1213
- properties: Array<Property<T>>;
1214
- bibliographies: Array<Bibliography<T, "embedded">>;
1215
- items: Array<Period<T, "embedded">>;
1216
- }>;
1217
- /**
1218
- * Bibliography in OCHRE
1219
- */
1220
- type Bibliography<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"bibliography", T, U> & {
1221
- citationDetails: string | null;
1222
- citationFormat: MultilingualString<T> | null;
1223
- citationFormatSpan: string | null;
1224
- referenceFormatDiv: string | null;
1225
- image: Image<T> | null;
1226
- sourceDocument: BibliographySourceDocument | null;
1227
- publicationInfo: {
1228
- publishers: Array<Person<T, "embedded">>;
1229
- startDate: Date | null;
1230
- } | null;
1231
- entryInfo: BibliographyEntryInfo | null;
1232
- source: ItemLink<TreeItemCategory, T> | null;
1233
- authors: Array<Person<T, "embedded">>;
1234
- periods: Array<Period<T, "embedded">>;
1235
- links: ItemLinks<T>;
1236
- notes: Array<Note<T>>;
1237
- properties: Array<Property<T>>;
1238
- bibliographies: Array<Bibliography<T, "embedded">>;
1239
- items: Array<Bibliography<T, "embedded">>;
1240
- } & ({
1241
- type: "zotero";
1242
- zoteroId: string;
1243
- uuid: string | null;
1244
- } | {
1245
- type: string | null;
1246
- })>;
1247
- /**
1248
- * Concept in OCHRE
1249
- */
1250
- type Concept<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"concept", T, U> & {
1251
- image: Image<T> | null;
1252
- interpretations: Array<Interpretation<T>>;
1253
- coordinates: Array<Coordinates<T>>;
1254
- items: Array<Concept<T, "embedded">>;
1255
- }>;
1256
- /**
1257
- * Interpretation in OCHRE
1258
- */
1259
- type Interpretation<T extends LanguageCodes = LanguageCodes> = {
1260
- number: number;
1261
- date: Date | null;
1262
- observers: Array<Person<T, "embedded">>;
1263
- periods: Array<Period<T, "embedded">>;
1264
- links: ItemLinks<T>;
1265
- notes: Array<Note<T>>;
1266
- properties: Array<Property<T>>;
1267
- bibliographies: Array<Bibliography<T, "embedded">>;
1268
- };
1269
- /**
1270
- * Spatial unit in OCHRE
1271
- */
1272
- type SpatialUnit<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"spatialUnit", T, U> & {
1273
- image: Image<T> | null;
1274
- coordinates: Array<Coordinates<T>>;
1275
- mapData: {
1276
- geoJSON: {
1277
- multiPolygon: string;
1278
- EPSG: number;
1279
- };
1280
- } | null;
1281
- observations: Array<Observation<T>>;
1282
- bibliographies: Array<Bibliography<T, "embedded">>;
1283
- items: Array<SpatialUnit<T, "embedded">>;
1284
- }>;
1285
- /**
1286
- * Observation in OCHRE
1287
- */
1288
- type Observation<T extends LanguageCodes = LanguageCodes> = {
1289
- number: number;
1290
- date: Date | null;
1291
- observers: Array<string> | Array<Person<T, "embedded">>;
1292
- periods: Array<Period<T, "embedded">>;
1293
- links: ItemLinks<T>;
1294
- notes: Array<Note<T>>;
1295
- properties: Array<Property<T>>;
1296
- bibliographies: Array<Bibliography<T, "embedded">>;
1297
- };
1298
- /**
1299
- * Property variable in OCHRE
1300
- */
1301
- type PropertyVariable<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"propertyVariable", T, U> & {
1302
- type: string | null;
1303
- coordinates: Array<Coordinates<T>>;
1304
- links: ItemLinks<T>;
1305
- notes: Array<Note<T>>;
1306
- bibliographies: Array<Bibliography<T, "embedded">>;
1307
- }>;
1308
- /**
1309
- * Property value in OCHRE
1310
- */
1311
- type PropertyValue<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"propertyValue", T, U> & {
1312
- coordinates: Array<Coordinates<T>>;
1313
- links: ItemLinks<T>;
1314
- notes: Array<Note<T>>;
1315
- properties: Array<Property<T>>;
1316
- bibliographies: Array<Bibliography<T, "embedded">>;
1317
- }>;
1318
- /**
1319
- * Resource in OCHRE
1320
- */
1321
- type Resource<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"resource", T, U> & {
1322
- type: string;
1323
- href: string | null;
1324
- fileFormat: string | null;
1325
- fileSize: number | null;
1326
- isInline: boolean;
1327
- height: number | null;
1328
- width: number | null;
1329
- image: Image<T> | null;
1330
- document: MultilingualString<T> | null;
1331
- imageMap: ImageMap | null;
1332
- coordinates: Array<Coordinates<T>>;
1333
- periods: Array<Period<T, "embedded">>;
1334
- links: ItemLinks<T>;
1335
- reverseLinks: ItemLinks<T>;
1336
- notes: Array<Note<T>>;
1337
- properties: Array<Property<T>>;
1338
- bibliographies: Array<Bibliography<T, "embedded">>;
1339
- items: Array<Resource<T, "embedded">>;
1340
- } & (U extends "topLevel" ? {
1341
- view: Webpage<T> | null;
1342
- } : unknown)>;
1343
- /**
1344
- * Text in OCHRE
1345
- */
1346
- type Text<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"text", T, U> & {
1347
- type: string;
1348
- text: string | null;
1349
- language: string | null;
1350
- image: Image<T> | null;
1351
- coordinates: Array<Coordinates<T>>;
1352
- links: ItemLinks<T>;
1353
- reverseLinks: ItemLinks<T>;
1354
- notes: Array<Note<T>>;
1355
- sections: Array<Section<T>>;
1356
- periods: Array<Period<T, "embedded">>;
1357
- creators: Array<Person<T, "embedded">>;
1358
- editions: Array<Person<T, "embedded">>;
1359
- }>;
1360
- /**
1361
- * Section in OCHRE
1362
- */
1363
- type Section<T extends LanguageCodes = LanguageCodes> = {
1364
- uuid: string;
1365
- publicationDateTime: Date | null;
1366
- identification: Identification<T>;
1367
- project: {
1368
- identification: Identification<T>;
1369
- } | null;
1370
- };
1371
- type EmbeddedTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, "embedded">;
1372
- type AnyTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, ItemPayloadKind>;
1373
- type EmbeddedSet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, "embedded">;
1374
- type AnySet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, ItemPayloadKind>;
1375
- type EmbeddedBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded">;
1376
- type AnyBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, ItemPayloadKind>;
1377
- type EmbeddedConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, "embedded">;
1378
- type AnyConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, ItemPayloadKind>;
1379
- type EmbeddedSpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, "embedded">;
1380
- type AnySpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, ItemPayloadKind>;
1381
- type EmbeddedPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, "embedded">;
1382
- type AnyPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, ItemPayloadKind>;
1383
- type EmbeddedPerson<T extends LanguageCodes = LanguageCodes> = Person<T, "embedded">;
1384
- type AnyPerson<T extends LanguageCodes = LanguageCodes> = Person<T, ItemPayloadKind>;
1385
- type EmbeddedPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, "embedded">;
1386
- type AnyPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, ItemPayloadKind>;
1387
- type EmbeddedPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, "embedded">;
1388
- type AnyPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, ItemPayloadKind>;
1389
- type EmbeddedResource<T extends LanguageCodes = LanguageCodes> = Resource<T, "embedded">;
1390
- type AnyResource<T extends LanguageCodes = LanguageCodes> = Resource<T, ItemPayloadKind>;
1391
- type EmbeddedText<T extends LanguageCodes = LanguageCodes> = Text<T, "embedded">;
1392
- type AnyText<T extends LanguageCodes = LanguageCodes> = Text<T, ItemPayloadKind>;
1393
- /**
1394
- * Represents a gallery with its identification, project identification, resources and max length
1395
- */
1396
- type Gallery<T extends LanguageCodes = LanguageCodes> = {
1397
- identification: Identification<T>;
1398
- projectIdentification: Identification<T>;
1399
- resources: Array<Resource<T, "embedded">>;
1400
- maxLength: number;
1401
- };
1402
- /**
1403
- * Represents a property query item with its UUID, raw value, count, and content
1404
- */
1405
- type PropertyValueQueryItem = {
1406
- count: number;
1407
- dataType: QueryablePropertyValueDataType;
1408
- content: string | number | boolean | null;
1409
- label: MultilingualString | null;
1410
- };
1411
- /**
1412
- * Represents a grouped Set attribute value query item
1413
- */
1414
- type SetAttributeValueQueryItem = {
1415
- count: number;
1416
- content: string;
1417
- };
1418
- /**
1419
- * Represents sorting direction for Set items
1420
- */
1421
- type SetItemsSortDirection = "asc" | "desc";
1422
- /**
1423
- * Represents sorting options for Set items
1424
- */
1425
- type SetItemsSort = {
1426
- target: "none";
1427
- } | {
1428
- target: "title";
1429
- direction?: SetItemsSortDirection;
1430
- language?: string;
1431
- } | {
1432
- target: "propertyValue";
1433
- propertyVariableUuid: string;
1434
- dataType: QueryablePropertyValueDataType;
1435
- direction?: SetItemsSortDirection;
1436
- language?: string;
1437
- };
1438
- /**
1439
- * Represents a leaf query for Set items
1440
- */
1441
- type QueryLeaf = {
1442
- target: "property";
1443
- propertyVariable?: string;
1444
- dataType: Exclude<QueryablePropertyValueDataType, "date" | "dateTime">;
1445
- value?: string;
1446
- from?: never;
1447
- to?: never;
1448
- matchMode: "includes" | "exact";
1449
- isCaseSensitive: boolean;
1450
- language: string;
1451
- isNegated?: boolean;
1452
- } | {
1453
- target: "property";
1454
- propertyVariable: string;
1455
- dataType: "date" | "dateTime";
1456
- value: string;
1457
- from?: never;
1458
- to?: never;
1459
- matchMode: "includes" | "exact";
1460
- isCaseSensitive: boolean;
1461
- language: string;
1462
- isNegated?: boolean;
1463
- } | {
1464
- target: "property";
1465
- propertyVariable: string;
1466
- dataType: "date" | "dateTime";
1467
- value?: never;
1468
- from: string;
1469
- to?: string;
1470
- matchMode: "includes" | "exact";
1471
- isCaseSensitive: boolean;
1472
- language: string;
1473
- isNegated?: boolean;
1474
- } | {
1475
- target: "property";
1476
- propertyVariable: string;
1477
- dataType: "date" | "dateTime";
1478
- value?: never;
1479
- from?: string;
1480
- to: string;
1481
- matchMode: "includes" | "exact";
1482
- isCaseSensitive: boolean;
1483
- language: string;
1484
- isNegated?: boolean;
1485
- } | {
1486
- target: "property";
1487
- propertyVariable?: string;
1488
- dataType: "all";
1489
- value: string;
1490
- matchMode: "includes" | "exact";
1491
- isCaseSensitive: boolean;
1492
- language: string;
1493
- isNegated?: boolean;
1494
- } | {
1495
- target: "string";
1496
- value: string;
1497
- matchMode: "includes" | "exact";
1498
- isCaseSensitive: boolean;
1499
- language: string;
1500
- isNegated?: boolean;
1501
- } | {
1502
- target: "title" | "description" | "image" | "periods" | "bibliography" | "notes";
1503
- value: string;
1504
- matchMode: "includes" | "exact";
1505
- isCaseSensitive: boolean;
1506
- language: string;
1507
- isNegated?: boolean;
1508
- };
1509
- /**
1510
- * Represents a boolean query group for Set items
1511
- */
1512
- type QueryGroup = {
1513
- and: Array<Query>;
1514
- } | {
1515
- or: Array<Query>;
1516
- };
1517
- /**
1518
- * Represents a query for Set items
1519
- */
1520
- type Query = QueryLeaf | QueryGroup;
1521
- //#endregion
1522
- //#region src/fetchers/gallery.d.ts
1523
- type FetchFunction$4 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1524
- type FetchGalleryBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
1525
- languages?: TLanguages;
1526
- fetch?: FetchFunction$4;
1527
- };
1528
- type FetchGalleryLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
1529
- /**
1530
- * Fetches and parses a gallery from the OCHRE API
1531
- *
1532
- * @param params - The parameters for the fetch
1533
- * @param params.uuid - The UUID of the gallery
1534
- * @param params.filter - The filter to apply to the gallery
1535
- * @param params.page - The page number to fetch
1536
- * @param params.perPage - The number of items per page
1537
- * @param options - The options for the fetch
1538
- * @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
1539
- * @param options.fetch - The fetch function to use
1540
- * @returns The parsed gallery or an error message if the fetch/parse fails
1541
- */
1542
- declare function fetchGallery<const TLanguages extends ReadonlyArray<string> | undefined = undefined>(params: {
1543
- uuid: string;
1544
- filter?: string;
1545
- page: number;
1546
- perPage: number;
1547
- }, options?: FetchGalleryBaseOptions<TLanguages>): Promise<{
1548
- gallery: Gallery<FetchGalleryLanguages<TLanguages>>;
1549
- error: null;
1550
- detailedError: null;
1551
- } | {
1552
- gallery: null;
1553
- error: string;
1554
- detailedError: string;
1555
- }>;
1556
- //#endregion
1557
- //#region src/fetchers/item-links.d.ts
1558
- type FetchFunction$3 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1559
- type FetchItemLinksBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
1560
- languages?: TLanguages;
1561
- fetch?: FetchFunction$3;
1562
- };
1563
- type FetchItemLinksLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
1564
- /**
1565
- * Fetches linked OCHRE items by source-item UUID.
1566
- *
1567
- * @param uuid - The UUID of the OCHRE item whose linked items should be fetched
1568
- * @param options - Fetch and parser options
1569
- * @param options.containedItemCategory - The category of items inside linked Trees/Sets to parse. Tree accepts one category; Set accepts one category or an array.
1570
- * @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
1571
- * @param options.fetch - Custom fetch function to use instead of the default fetch
1572
- * @returns An object containing parsed linked items
1573
- */
1574
- declare function fetchItemLinks<const TContainedItemCategory extends ContainedItemCategoryOption<ItemContainerCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options?: FetchItemLinksBaseOptions<TLanguages> & {
1575
- containedItemCategory?: TContainedItemCategory;
1576
- }): Promise<{
1577
- items: Array<Item<ItemCategory, ContainedItemCategoryFromOption<ItemCategory, TContainedItemCategory>, FetchItemLinksLanguages<TLanguages>, "embedded">>;
1578
- error: null;
1579
- detailedError: null;
1580
- } | {
1581
- items: null;
1582
- error: string;
1583
- detailedError: string;
1584
- }>;
1585
- //#endregion
1586
- //#region src/fetchers/item.d.ts
1587
- type FetchFunction$2 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1588
- type FetchItemBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
1589
- languages?: TLanguages;
1590
- fetch?: FetchFunction$2;
1591
- };
1592
- type FetchItemNoOmitEmbeddedItemsOption = {
1593
- shouldOmitEmbeddedItems?: false;
1594
- };
1595
- type FetchItemLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
1596
- type FetchItemSuccess<TItem> = {
1597
- item: TItem;
1598
- error: null;
1599
- detailedError: null;
1600
- };
1601
- type FetchItemError = {
1602
- item: null;
1603
- error: string;
1604
- detailedError: string;
1605
- };
1606
- type FetchItemResult<TItem> = Promise<FetchItemSuccess<TItem> | FetchItemError>;
1607
- /**
1608
- * Defines a reusable languages tuple with validation and literal type inference.
1609
- *
1610
- * Inline arrays can be passed directly to fetchItem:
1611
- * `fetchItem(uuid, { languages: ["eng", "spa"] })`.
1612
- *
1613
- * Use this helper when the language set is stored separately:
1614
- * `const languages = defineLanguages("eng", "spa")`.
1615
- */
1616
- declare function defineLanguages<const TLanguages extends ReadonlyArray<string>>(...languages: TLanguages): TLanguages;
1617
- /**
1618
- * @deprecated Pass inline language arrays directly to fetchItem, or use
1619
- * defineLanguages("eng", "spa") for reusable language tuples.
1620
- */
1621
- declare function withLanguages<const TLanguages extends ReadonlyArray<string>>(languages: TLanguages): TLanguages;
1622
- /**
1623
- * Fetches an OCHRE item by UUID from the OCHRE API
1624
- *
1625
- * @param uuid - The UUID of the OCHRE item to fetch
1626
- * @param options - Required options object
1627
- * @param options.category - The category of the OCHRE item to fetch
1628
- * @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.
1629
- * @param options.shouldOmitEmbeddedItems - Whether to omit the embedded `<items>` node when fetching a Tree or Set.
1630
- * @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
1631
- * @param options.fetch - Custom fetch function to use instead of the default fetch
1632
- * @returns An object containing the parsed item
1633
- */
1634
- declare function fetchItem<const TContainedItemCategory extends ContainedItemCategoryOption<ItemContainerCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options?: FetchItemBaseOptions<TLanguages> & FetchItemNoOmitEmbeddedItemsOption & {
1635
- category?: undefined;
1636
- containedItemCategory?: TContainedItemCategory;
1637
- }): FetchItemResult<Item<ItemCategory, ContainedItemCategoryFromOption<ItemCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>>;
1638
- declare function fetchItem<const TContainedItemCategory extends ContainedItemCategoryOption<ItemContainerCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & {
1639
- category?: undefined;
1640
- containedItemCategory?: TContainedItemCategory;
1641
- shouldOmitEmbeddedItems: true;
1642
- }): FetchItemResult<ItemWithoutEmbeddedItems<ItemContainerCategory, ContainedItemCategoryFromOption<ItemContainerCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>>;
1643
- 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> & FetchItemNoOmitEmbeddedItemsOption & {
1644
- category: TCategory;
1645
- containedItemCategory?: TContainedItemCategory;
1646
- }): FetchItemResult<Item<TCategory, ContainedItemCategoryFromOption<TCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>>;
1647
- 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> & {
1648
- category: TCategory;
1649
- containedItemCategory?: TContainedItemCategory;
1650
- shouldOmitEmbeddedItems: true;
1651
- }): FetchItemResult<ItemWithoutEmbeddedItems<TCategory, ContainedItemCategoryFromOption<TCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>>;
1652
- declare function fetchItem<const TCategory extends ItemCategory, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & FetchItemNoOmitEmbeddedItemsOption & {
1653
- category: TCategory;
1654
- containedItemCategory?: never;
1655
- }): FetchItemResult<Item<TCategory, ContainedItemCategory<TCategory>, FetchItemLanguages<TLanguages>>>;
1656
- //#endregion
1657
- //#region src/fetchers/set/items.d.ts
1658
- type FetchFunction$1 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1659
- type FetchSetItemsBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
1660
- languages?: TLanguages;
1661
- fetch?: FetchFunction$1;
1662
- };
1663
- type FetchSetItemsLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
1664
- type FetchSetItemsCategory<TContainedItemCategories extends ReadonlyArray<SetItemCategory> | undefined> = TContainedItemCategories extends ReadonlyArray<infer U> ? Extract<U, SetItemCategory> : SetItemCategory;
1665
- /**
1666
- * Fetches and parses Set items from the OCHRE API
1667
- *
1668
- * @param params - The parameters for the fetch
1669
- * @param params.setScopeUuids - The Set scope UUIDs to filter by
1670
- * @param params.queries - Recursive query tree used to filter matching items
1671
- * @param params.sort - Optional sorting configuration applied before pagination.
1672
- * For propertyValue sorting, dataType is required and the sort key uses the first valid leaf value (value[not(@i)]).
1673
- * @param params.page - The page number (1-indexed)
1674
- * @param params.pageSize - The number of items per page
1675
- * @param containedItemCategories - The categories of the items to fetch
1676
- * @param options - Options for the fetch
1677
- * @param options.fetch - The fetch function to use
1678
- * @returns The parsed Set items or null if the fetch/parse fails
1679
- */
1680
- declare function fetchSetItems<const TContainedItemCategories extends ReadonlyArray<SetItemCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(params: {
1681
- setScopeUuids: Array<string>;
1682
- queries?: Query | null;
1683
- sort?: SetItemsSort;
1684
- page: number;
1685
- pageSize?: number;
1686
- }, containedItemCategories?: TContainedItemCategories, options?: FetchSetItemsBaseOptions<TLanguages>): Promise<{
1687
- totalCount: number;
1688
- page: number;
1689
- pageSize: number;
1690
- items: Array<SetItem<FetchSetItemsCategory<TContainedItemCategories>, FetchSetItemsLanguages<TLanguages>>>;
1691
- error: null;
1692
- detailedError: null;
1693
- } | {
1694
- totalCount: null;
1695
- page: null;
1696
- pageSize: null;
1697
- items: null;
1698
- error: string;
1699
- detailedError: string;
1700
- }>;
1701
- //#endregion
1702
- //#region src/fetchers/set/property-values.d.ts
1703
- /**
1704
- * Fetches and parses Set property values from the OCHRE API
1705
- *
1706
- * @param params - The parameters for the fetch
1707
- * @param params.setScopeUuids - An array of set scope UUIDs to filter by
1708
- * @param params.queries - Recursive query tree used to filter matching items
1709
- * @param params.attributes - Whether to return values for bibliographies and periods
1710
- * @param params.attributes.bibliographies - Whether to return values for bibliographies
1711
- * @param params.attributes.periods - Whether to return values for periods
1712
- * @param params.isLimitedToLeafPropertyValues - Whether to limit the property values to leaf property values
1713
- * @param options - Options for the fetch
1714
- * @param options.fetch - The fetch function to use
1715
- * @returns Parsed Set property values and requested attribute values.
1716
- * Returns empty arrays/objects when no matches are found, and null outputs on fetch/parse errors.
1717
- */
1718
- declare function fetchSetPropertyValues(params: {
1719
- setScopeUuids: Array<string>;
1720
- queries?: Query | null;
1721
- attributes?: {
1722
- bibliographies: boolean;
1723
- periods: boolean;
1724
- };
1725
- isLimitedToLeafPropertyValues?: boolean;
1726
- }, options?: {
1727
- fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1728
- }): Promise<{
1729
- propertyValues: Array<PropertyValueQueryItem>;
1730
- propertyValuesByPropertyVariableUuid: Record<string, Array<PropertyValueQueryItem>>;
1731
- attributeValues: {
1732
- bibliographies: Array<SetAttributeValueQueryItem> | null;
1733
- periods: Array<SetAttributeValueQueryItem> | null;
1734
- };
1735
- error: null;
1736
- detailedError: null;
1737
- } | {
1738
- propertyValues: null;
1739
- propertyValuesByPropertyVariableUuid: null;
1740
- attributeValues: null;
1741
- error: string;
1742
- detailedError: string;
1743
- }>;
1744
- //#endregion
1745
- //#region src/fetchers/website.d.ts
1746
- type FetchFunction = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1747
- /**
1748
- * Fetches and parses a website configuration from the OCHRE API
1749
- *
1750
- * @param abbreviation - The abbreviation identifier for the website
1751
- * @returns The parsed website configuration or null if the fetch/parse fails
1752
- */
1753
- declare function fetchWebsite<const T extends LanguageCodes = LanguageCodes>(abbreviation: string, options?: {
1754
- fetch?: FetchFunction;
1755
- languages?: T;
1756
- }): Promise<{
1757
- website: Website<T>;
1758
- error: null;
1759
- detailedError: null;
1760
- } | {
1761
- website: null;
1762
- error: string;
1763
- detailedError: string;
1764
- }>;
1765
- //#endregion
1766
- //#region src/getters.d.ts
1767
- /**
1768
- * Options for property search operations.
1769
- */
1770
- type PropertyOptions = {
1771
- /** Whether to recursively search through nested properties. */includeNestedProperties?: boolean; /** Whether to limit property values to leaf values. */
1772
- limitToLeafPropertyValues?: boolean;
1773
- };
1774
- type PropertyContent<T extends LanguageCodes> = PropertyValueContent<T>["content"];
1775
- type SearchableProperty<T extends LanguageCodes> = PropertyLike<T>;
1776
- /**
1777
- * Finds a property by its variable UUID in an array of properties.
1778
- *
1779
- * @param properties - Array of properties to search through
1780
- * @param variableUuid - The property variable UUID to search for
1781
- * @param options - Search options, including whether to include nested properties
1782
- * @returns The matching Property object, or null if not found
1783
- */
1784
- declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableUuid: string, options?: PropertyOptions): Property<T> | null;
1785
- declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableUuid: string, options?: PropertyOptions): SetItemProperty<T> | null;
1786
- declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableUuid: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
1787
- declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableUuid: string, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
1788
- /**
1789
- * Retrieves all values for a property with the given variable UUID.
1790
- *
1791
- * @param properties - Array of properties to search through
1792
- * @param variableUuid - The property variable UUID to search for
1793
- * @param options - Search options, including whether to include nested properties
1794
- * @returns Array of property values, or null if property not found
1795
- */
1796
- declare function getPropertyValuesByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1797
- /**
1798
- * Retrieves all value contents for a property with the given variable UUID.
1799
- *
1800
- * @param properties - Array of properties to search through
1801
- * @param variableUuid - The property variable UUID to search for
1802
- * @param options - Search options, including whether to include nested properties
1803
- * @returns Array of property value contents, or null if property not found
1804
- */
1805
- declare function getPropertyValueContentsByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
1806
- /**
1807
- * Gets the first value of a property with the given variable UUID.
1808
- *
1809
- * @param properties - Array of properties to search through
1810
- * @param variableUuid - The property variable UUID to search for
1811
- * @param options - Search options, including whether to include nested properties
1812
- * @returns The first property value, or null if property not found
1813
- */
1814
- declare function getPropertyValueByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1815
- /**
1816
- * Gets the first value content of a property with the given variable UUID.
1817
- *
1818
- * @param properties - Array of properties to search through
1819
- * @param variableUuid - The property variable UUID to search for
1820
- * @param options - Search options, including whether to include nested properties
1821
- * @returns The first property value content, or null if property not found
1822
- */
1823
- declare function getPropertyValueContentByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
1824
- /**
1825
- * Finds a property by its variable label in an array of properties.
1826
- *
1827
- * @param properties - Array of properties to search through
1828
- * @param variableLabel - The property variable label to search for
1829
- * @param options - Search options, including whether to include nested properties
1830
- * @returns The matching Property object, or null if not found
1831
- */
1832
- declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, options?: PropertyOptions): Property<T> | null;
1833
- declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, options?: PropertyOptions): SetItemProperty<T> | null;
1834
- declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
1835
- declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
1836
- /**
1837
- * Finds a property by its variable label and all values.
1838
- *
1839
- * @param properties - Array of properties to search through
1840
- * @param variableLabel - The property variable label to search for
1841
- * @param values - The property values to search for
1842
- * @param options - Search options, including whether to include nested properties
1843
- * @returns The matching Property object, or null if not found or all values do not match
1844
- */
1845
- declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): Property<T> | null;
1846
- declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SetItemProperty<T> | null;
1847
- declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
1848
- declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
1849
- /**
1850
- * Finds a property by its variable label and all value contents.
1851
- *
1852
- * @param properties - Array of properties to search through
1853
- * @param variableLabel - The property variable label to search for
1854
- * @param valueContents - The value contents to search for
1855
- * @param options - Search options, including whether to include nested properties
1856
- * @returns The matching Property object, or null if not found or all value contents do not match
1857
- */
1858
- declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): Property<T> | null;
1859
- declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SetItemProperty<T> | null;
1860
- declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
1861
- declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
1862
- /**
1863
- * Finds a property by its variable label and one value.
1864
- *
1865
- * @param properties - Array of properties to search through
1866
- * @param variableLabel - The property variable label to search for
1867
- * @param value - The property value to search for
1868
- * @param options - Search options, including whether to include nested properties
1869
- * @returns The matching Property object, or null if not found or value does not match
1870
- */
1871
- declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
1872
- declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SetItemProperty<T> | null;
1873
- declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
1874
- declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
1875
- /**
1876
- * Finds a property by its variable label and one value content.
1877
- *
1878
- * @param properties - Array of properties to search through
1879
- * @param variableLabel - The property variable label to search for
1880
- * @param valueContent - The value content to search for
1881
- * @param options - Search options, including whether to include nested properties
1882
- * @returns The matching Property object, or null if not found or value content does not match
1883
- */
1884
- declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): Property<T> | null;
1885
- declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SetItemProperty<T> | null;
1886
- declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
1887
- declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
1888
- /**
1889
- * Retrieves all values for a property with the given variable label.
1890
- *
1891
- * @param properties - Array of properties to search through
1892
- * @param variableLabel - The property variable label to search for
1893
- * @param options - Search options, including whether to include nested properties
1894
- * @returns Array of property values, or null if property not found
1895
- */
1896
- declare function getPropertyValuesByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1897
- /**
1898
- * Gets the first value of a property with the given variable label.
1899
- *
1900
- * @param properties - Array of properties to search through
1901
- * @param variableLabel - The property variable label to search for
1902
- * @param options - Search options, including whether to include nested properties
1903
- * @returns The first property value, or null if property not found
1904
- */
1905
- declare function getPropertyValueByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1906
- /**
1907
- * Gets the first value content of a property with the given variable label.
1908
- *
1909
- * @param properties - Array of properties to search through
1910
- * @param variableLabel - The property variable label to search for
1911
- * @param options - Search options, including whether to include nested properties
1912
- * @returns The first property value content, or null if property not found
1913
- */
1914
- declare function getPropertyValueContentByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): PropertyContent<T> | null;
1915
- /**
1916
- * Gets all unique properties from an array of properties.
1917
- *
1918
- * @param properties - Array of properties to get unique properties from
1919
- * @param options - Search options, including whether to include nested properties
1920
- * @returns Array of unique properties
1921
- */
1922
- declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
1923
- declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, options?: PropertyOptions): Array<SetItemProperty<T>>;
1924
- declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, options?: PropertyOptions): Array<SimplifiedProperty<T>>;
1925
- declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, options?: PropertyOptions): Array<SetItemSimplifiedProperty<T>>;
1926
- /**
1927
- * Gets all unique property variable labels from an array of properties.
1928
- *
1929
- * @param properties - Array of properties to get unique property variable labels from
1930
- * @param options - Search options, including whether to include nested properties
1931
- * @returns Array of unique property variable labels
1932
- */
1933
- declare function getUniquePropertyVariableLabels<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, options?: PropertyOptions): Array<string>;
1934
- /**
1935
- * Get the leaf property values from an array of property values.
1936
- *
1937
- * @param propertyValues - The array of property values to get the leaf property values from
1938
- * @returns The array of leaf property values
1939
- */
1940
- declare function getLeafPropertyValues<T extends LanguageCodes = LanguageCodes>(propertyValues: ReadonlyArray<PropertyValueContent<T>>): Array<PropertyValueContent<T>>;
1941
- /**
1942
- * Filters a property based on a variable label and value content criterion.
1943
- *
1944
- * @param property - The property to filter
1945
- * @param filter - Filter criteria containing variable label and value to match
1946
- * @param filter.variableLabel - The variable label to filter by
1947
- * @param filter.value - The value to filter by
1948
- * @param options - Search options, including whether to include nested properties
1949
- * @returns True if the property matches the filter criteria, false otherwise
1950
- */
1951
- declare function filterProperties<T extends LanguageCodes = LanguageCodes>(property: SearchableProperty<T>, filter: {
1952
- variableLabel: string;
1953
- value: PropertyValueContent<T>;
1954
- }, options?: PropertyOptions): boolean;
1955
- //#endregion
1956
- //#region src/helpers.d.ts
1957
- type FlattenedItem<U, T extends LanguageCodes> = Omit<U, "properties"> & {
1958
- properties: Array<SetItemProperty<T>>;
1959
- };
1960
- /**
1961
- * The default page size to use for fetching paginated items
1962
- */
1963
- declare const DEFAULT_PAGE_SIZE = 48;
1964
- /**
1965
- * Flatten the properties of an item
1966
- * @param item - The item whose properties to flatten
1967
- * @returns The item with the properties flattened
1968
- */
1969
- declare function flattenItemProperties<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes, W extends ItemPayloadKind = "topLevel">(item: Item<U, V, T, W>): FlattenedItem<Item<U, V, T, W>, T>;
1970
- //#endregion
1971
- export { AccordionWebBlock, AnyBibliography, AnyConcept, AnyItem, AnyPeriod, AnyPerson, AnyPropertyValue, AnyPropertyVariable, AnyResource, AnySet, AnySpatialUnit, AnyText, AnyTree, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, ContainedItemCategory, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Context, ContextItem, ContextItemCategory, ContextNode, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Coordinates, CoordinatesSource, DEFAULT_PAGE_SIZE, DictionaryUnitItemLink, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyLike, PropertyOptions, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Scope, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Style, StylesheetCategory, StylesheetItem, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink, WebBlock, WebBlockByLayout, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels, withLanguages };
1
+ import { MultilingualOptions, MultilingualString, MultilingualStringEntries, MultilingualStringEntry, MultilingualStringInput, MultilingualStringJSON, MultilingualStringObject, MultilingualStringText } from "./parsers/multilingual.mjs";
2
+ import { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Scope, Style, StylesheetCategory, StylesheetItem, WebBlock, WebBlockByLayout, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType } from "./types/website.mjs";
3
+ import { AnyBibliography, AnyConcept, AnyItem, AnyPeriod, AnyPerson, AnyPropertyValue, AnyPropertyVariable, AnyResource, AnySet, AnySpatialUnit, AnyText, AnyTree, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, ContainedItemCategory, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Context, ContextItem, ContextItemCategory, ContextNode, Coordinates, CoordinatesSource, DictionaryUnitItemLink, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, Metadata, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyLike, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink } from "./types/index.mjs";
4
+ import { fetchGallery } from "./fetchers/gallery.mjs";
5
+ import { fetchItemLinks } from "./fetchers/item-links.mjs";
6
+ import { defineLanguages, fetchItem, withLanguages } from "./fetchers/item.mjs";
7
+ import { fetchSetItems } from "./fetchers/set/items.mjs";
8
+ import { fetchSetPropertyValues } from "./fetchers/set/property-values.mjs";
9
+ import { fetchWebsite } from "./fetchers/website.mjs";
10
+ import { PropertyOptions, filterProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels } from "./getters.mjs";
11
+ import { DEFAULT_PAGE_SIZE, flattenItemProperties } from "./helpers.mjs";
12
+ export { type AccordionWebBlock, type AnyBibliography, type AnyConcept, type AnyItem, type AnyPeriod, type AnyPerson, type AnyPropertyValue, type AnyPropertyVariable, type AnyResource, type AnySet, type AnySpatialUnit, type AnyText, type AnyTree, type BaseItem, type BaseItemLink, type BelongsTo, type Bibliography, type BibliographyEntryInfo, type BibliographyItemLink, type BibliographySourceDocument, type Concept, type ConceptItemLink, type ContainedItemCategory, type ContainedItemCategoryFromOption, type ContainedItemCategoryOption, type Context, type ContextItem, type ContextItemCategory, type ContextNode, type ContextTree, type ContextTreeFilterLevel, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type EmbeddedBibliography, type EmbeddedConcept, type EmbeddedItem, type EmbeddedPeriod, type EmbeddedPerson, type EmbeddedPropertyValue, type EmbeddedPropertyVariable, type EmbeddedResource, type EmbeddedSet, type EmbeddedSpatialUnit, type EmbeddedText, type EmbeddedTree, type Event, type Gallery, type Heading, type HeadingItemCategory, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type Item, type ItemCategory, type ItemContainerCategory, type ItemLink, type ItemLinkCategory, type ItemLinks, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, type Observation, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Property, type PropertyLike, PropertyOptions, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type Scope, type Section, type Set, type SetAttributeValueQueryItem, type SetBibliography, type SetConcept, type SetItem, type SetItemCategory, type SetItemLink, type SetItemProperty, type SetItemSimplifiedProperty, type SetItemsSort, type SetItemsSortDirection, type SetPeriod, type SetResource, type SetSpatialUnit, type SetTree, type SimplifiedProperty, type SpatialUnit, type SpatialUnitItemLink, type Style, type StylesheetCategory, type StylesheetItem, type Text, type TextItemLink, type TopLevelItem, type Tree, type TreeItemCategory, type TreeItemLink, type WebBlock, type WebBlockByLayout, type WebBlockLayout, type WebElement, type WebElementComponent, type WebElementComponentName, type WebElementComponentOf, type WebElementOf, type WebImage, type WebTitle, type Webpage, type Website, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels, withLanguages };