@digitalculture/ochre-sdk 0.11.20 → 0.11.21

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 (3) hide show
  1. package/dist/index.d.ts +1185 -0
  2. package/dist/index.js +3119 -0
  3. package/package.json +1 -1
@@ -0,0 +1,1185 @@
1
+ //#region src/types/main.d.ts
2
+ /**
3
+ * Represents the core data structure containing item information and metadata
4
+ */
5
+ type Data<T extends DataCategory, U extends DataCategory> = {
6
+ uuid: string;
7
+ belongsTo: {
8
+ uuid: string;
9
+ abbreviation: string;
10
+ };
11
+ publicationDateTime: Date;
12
+ metadata: Metadata;
13
+ item: Tree<T, U> | Set<T> | Resource | SpatialUnit | Concept | Period | Bibliography | Person | PropertyValue;
14
+ };
15
+ type DataCategory = "tree" | "set" | "resource" | "spatialUnit" | "concept" | "period" | "bibliography" | "person" | "propertyValue";
16
+ /**
17
+ * Basic identification information used across multiple types
18
+ */
19
+ type Identification = {
20
+ label: string;
21
+ abbreviation: string;
22
+ code: string | null;
23
+ };
24
+ /**
25
+ * Metadata information for items including project, publisher and language details
26
+ */
27
+ type Metadata = {
28
+ project: {
29
+ identification: Identification & {
30
+ website: string | null;
31
+ };
32
+ } | null;
33
+ item: {
34
+ identification: Identification;
35
+ category: string;
36
+ type: string;
37
+ maxLength: number | null;
38
+ } | null;
39
+ dataset: string;
40
+ publisher: string;
41
+ languages: Array<string>;
42
+ identifier: string;
43
+ description: string;
44
+ };
45
+ /**
46
+ * Represents a single item in a context hierarchy with its metadata
47
+ */
48
+ type ContextItem = {
49
+ uuid: string;
50
+ publicationDateTime: Date | null;
51
+ number: number;
52
+ content: string;
53
+ };
54
+ /**
55
+ * Represents a node in the context tree containing tree, project and spatial unit information
56
+ */
57
+ type ContextNode = {
58
+ tree: ContextItem;
59
+ project: ContextItem;
60
+ spatialUnit: Array<ContextItem>;
61
+ };
62
+ /**
63
+ * Contains the full context information including nodes and display path
64
+ */
65
+ type Context = {
66
+ nodes: Array<ContextNode>;
67
+ displayPath: string;
68
+ };
69
+ /**
70
+ * License information for content items
71
+ */
72
+ type License = {
73
+ content: string;
74
+ url: string;
75
+ };
76
+ /**
77
+ * Represents a person (author, creator, etc.) with their identification and metadata
78
+ */
79
+ type Person = {
80
+ uuid: string;
81
+ category: "person";
82
+ publicationDateTime: Date | null;
83
+ type: string | null;
84
+ number: number | null;
85
+ context: Context | null;
86
+ availability: License | null;
87
+ date: string | null;
88
+ identification: Identification | null;
89
+ image: Image | null;
90
+ address: {
91
+ country: string | null;
92
+ city: string | null;
93
+ state: string | null;
94
+ } | null;
95
+ description: string | null;
96
+ coordinates: Coordinates;
97
+ content: string | null;
98
+ notes: Array<Note>;
99
+ events: Array<Event>;
100
+ properties: Array<Property>;
101
+ bibliographies: Array<Bibliography>;
102
+ };
103
+ /**
104
+ * Represents a note with number, title and content
105
+ */
106
+ type Note = {
107
+ number: number;
108
+ title: string | null;
109
+ date: string | null;
110
+ authors: Array<Person>;
111
+ content: string;
112
+ };
113
+ /**
114
+ * Represents an image with its metadata and content
115
+ */
116
+ type Image = {
117
+ publicationDateTime: Date | null;
118
+ identification: Identification | null;
119
+ url: string | null;
120
+ htmlPrefix: string | null;
121
+ content: string | null;
122
+ widthPreview: number | null;
123
+ heightPreview: number | null;
124
+ width: number | null;
125
+ height: number | null;
126
+ };
127
+ /**
128
+ * Represents a link to another item with optional image and bibliographic references
129
+ */
130
+ type Link = {
131
+ uuid: string | null;
132
+ publicationDateTime: Date | null;
133
+ type: string | null;
134
+ category: string | null;
135
+ identification: Identification | null;
136
+ description: string | null;
137
+ content: string | null;
138
+ href: string | null;
139
+ fileFormat: string | null;
140
+ fileSize: number | null;
141
+ image: {
142
+ isInline: boolean;
143
+ isPrimary: boolean;
144
+ heightPreview: number;
145
+ widthPreview: number;
146
+ height: number;
147
+ width: number;
148
+ } | null;
149
+ bibliographies: Array<Bibliography> | null;
150
+ };
151
+ /**
152
+ * Represents a clickable/interactive area on an image map
153
+ */
154
+ type ImageMapArea = {
155
+ uuid: string;
156
+ publicationDateTime: Date | null;
157
+ type: string;
158
+ title: string;
159
+ shape: "rectangle" | "circle" | "polygon";
160
+ coords: Array<number>;
161
+ slug: string | null;
162
+ };
163
+ /**
164
+ * Contains image map areas and dimensions
165
+ */
166
+ type ImageMap = {
167
+ area: Array<ImageMapArea>;
168
+ width: number;
169
+ height: number;
170
+ };
171
+ /**
172
+ * Geographic coordinates item with optional type and label
173
+ */
174
+ type CoordinatesItem = {
175
+ type: "point";
176
+ latitude: number;
177
+ longitude: number;
178
+ altitude: number | null;
179
+ source: {
180
+ context: "self";
181
+ uuid: string;
182
+ label: string;
183
+ } | {
184
+ context: "related";
185
+ uuid: string;
186
+ label: string;
187
+ value: string;
188
+ } | {
189
+ context: "inherited";
190
+ item: {
191
+ uuid: string;
192
+ label: string;
193
+ };
194
+ uuid: string;
195
+ label: string;
196
+ } | null;
197
+ } | {
198
+ type: "plane";
199
+ minimum: {
200
+ latitude: number;
201
+ longitude: number;
202
+ };
203
+ maximum: {
204
+ latitude: number;
205
+ longitude: number;
206
+ };
207
+ source: {
208
+ context: "self";
209
+ uuid: string;
210
+ label: string;
211
+ } | {
212
+ context: "related";
213
+ uuid: string;
214
+ label: string;
215
+ value: string;
216
+ } | {
217
+ context: "inherited";
218
+ item: {
219
+ uuid: string;
220
+ label: string;
221
+ };
222
+ uuid: string;
223
+ label: string;
224
+ } | null;
225
+ };
226
+ /**
227
+ * Geographic coordinates with optional type and label
228
+ */
229
+ type Coordinates = Array<CoordinatesItem>;
230
+ /**
231
+ * Represents an observation with notes, links and properties
232
+ */
233
+ type Observation = {
234
+ number: number;
235
+ date: string | null;
236
+ observers: Array<string> | Array<Person>;
237
+ notes: Array<Note>;
238
+ links: Array<Link>;
239
+ properties: Array<Property>;
240
+ bibliographies: Array<Bibliography>;
241
+ };
242
+ /**
243
+ * Represents an event with date, label and optional agent
244
+ */
245
+ type Event = {
246
+ date: Date | null;
247
+ label: string;
248
+ agent: {
249
+ uuid: string;
250
+ content: string;
251
+ } | null;
252
+ location: {
253
+ uuid: string;
254
+ content: string;
255
+ } | null;
256
+ comment: string | null;
257
+ value: string | null;
258
+ };
259
+ /**
260
+ * Represents an interpretation with date and properties
261
+ */
262
+ type Interpretation = {
263
+ date: string | null;
264
+ number: number;
265
+ properties: Array<Property>;
266
+ bibliographies: Array<Bibliography>;
267
+ };
268
+ /**
269
+ * Represents a resource item with associated metadata, content and relationships
270
+ */
271
+ type Resource = {
272
+ uuid: string;
273
+ category: "resource";
274
+ publicationDateTime: Date | null;
275
+ type: string;
276
+ number: number;
277
+ context: Context | null;
278
+ license: License | null;
279
+ copyright: string | null;
280
+ watermark: string | null;
281
+ identification: Identification;
282
+ date: string | null;
283
+ image: Image | null;
284
+ creators: Array<Person>;
285
+ notes: Array<Note>;
286
+ description: string;
287
+ coordinates: Coordinates;
288
+ document: string | null;
289
+ href: string | null;
290
+ fileFormat: string | null;
291
+ fileSize: number | null;
292
+ imageMap: ImageMap | null;
293
+ periods: Array<Period>;
294
+ links: Array<Link>;
295
+ reverseLinks: Array<Link>;
296
+ properties: Array<Property>;
297
+ bibliographies: Array<Bibliography>;
298
+ resources: Array<Resource>;
299
+ };
300
+ /**
301
+ * Represents a spatial unit with geographic coordinates and observations
302
+ */
303
+ type SpatialUnit = {
304
+ uuid: string;
305
+ category: "spatialUnit";
306
+ publicationDateTime: Date | null;
307
+ number: number;
308
+ context: Context | null;
309
+ license: License | null;
310
+ identification: Identification;
311
+ image: Image | null;
312
+ description: string | null;
313
+ coordinates: Coordinates;
314
+ mapData: {
315
+ geoJSON: {
316
+ multiPolygon: string;
317
+ EPSG: number;
318
+ };
319
+ } | null;
320
+ observations: Array<Observation>;
321
+ events: Array<Event>;
322
+ properties: Array<Property>;
323
+ bibliographies: Array<Bibliography>;
324
+ };
325
+ /**
326
+ * Represents a concept with associated interpretations
327
+ */
328
+ type Concept = {
329
+ uuid: string;
330
+ category: "concept";
331
+ publicationDateTime: Date | null;
332
+ number: number;
333
+ license: License | null;
334
+ context: Context | null;
335
+ identification: Identification;
336
+ image: Image | null;
337
+ description: string | null;
338
+ interpretations: Array<Interpretation>;
339
+ properties: Array<Property>;
340
+ bibliographies: Array<Bibliography>;
341
+ };
342
+ /**
343
+ * Represents a set that can contain resources, spatial units and concepts
344
+ */
345
+ type Set<T extends DataCategory> = {
346
+ uuid: string;
347
+ category: "set";
348
+ itemCategory: T;
349
+ publicationDateTime: Date | null;
350
+ type: string;
351
+ number: number;
352
+ date: string | null;
353
+ license: License | null;
354
+ identification: Identification;
355
+ isSuppressingBlanks: boolean;
356
+ description: string;
357
+ creators: Array<Person>;
358
+ items: T extends "resource" ? Array<Resource> : T extends "spatialUnit" ? Array<SpatialUnit> : T extends "concept" ? Array<Concept> : T extends "period" ? Array<Period> : T extends "bibliography" ? Array<Bibliography> : T extends "person" ? Array<Person> : T extends "propertyValue" ? Array<PropertyValue> : never;
359
+ };
360
+ /**
361
+ * Represents a bibliography entry with citation and publication information
362
+ */
363
+ type Bibliography = {
364
+ uuid: string | null;
365
+ zoteroId: string | null;
366
+ category: "bibliography";
367
+ publicationDateTime: Date | null;
368
+ type: string | null;
369
+ number: number | null;
370
+ identification: Identification | null;
371
+ projectIdentification: Identification | null;
372
+ context: Context | null;
373
+ citation: {
374
+ details: string | null;
375
+ format: string | null;
376
+ short: string | null;
377
+ long: string | null;
378
+ };
379
+ publicationInfo: {
380
+ publishers: Array<Person>;
381
+ startDate: Date | null;
382
+ };
383
+ entryInfo: {
384
+ startIssue: string;
385
+ startVolume: string;
386
+ } | null;
387
+ source: {
388
+ resource: Pick<Resource, "uuid" | "publicationDateTime" | "type" | "identification"> | null;
389
+ documentUrl: string | null;
390
+ };
391
+ periods: Array<Period>;
392
+ authors: Array<Person>;
393
+ properties: Array<Property>;
394
+ };
395
+ /**
396
+ * Represents a time period with identification
397
+ */
398
+ type Period = {
399
+ uuid: string;
400
+ category: "period";
401
+ publicationDateTime: Date | null;
402
+ type: string | null;
403
+ number: number | null;
404
+ identification: Identification;
405
+ description: string | null;
406
+ };
407
+ /**
408
+ * Represents a property value with type information
409
+ */
410
+ type PropertyValue = {
411
+ uuid: string;
412
+ category: "propertyValue";
413
+ number: number;
414
+ publicationDateTime: Date | null;
415
+ context: Context | null;
416
+ availability: License | null;
417
+ identification: Identification;
418
+ date: string | null;
419
+ creators: Array<Person>;
420
+ description: string;
421
+ notes: Array<Note>;
422
+ links: Array<Link>;
423
+ };
424
+ type PropertyValueContentType = "string" | "integer" | "decimal" | "boolean" | "date" | "dateTime" | "time" | "coordinate" | "IDREF";
425
+ /**
426
+ * Represents a property value with type information
427
+ */
428
+ type PropertyValueContent<T extends PropertyValueContentType> = {
429
+ content: (T extends "integer" ? number : T extends "decimal" ? number : T extends "time" ? number : T extends "boolean" ? boolean : string) | null;
430
+ dataType: T;
431
+ label: string | null;
432
+ isUncertain: boolean;
433
+ unit: string | null;
434
+ category: string | null;
435
+ type: string | null;
436
+ uuid: string | null;
437
+ publicationDateTime: Date | null;
438
+ href: string | null;
439
+ slug: string | null;
440
+ };
441
+ /**
442
+ * Represents a property with label, values and nested properties
443
+ */
444
+ type Property<T extends PropertyValueContentType = PropertyValueContentType> = {
445
+ uuid: string;
446
+ label: string;
447
+ values: Array<PropertyValueContent<T>>;
448
+ comment: string | null;
449
+ properties: Array<Property>;
450
+ };
451
+ /**
452
+ * Represents a tree structure containing resources, spatial units and concepts
453
+ */
454
+ type Tree<T extends DataCategory, U extends DataCategory> = {
455
+ uuid: string;
456
+ category: "tree";
457
+ publicationDateTime: Date | null;
458
+ type: string;
459
+ number: number;
460
+ date: string | null;
461
+ license: License | null;
462
+ identification: Identification;
463
+ creators: Array<Person>;
464
+ properties: Array<Property>;
465
+ items: T extends "resource" ? Array<Resource> : T extends "spatialUnit" ? Array<SpatialUnit> : T extends "concept" ? Array<Concept> : T extends "period" ? Array<Period> : T extends "bibliography" ? Array<Bibliography> : T extends "person" ? Array<Person> : T extends "propertyValue" ? Array<PropertyValue> : T extends "set" ? Array<Set<U>> : never;
466
+ };
467
+ /**
468
+ * Represents a gallery with its identification, project identification, resources and max length
469
+ */
470
+ type Gallery = {
471
+ identification: Identification;
472
+ projectIdentification: Identification;
473
+ resources: Array<Resource>;
474
+ maxLength: number;
475
+ };
476
+ /**
477
+ * Represents a property query item with its item and value UUIDs
478
+ */
479
+ type PropertyQueryItem = {
480
+ value: {
481
+ uuid: string | null;
482
+ category: string | null;
483
+ type: string | null;
484
+ dataType: string;
485
+ publicationDateTime: string | null;
486
+ content: string;
487
+ label: string | null;
488
+ };
489
+ resultUuids: Array<string>;
490
+ };
491
+ /**
492
+ * Represents a metadata object given a UUID
493
+ */
494
+ type UuidMetadata = {
495
+ item: {
496
+ uuid: string;
497
+ name: string;
498
+ type: string;
499
+ };
500
+ project: {
501
+ name: string;
502
+ website: string | null;
503
+ };
504
+ } | null;
505
+ /**
506
+ * Represents a level context item with a variable and value
507
+ */
508
+ type LevelContextItem = {
509
+ variableUuid: string;
510
+ valueUuid: string | null;
511
+ };
512
+ /**
513
+ * Represents a level context with a context item
514
+ */
515
+ type LevelContext = {
516
+ context: Array<LevelContextItem>;
517
+ identification: Identification;
518
+ type: string;
519
+ };
520
+ /**
521
+ * Represents a website with its properties and elements
522
+ */
523
+ type Website = {
524
+ uuid: string;
525
+ publicationDateTime: Date | null;
526
+ identification: Identification;
527
+ project: {
528
+ name: string;
529
+ website: string | null;
530
+ };
531
+ creators: Array<Person>;
532
+ license: License | null;
533
+ pages: Array<Webpage>;
534
+ sidebar: {
535
+ elements: Array<WebElement>;
536
+ title: WebElement["title"];
537
+ layout: "start" | "end";
538
+ mobileLayout: "default" | "inline";
539
+ cssStyles: {
540
+ default: Array<Style>;
541
+ tablet: Array<Style>;
542
+ mobile: Array<Style>;
543
+ };
544
+ } | null;
545
+ properties: WebsiteProperties;
546
+ searchOptions: {
547
+ filters: Array<{
548
+ uuid: string;
549
+ type: string;
550
+ }>;
551
+ attributeFilters: {
552
+ bibliographies: boolean;
553
+ periods: boolean;
554
+ };
555
+ scopes: Array<{
556
+ uuid: string;
557
+ type: string;
558
+ identification: Identification;
559
+ }>;
560
+ };
561
+ globalOptions: {
562
+ contexts: {
563
+ flatten: Array<LevelContext>;
564
+ suppress: Array<LevelContext>;
565
+ filter: Array<LevelContext>;
566
+ sort: Array<LevelContext>;
567
+ detail: Array<LevelContext>;
568
+ download: Array<LevelContext>;
569
+ label: Array<LevelContext>;
570
+ prominent: Array<LevelContext>;
571
+ };
572
+ };
573
+ };
574
+ /**
575
+ * Properties for configuring website display and styling
576
+ */
577
+ type WebsiteProperties = {
578
+ type: "traditional" | "digital-collection" | "plum" | "cedar" | "elm" | "maple" | "oak" | "palm";
579
+ privacy: "public" | "password" | "private";
580
+ status: "development" | "preview" | "production";
581
+ contact: {
582
+ name: string;
583
+ email: string | null;
584
+ } | null;
585
+ isHeaderDisplayed: boolean;
586
+ headerVariant: "default" | "floating" | "inline";
587
+ headerAlignment: "start" | "center" | "end";
588
+ isHeaderProjectDisplayed: boolean;
589
+ isFooterDisplayed: boolean;
590
+ isSidebarDisplayed: boolean;
591
+ iiifViewer: "universal-viewer" | "clover";
592
+ supportsThemeToggle: boolean;
593
+ defaultTheme: "light" | "dark" | null;
594
+ logoUrl: string | null;
595
+ };
596
+ type Webpage = {
597
+ title: string;
598
+ slug: string;
599
+ properties: WebpageProperties;
600
+ items: Array<WebElement | WebBlock>;
601
+ webpages: Array<Webpage>;
602
+ };
603
+ /**
604
+ * Properties for configuring webpage display and styling
605
+ */
606
+ type WebpageProperties = {
607
+ displayedInHeader: boolean;
608
+ width: "full" | "large" | "narrow" | "default";
609
+ variant: "default" | "no-background";
610
+ backgroundImageUrl: string | null;
611
+ isBreadcrumbsDisplayed: boolean;
612
+ isSidebarDisplayed: boolean;
613
+ cssStyles: {
614
+ default: Array<Style>;
615
+ tablet: Array<Style>;
616
+ mobile: Array<Style>;
617
+ };
618
+ };
619
+ type WebTitle = {
620
+ label: string;
621
+ variant: "default" | "simple";
622
+ properties: {
623
+ isNameDisplayed: boolean;
624
+ isDescriptionDisplayed: boolean;
625
+ isDateDisplayed: boolean;
626
+ isCreatorsDisplayed: boolean;
627
+ isCountDisplayed: boolean;
628
+ };
629
+ };
630
+ /**
631
+ * Base properties for web elements
632
+ */
633
+ type WebElement = {
634
+ uuid: string;
635
+ type: "element";
636
+ title: WebTitle;
637
+ cssStyles: {
638
+ default: Array<Style>;
639
+ tablet: Array<Style>;
640
+ mobile: Array<Style>;
641
+ };
642
+ } & WebElementComponent;
643
+ /**
644
+ * Union type of all possible web element components
645
+ */
646
+ type WebElementComponent = {
647
+ component: "annotated-document";
648
+ documentId: string;
649
+ } | {
650
+ component: "annotated-image";
651
+ imageUuid: string;
652
+ isFilterDisplayed: boolean;
653
+ isOptionsDisplayed: boolean;
654
+ isAnnotationHighlightsDisplayed: boolean;
655
+ isAnnotationTooltipsDisplayed: boolean;
656
+ } | {
657
+ component: "audio-player";
658
+ audioId: string;
659
+ isSpeedControlsDisplayed: boolean;
660
+ isVolumeControlsDisplayed: boolean;
661
+ isSeekBarDisplayed: boolean;
662
+ } | {
663
+ component: "bibliography";
664
+ itemUuids: Array<string>;
665
+ bibliographies: Array<Bibliography>;
666
+ layout: "long" | "short";
667
+ isSourceDocumentDisplayed: boolean;
668
+ } | {
669
+ component: "entries";
670
+ entriesId: string;
671
+ variant: "entry" | "item";
672
+ isFilterDisplayed: boolean;
673
+ } | {
674
+ component: "button";
675
+ variant: "default" | "transparent" | "link";
676
+ href: string;
677
+ isExternal: boolean;
678
+ label: string;
679
+ startIcon: string | null;
680
+ endIcon: string | null;
681
+ image: WebImage | null;
682
+ } | {
683
+ component: "collection";
684
+ collectionId: string;
685
+ variant: "full" | "highlights";
686
+ itemVariant: "detailed" | "card" | "tile";
687
+ paginationVariant: "default" | "numeric";
688
+ isSortDisplayed: boolean;
689
+ isFilterDisplayed: boolean;
690
+ filterSort: "default" | "alphabetical";
691
+ layout: "image-top" | "image-bottom" | "image-start" | "image-end";
692
+ } | {
693
+ component: "empty-space";
694
+ height: string | null;
695
+ width: string | null;
696
+ } | {
697
+ component: "iframe";
698
+ href: string;
699
+ height: string | null;
700
+ width: string | null;
701
+ } | {
702
+ component: "iiif-viewer";
703
+ iiifId: string;
704
+ variant: "universal-viewer" | "clover";
705
+ } | {
706
+ component: "image";
707
+ images: Array<WebImage>;
708
+ variant: "default" | "carousel" | "grid" | "hero";
709
+ width: number | null;
710
+ height: number | null;
711
+ isFullWidth: boolean;
712
+ isFullHeight: boolean;
713
+ imageQuality: "high" | "low";
714
+ captionSource: "name" | "abbreviation" | "description";
715
+ captionLayout: "top" | "bottom" | "inset" | "suppress";
716
+ altTextSource: "name" | "abbreviation" | "description";
717
+ isTransparentBackground: boolean;
718
+ isCover: boolean;
719
+ carouselOptions: {
720
+ secondsPerImage: number;
721
+ } | null;
722
+ heroOptions: {
723
+ isBackgroundImageDisplayed: boolean;
724
+ isDocumentDisplayed: boolean;
725
+ isLinkDisplayed: boolean;
726
+ } | null;
727
+ } | {
728
+ component: "image-gallery";
729
+ galleryId: string;
730
+ isFilterDisplayed: boolean;
731
+ } | {
732
+ component: "map";
733
+ mapId: string;
734
+ customBasemap: string | null;
735
+ isControlsDisplayed: boolean;
736
+ isInteractive: boolean;
737
+ isClustered: boolean;
738
+ isUsingPins: boolean;
739
+ isFullHeight: boolean;
740
+ } | {
741
+ component: "network-graph";
742
+ } | {
743
+ component: "query";
744
+ queries: Array<{
745
+ label: string;
746
+ propertyUuids: Array<string>;
747
+ startIcon: string | null;
748
+ endIcon: string | null;
749
+ }>;
750
+ } | {
751
+ component: "search-bar";
752
+ variant: "default" | "full";
753
+ placeholder: string | null;
754
+ baseQuery: string | null;
755
+ } | {
756
+ component: "table";
757
+ tableId: string;
758
+ } | {
759
+ component: "text";
760
+ variant: {
761
+ name: "title" | "block" | "banner";
762
+ } | {
763
+ name: "paragraph";
764
+ size: "xs" | "sm" | "md" | "lg";
765
+ } | {
766
+ name: "label";
767
+ size: "xs" | "sm" | "md" | "lg" | "xl";
768
+ } | {
769
+ name: "heading";
770
+ size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
771
+ } | {
772
+ name: "display";
773
+ size: "xs" | "sm" | "md" | "lg";
774
+ };
775
+ content: string;
776
+ } | {
777
+ component: "timeline";
778
+ timelineId: string;
779
+ } | {
780
+ component: "video";
781
+ isChaptersDislayed: boolean;
782
+ };
783
+ /**
784
+ * Represents an image used in web elements
785
+ */
786
+ type WebImage = {
787
+ url: string;
788
+ label: string | null;
789
+ description: string | null;
790
+ width: number;
791
+ height: number;
792
+ };
793
+ /**
794
+ * Represents a CSS style with label and value
795
+ */
796
+ type Style = {
797
+ label: string;
798
+ value: string;
799
+ };
800
+ type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "horizontal-flex" | "accordion";
801
+ /**
802
+ * Represents a block of vertical or horizontal content alignment
803
+ */
804
+ type WebBlock<T extends WebBlockLayout = WebBlockLayout> = {
805
+ uuid: string;
806
+ type: "block";
807
+ title: WebTitle;
808
+ items: T extends "accordion" ? Array<Extract<WebElement, {
809
+ component: "text";
810
+ }> & {
811
+ items: Array<WebElement | WebBlock>;
812
+ }> : Array<WebElement | WebBlock>;
813
+ properties: {
814
+ default: {
815
+ layout: T;
816
+ /**
817
+ * valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
818
+ */
819
+ spacing: string | undefined;
820
+ /**
821
+ * `gap` CSS property value
822
+ */
823
+ gap: string | undefined;
824
+ /**
825
+ * `align-items` CSS property value
826
+ */
827
+ alignItems: "stretch" | "start" | "center" | "end" | "space-between";
828
+ /**
829
+ * `justify-content` CSS property value
830
+ */
831
+ justifyContent: "stretch" | "start" | "center" | "end" | "space-between";
832
+ isAccordionEnabled: T extends "accordion" ? boolean : never;
833
+ isAccordionExpandedByDefault: T extends "accordion" ? boolean : never;
834
+ isAccordionSidebarDisplayed: T extends "accordion" ? boolean : never;
835
+ };
836
+ tablet: Partial<WebBlock["properties"]["default"]> | null;
837
+ mobile: Partial<WebBlock["properties"]["default"]> | null;
838
+ };
839
+ cssStyles: {
840
+ default: Array<Style>;
841
+ tablet: Array<Style>;
842
+ mobile: Array<Style>;
843
+ };
844
+ };
845
+ //#endregion
846
+ //#region src/utils/fetchers/gallery.d.ts
847
+ /**
848
+ * Fetches and parses a gallery from the OCHRE API
849
+ *
850
+ * @param uuid - The UUID of the gallery
851
+ * @param filter - The filter to apply to the gallery
852
+ * @param page - The page number to fetch
853
+ * @param perPage - The number of items per page
854
+ * @returns The parsed gallery or null if the fetch/parse fails
855
+ *
856
+ * @example
857
+ * ```ts
858
+ * const gallery = await fetchGallery("9c4da06b-f15e-40af-a747-0933eaf3587e", "1978", 1, 12);
859
+ * if (gallery === null) {
860
+ * console.error("Failed to fetch gallery");
861
+ * return;
862
+ * }
863
+ * console.log(`Fetched gallery: ${gallery.identification.label}`);
864
+ * console.log(`Contains ${gallery.resources.length.toLocaleString()} resources`);
865
+ * ```
866
+ *
867
+ * @remarks
868
+ * The returned gallery includes:
869
+ * - Gallery metadata and identification
870
+ * - Project identification
871
+ * - Resources (gallery items)
872
+ */
873
+ declare function fetchGallery(uuid: string, filter: string, page: number, perPage: number, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
874
+ item: Gallery | null;
875
+ error: null;
876
+ } | {
877
+ item: null;
878
+ error: string;
879
+ }>;
880
+ //#endregion
881
+ //#region src/utils/fetchers/item.d.ts
882
+ /**
883
+ * Fetches and parses an OCHRE item from the OCHRE API
884
+ *
885
+ * @param uuid - The UUID of the OCHRE item to fetch
886
+ * @returns Object containing the parsed OCHRE item and its metadata, or null if the fetch/parse fails
887
+ *
888
+ * @example
889
+ * ```ts
890
+ * const result = await fetchItem("123e4567-e89b-12d3-a456-426614174000");
891
+ * if (result === null) {
892
+ * console.error("Failed to fetch OCHRE item");
893
+ * return;
894
+ * }
895
+ * const { metadata, belongsTo, item, category } = result;
896
+ * console.log(`Fetched OCHRE item: ${item.identification.label} with category ${category}`);
897
+ * ```
898
+ *
899
+ * Or, if you want to fetch a specific category, you can do so by passing the category as an argument:
900
+ * ```ts
901
+ * const result = await fetchItem("123e4567-e89b-12d3-a456-426614174000", "resource");
902
+ * const { metadata, belongsTo, item, category } = result;
903
+ * console.log(item.category); // "resource"
904
+ * ```
905
+ *
906
+ * @remarks
907
+ * The returned OCHRE item includes:
908
+ * - Item metadata
909
+ * - Item belongsTo information
910
+ * - Item content
911
+ * - Item category
912
+ *
913
+ * If the fetch/parse fails, the returned object will have an `error` property.
914
+ */
915
+ declare function fetchItem<T extends DataCategory, U extends DataCategory>(uuid: string, category?: T, setCategory?: T extends "set" ? U : never, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
916
+ error: null;
917
+ metadata: Metadata;
918
+ belongsTo: {
919
+ uuid: string;
920
+ abbreviation: string;
921
+ };
922
+ item: T extends "resource" ? Resource : T extends "spatialUnit" ? SpatialUnit : T extends "concept" ? Concept : T extends "period" ? Period : T extends "bibliography" ? Bibliography : T extends "person" ? Person : T extends "propertyValue" ? PropertyValue : T extends "set" ? Set<U> : T extends "tree" ? Tree<T, U> : never;
923
+ category: T;
924
+ } | {
925
+ error: string;
926
+ metadata: never;
927
+ belongsTo: never;
928
+ item: never;
929
+ category: never;
930
+ }>;
931
+ //#endregion
932
+ //#region src/utils/fetchers/property-query.d.ts
933
+ /**
934
+ * Fetches and parses a property query from the OCHRE API
935
+ *
936
+ * @param scopeUuids - The scope UUIDs to filter by
937
+ * @param propertyUuids - The property UUIDs to query by
938
+ * @param customFetch - A custom fetch function to use instead of the default fetch
939
+ * @returns The parsed property query or null if the fetch/parse fails
940
+ *
941
+ * @example
942
+ * ```ts
943
+ * const propertyQuery = await fetchPropertyQuery(["0c0aae37-7246-495b-9547-e25dbf5b99a3"], ["9c4da06b-f15e-40af-a747-0933eaf3587e"]);
944
+ * if (propertyQuery === null) {
945
+ * console.error("Failed to fetch property query");
946
+ * return;
947
+ * }
948
+ * console.log(`Fetched property query: ${propertyQuery.item}`);
949
+ * ```
950
+ *
951
+ * @remarks
952
+ * The returned property query includes:
953
+ * - Property items
954
+ */
955
+ declare function fetchPropertyQuery(scopeUuids: Array<string>, propertyUuids: Array<string>, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
956
+ items: Array<PropertyQueryItem> | null;
957
+ error: null;
958
+ } | {
959
+ items: null;
960
+ error: string;
961
+ }>;
962
+ //#endregion
963
+ //#region src/utils/fetchers/uuid-metadata.d.ts
964
+ /**
965
+ * Fetches raw OCHRE metadata by UUID from the OCHRE API
966
+ *
967
+ * @param uuid - The UUID of the OCHRE item to fetch
968
+ * @returns An object containing the OCHRE metadata or an error message
969
+ *
970
+ * @example
971
+ * ```ts
972
+ * const { item, error } = await fetchByUuidMetadata("123e4567-e89b-12d3-a456-426614174000");
973
+ * if (error !== null) {
974
+ * console.error(`Failed to fetch: ${error}`);
975
+ * return;
976
+ * }
977
+ * // Process data...
978
+ * ```
979
+ */
980
+ declare function fetchByUuidMetadata(uuid: string, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
981
+ item: UuidMetadata | null;
982
+ error: string | null;
983
+ }>;
984
+ //#endregion
985
+ //#region src/utils/fetchers/website.d.ts
986
+ /**
987
+ * Fetches and parses a website configuration from the OCHRE API
988
+ *
989
+ * @param abbreviation - The abbreviation identifier for the website
990
+ * @returns The parsed website configuration or null if the fetch/parse fails
991
+ *
992
+ * @example
993
+ * ```ts
994
+ * const website = await fetchWebsite("guerrilla-television");
995
+ * if (website === null) {
996
+ * console.error("Failed to fetch website");
997
+ * return;
998
+ * }
999
+ * console.log(`Fetched website: ${website.identification.label}`);
1000
+ * console.log(`Contains ${website.pages.length.toLocaleString()} pages`);
1001
+ * ```
1002
+ *
1003
+ * @remarks
1004
+ * The returned website configuration includes:
1005
+ * - Website metadata and identification
1006
+ * - Page structure and content
1007
+ * - Layout and styling properties
1008
+ * - Navigation configuration
1009
+ * - Sidebar elements
1010
+ * - Project information
1011
+ * - Creator details
1012
+ *
1013
+ * The abbreviation is case-insensitive and should match the website's configured abbreviation in OCHRE.
1014
+ */
1015
+ declare function fetchWebsite(abbreviation: string, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<[null, Website] | [string, null]>;
1016
+ //#endregion
1017
+ //#region src/utils/getters.d.ts
1018
+ /**
1019
+ * Options for property search operations
1020
+ */
1021
+ type PropertyOptions = {
1022
+ /** Whether to recursively search through nested properties */
1023
+ includeNestedProperties: boolean;
1024
+ };
1025
+ /**
1026
+ * Finds a property by its UUID in an array of properties
1027
+ *
1028
+ * @param properties - Array of properties to search through
1029
+ * @param uuid - The UUID to search for
1030
+ * @param options - Search options, including whether to include nested properties
1031
+ * @returns The matching Property object, or null if not found
1032
+ *
1033
+ * @example
1034
+ * ```ts
1035
+ * const property = getPropertyByUuid(properties, "123e4567-e89b-12d3-a456-426614174000", { includeNestedProperties: true });
1036
+ * if (property) {
1037
+ * console.log(property.values);
1038
+ * }
1039
+ * ```
1040
+ */
1041
+ declare function getPropertyByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Property | null;
1042
+ /**
1043
+ * Retrieves all values for a property with the given UUID
1044
+ *
1045
+ * @param properties - Array of properties to search through
1046
+ * @param uuid - The UUID to search for
1047
+ * @param options - Search options, including whether to include nested properties
1048
+ * @returns Array of property values as strings, or null if property not found
1049
+ *
1050
+ * @example
1051
+ * ```ts
1052
+ * const values = getPropertyValuesByUuid(properties, "123e4567-e89b-12d3-a456-426614174000");
1053
+ * if (values) {
1054
+ * for (const value of values) {
1055
+ * console.log(value);
1056
+ * }
1057
+ * }
1058
+ * ```
1059
+ */
1060
+ declare function getPropertyValuesByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
1061
+ /**
1062
+ * Gets the first value of a property with the given UUID
1063
+ *
1064
+ * @param properties - Array of properties to search through
1065
+ * @param uuid - The UUID to search for
1066
+ * @param options - Search options, including whether to include nested properties
1067
+ * @returns The first property value as string, or null if property not found
1068
+ *
1069
+ * @example
1070
+ * ```ts
1071
+ * const title = getPropertyValueByUuid(properties, "123e4567-e89b-12d3-a456-426614174000");
1072
+ * if (title) {
1073
+ * console.log(`Document title: ${title}`);
1074
+ * }
1075
+ * ```
1076
+ */
1077
+ declare function getPropertyValueByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): string | number | boolean | Date | null;
1078
+ /**
1079
+ * Finds a property by its label in an array of properties
1080
+ *
1081
+ * @param properties - Array of properties to search through
1082
+ * @param label - The label to search for
1083
+ * @param options - Search options, including whether to include nested properties
1084
+ * @returns The matching Property object, or null if not found
1085
+ *
1086
+ * @example
1087
+ * ```ts
1088
+ * const property = getPropertyByLabel(properties, "author", { includeNestedProperties: true });
1089
+ * if (property) {
1090
+ * console.log(property.values);
1091
+ * }
1092
+ * ```
1093
+ */
1094
+ declare function getPropertyByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Property | null;
1095
+ /**
1096
+ * Retrieves all values for a property with the given label
1097
+ *
1098
+ * @param properties - Array of properties to search through
1099
+ * @param label - The label to search for
1100
+ * @param options - Search options, including whether to include nested properties
1101
+ * @returns Array of property values as strings, or null if property not found
1102
+ *
1103
+ * @example
1104
+ * ```ts
1105
+ * const values = getPropertyValuesByLabel(properties, "keywords");
1106
+ * if (values) {
1107
+ * for (const value of values) {
1108
+ * console.log(value);
1109
+ * }
1110
+ * }
1111
+ * ```
1112
+ */
1113
+ declare function getPropertyValuesByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
1114
+ /**
1115
+ * Gets the first value of a property with the given label
1116
+ *
1117
+ * @param properties - Array of properties to search through
1118
+ * @param label - The label to search for
1119
+ * @param options - Search options, including whether to include nested properties
1120
+ * @returns The first property value as string, or null if property not found
1121
+ *
1122
+ * @example
1123
+ * ```ts
1124
+ * const title = getPropertyValueByLabel(properties, "title");
1125
+ * if (title) {
1126
+ * console.log(`Document title: ${title}`);
1127
+ * }
1128
+ * ```
1129
+ */
1130
+ declare function getPropertyValueByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): string | number | boolean | Date | null;
1131
+ /**
1132
+ * Gets all unique properties from an array of properties
1133
+ *
1134
+ * @param properties - Array of properties to get unique properties from
1135
+ * @param options - Search options, including whether to include nested properties
1136
+ * @returns Array of unique properties
1137
+ *
1138
+ * @example
1139
+ * ```ts
1140
+ * const properties = getAllUniqueProperties(properties, { includeNestedProperties: true });
1141
+ * console.log(`Available properties: ${properties.map((p) => p.label).join(", ")}`);
1142
+ * ```
1143
+ */
1144
+ declare function getUniqueProperties(properties: Array<Property>, options?: PropertyOptions): Array<Property>;
1145
+ /**
1146
+ * Gets all unique property labels from an array of properties
1147
+ *
1148
+ * @param properties - Array of properties to get unique property labels from
1149
+ * @param options - Search options, including whether to include nested properties
1150
+ * @returns Array of unique property labels
1151
+ *
1152
+ * @example
1153
+ * ```ts
1154
+ * const properties = getAllUniquePropertyLabels(properties, { includeNestedProperties: true });
1155
+ * console.log(`Available properties: ${properties.join(", ")}`);
1156
+ * ```
1157
+ */
1158
+ declare function getUniquePropertyLabels(properties: Array<Property>, options?: PropertyOptions): Array<string>;
1159
+ /**
1160
+ * Filters a property based on a label and value criteria
1161
+ *
1162
+ * @param property - The property to filter
1163
+ * @param filter - Filter criteria containing label and value to match
1164
+ * @param filter.label - The label to filter by
1165
+ * @param filter.value - The value to filter by
1166
+ * @param options - Search options, including whether to include nested properties
1167
+ * @returns True if the property matches the filter criteria, false otherwise
1168
+ *
1169
+ * @example
1170
+ * ```ts
1171
+ * const matches = filterProperties(property, {
1172
+ * label: "category",
1173
+ * value: "book"
1174
+ * });
1175
+ * if (matches) {
1176
+ * console.log("Property matches filter criteria");
1177
+ * }
1178
+ * ```
1179
+ */
1180
+ declare function filterProperties(property: Property, filter: {
1181
+ label: string;
1182
+ value: string | number | boolean | Date;
1183
+ }, options?: PropertyOptions): boolean;
1184
+ //#endregion
1185
+ export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinates, CoordinatesItem, Data, DataCategory, Event, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Set, SpatialUnit, Style, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, WebpageProperties, Website, WebsiteProperties, fetchByUuidMetadata, fetchGallery, fetchItem, fetchPropertyQuery, fetchWebsite, filterProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };