@digitalculture/ochre-sdk 0.11.18 → 0.11.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts DELETED
@@ -1,1184 +0,0 @@
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
- };
571
- };
572
- };
573
- /**
574
- * Properties for configuring website display and styling
575
- */
576
- type WebsiteProperties = {
577
- type: "traditional" | "digital-collection" | "plum" | "cedar" | "elm" | "maple" | "oak" | "palm";
578
- privacy: "public" | "password" | "private";
579
- status: "development" | "preview" | "production";
580
- contact: {
581
- name: string;
582
- email: string | null;
583
- } | null;
584
- isHeaderDisplayed: boolean;
585
- headerVariant: "default" | "floating" | "inline";
586
- headerAlignment: "start" | "center" | "end";
587
- isHeaderProjectDisplayed: boolean;
588
- isFooterDisplayed: boolean;
589
- isSidebarDisplayed: boolean;
590
- iiifViewer: "universal-viewer" | "clover";
591
- supportsThemeToggle: boolean;
592
- defaultTheme: "light" | "dark" | null;
593
- logoUrl: string | null;
594
- };
595
- type Webpage = {
596
- title: string;
597
- slug: string;
598
- properties: WebpageProperties;
599
- items: Array<WebElement | WebBlock>;
600
- webpages: Array<Webpage>;
601
- };
602
- /**
603
- * Properties for configuring webpage display and styling
604
- */
605
- type WebpageProperties = {
606
- displayedInHeader: boolean;
607
- width: "full" | "large" | "narrow" | "default";
608
- variant: "default" | "no-background";
609
- backgroundImageUrl: string | null;
610
- isBreadcrumbsDisplayed: boolean;
611
- isSidebarDisplayed: boolean;
612
- cssStyles: {
613
- default: Array<Style>;
614
- tablet: Array<Style>;
615
- mobile: Array<Style>;
616
- };
617
- };
618
- type WebTitle = {
619
- label: string;
620
- variant: "default" | "simple";
621
- properties: {
622
- isNameDisplayed: boolean;
623
- isDescriptionDisplayed: boolean;
624
- isDateDisplayed: boolean;
625
- isCreatorsDisplayed: boolean;
626
- isCountDisplayed: boolean;
627
- };
628
- };
629
- /**
630
- * Base properties for web elements
631
- */
632
- type WebElement = {
633
- uuid: string;
634
- type: "element";
635
- title: WebTitle;
636
- cssStyles: {
637
- default: Array<Style>;
638
- tablet: Array<Style>;
639
- mobile: Array<Style>;
640
- };
641
- } & WebElementComponent;
642
- /**
643
- * Union type of all possible web element components
644
- */
645
- type WebElementComponent = {
646
- component: "annotated-document";
647
- documentId: string;
648
- } | {
649
- component: "annotated-image";
650
- imageUuid: string;
651
- isFilterDisplayed: boolean;
652
- isOptionsDisplayed: boolean;
653
- isAnnotationHighlightsDisplayed: boolean;
654
- isAnnotationTooltipsDisplayed: boolean;
655
- } | {
656
- component: "audio-player";
657
- audioId: string;
658
- isSpeedControlsDisplayed: boolean;
659
- isVolumeControlsDisplayed: boolean;
660
- isSeekBarDisplayed: boolean;
661
- } | {
662
- component: "bibliography";
663
- itemUuids: Array<string>;
664
- bibliographies: Array<Bibliography>;
665
- layout: "long" | "short";
666
- isSourceDocumentDisplayed: boolean;
667
- } | {
668
- component: "entries";
669
- entriesId: string;
670
- variant: "entry" | "item";
671
- isFilterDisplayed: boolean;
672
- } | {
673
- component: "button";
674
- variant: "default" | "transparent" | "link";
675
- href: string;
676
- isExternal: boolean;
677
- label: string;
678
- startIcon: string | null;
679
- endIcon: string | null;
680
- image: WebImage | null;
681
- } | {
682
- component: "collection";
683
- collectionId: string;
684
- variant: "full" | "highlights";
685
- itemVariant: "detailed" | "card" | "tile";
686
- paginationVariant: "default" | "numeric";
687
- isSortDisplayed: boolean;
688
- isFilterDisplayed: boolean;
689
- filterSort: "default" | "alphabetical";
690
- layout: "image-top" | "image-bottom" | "image-start" | "image-end";
691
- } | {
692
- component: "empty-space";
693
- height: string | null;
694
- width: string | null;
695
- } | {
696
- component: "iframe";
697
- href: string;
698
- height: string | null;
699
- width: string | null;
700
- } | {
701
- component: "iiif-viewer";
702
- iiifId: string;
703
- variant: "universal-viewer" | "clover";
704
- } | {
705
- component: "image";
706
- images: Array<WebImage>;
707
- variant: "default" | "carousel" | "grid" | "hero";
708
- width: number | null;
709
- height: number | null;
710
- isFullWidth: boolean;
711
- isFullHeight: boolean;
712
- imageQuality: "high" | "low";
713
- captionSource: "name" | "abbreviation" | "description";
714
- captionLayout: "top" | "bottom" | "inset" | "suppress";
715
- altTextSource: "name" | "abbreviation" | "description";
716
- isTransparentBackground: boolean;
717
- isCover: boolean;
718
- carouselOptions: {
719
- secondsPerImage: number;
720
- } | null;
721
- heroOptions: {
722
- isBackgroundImageDisplayed: boolean;
723
- isDocumentDisplayed: boolean;
724
- isLinkDisplayed: boolean;
725
- } | null;
726
- } | {
727
- component: "image-gallery";
728
- galleryId: string;
729
- isFilterDisplayed: boolean;
730
- } | {
731
- component: "map";
732
- mapId: string;
733
- customBasemap: string | null;
734
- isControlsDisplayed: boolean;
735
- isInteractive: boolean;
736
- isClustered: boolean;
737
- isUsingPins: boolean;
738
- isFullHeight: boolean;
739
- } | {
740
- component: "network-graph";
741
- } | {
742
- component: "query";
743
- queries: Array<{
744
- label: string;
745
- propertyUuids: Array<string>;
746
- startIcon: string | null;
747
- endIcon: string | null;
748
- }>;
749
- } | {
750
- component: "search-bar";
751
- variant: "default" | "full";
752
- placeholder: string | null;
753
- baseQuery: string | null;
754
- } | {
755
- component: "table";
756
- tableId: string;
757
- } | {
758
- component: "text";
759
- variant: {
760
- name: "title" | "block" | "banner";
761
- } | {
762
- name: "paragraph";
763
- size: "xs" | "sm" | "md" | "lg";
764
- } | {
765
- name: "label";
766
- size: "xs" | "sm" | "md" | "lg" | "xl";
767
- } | {
768
- name: "heading";
769
- size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
770
- } | {
771
- name: "display";
772
- size: "xs" | "sm" | "md" | "lg";
773
- };
774
- content: string;
775
- } | {
776
- component: "timeline";
777
- timelineId: string;
778
- } | {
779
- component: "video";
780
- isChaptersDislayed: boolean;
781
- };
782
- /**
783
- * Represents an image used in web elements
784
- */
785
- type WebImage = {
786
- url: string;
787
- label: string | null;
788
- description: string | null;
789
- width: number;
790
- height: number;
791
- };
792
- /**
793
- * Represents a CSS style with label and value
794
- */
795
- type Style = {
796
- label: string;
797
- value: string;
798
- };
799
- type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "horizontal-flex" | "accordion";
800
- /**
801
- * Represents a block of vertical or horizontal content alignment
802
- */
803
- type WebBlock<T extends WebBlockLayout = WebBlockLayout> = {
804
- uuid: string;
805
- type: "block";
806
- title: WebTitle;
807
- items: T extends "accordion" ? Array<Extract<WebElement, {
808
- component: "text";
809
- }> & {
810
- items: Array<WebElement | WebBlock>;
811
- }> : Array<WebElement | WebBlock>;
812
- properties: {
813
- default: {
814
- layout: T;
815
- /**
816
- * valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
817
- */
818
- spacing: string | undefined;
819
- /**
820
- * `gap` CSS property value
821
- */
822
- gap: string | undefined;
823
- /**
824
- * `align-items` CSS property value
825
- */
826
- alignItems: "stretch" | "start" | "center" | "end" | "space-between";
827
- /**
828
- * `justify-content` CSS property value
829
- */
830
- justifyContent: "stretch" | "start" | "center" | "end" | "space-between";
831
- isAccordionEnabled: T extends "accordion" ? boolean : never;
832
- isAccordionExpandedByDefault: T extends "accordion" ? boolean : never;
833
- isAccordionSidebarDisplayed: T extends "accordion" ? boolean : never;
834
- };
835
- tablet: Partial<WebBlock["properties"]["default"]> | null;
836
- mobile: Partial<WebBlock["properties"]["default"]> | null;
837
- };
838
- cssStyles: {
839
- default: Array<Style>;
840
- tablet: Array<Style>;
841
- mobile: Array<Style>;
842
- };
843
- };
844
- //#endregion
845
- //#region src/utils/fetchers/gallery.d.ts
846
- /**
847
- * Fetches and parses a gallery from the OCHRE API
848
- *
849
- * @param uuid - The UUID of the gallery
850
- * @param filter - The filter to apply to the gallery
851
- * @param page - The page number to fetch
852
- * @param perPage - The number of items per page
853
- * @returns The parsed gallery or null if the fetch/parse fails
854
- *
855
- * @example
856
- * ```ts
857
- * const gallery = await fetchGallery("9c4da06b-f15e-40af-a747-0933eaf3587e", "1978", 1, 12);
858
- * if (gallery === null) {
859
- * console.error("Failed to fetch gallery");
860
- * return;
861
- * }
862
- * console.log(`Fetched gallery: ${gallery.identification.label}`);
863
- * console.log(`Contains ${gallery.resources.length.toLocaleString()} resources`);
864
- * ```
865
- *
866
- * @remarks
867
- * The returned gallery includes:
868
- * - Gallery metadata and identification
869
- * - Project identification
870
- * - Resources (gallery items)
871
- */
872
- declare function fetchGallery(uuid: string, filter: string, page: number, perPage: number, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
873
- item: Gallery | null;
874
- error: null;
875
- } | {
876
- item: null;
877
- error: string;
878
- }>;
879
- //#endregion
880
- //#region src/utils/fetchers/item.d.ts
881
- /**
882
- * Fetches and parses an OCHRE item from the OCHRE API
883
- *
884
- * @param uuid - The UUID of the OCHRE item to fetch
885
- * @returns Object containing the parsed OCHRE item and its metadata, or null if the fetch/parse fails
886
- *
887
- * @example
888
- * ```ts
889
- * const result = await fetchItem("123e4567-e89b-12d3-a456-426614174000");
890
- * if (result === null) {
891
- * console.error("Failed to fetch OCHRE item");
892
- * return;
893
- * }
894
- * const { metadata, belongsTo, item, category } = result;
895
- * console.log(`Fetched OCHRE item: ${item.identification.label} with category ${category}`);
896
- * ```
897
- *
898
- * Or, if you want to fetch a specific category, you can do so by passing the category as an argument:
899
- * ```ts
900
- * const result = await fetchItem("123e4567-e89b-12d3-a456-426614174000", "resource");
901
- * const { metadata, belongsTo, item, category } = result;
902
- * console.log(item.category); // "resource"
903
- * ```
904
- *
905
- * @remarks
906
- * The returned OCHRE item includes:
907
- * - Item metadata
908
- * - Item belongsTo information
909
- * - Item content
910
- * - Item category
911
- *
912
- * If the fetch/parse fails, the returned object will have an `error` property.
913
- */
914
- 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<{
915
- error: null;
916
- metadata: Metadata;
917
- belongsTo: {
918
- uuid: string;
919
- abbreviation: string;
920
- };
921
- 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;
922
- category: T;
923
- } | {
924
- error: string;
925
- metadata: never;
926
- belongsTo: never;
927
- item: never;
928
- category: never;
929
- }>;
930
- //#endregion
931
- //#region src/utils/fetchers/property-query.d.ts
932
- /**
933
- * Fetches and parses a property query from the OCHRE API
934
- *
935
- * @param scopeUuids - The scope UUIDs to filter by
936
- * @param propertyUuids - The property UUIDs to query by
937
- * @param customFetch - A custom fetch function to use instead of the default fetch
938
- * @returns The parsed property query or null if the fetch/parse fails
939
- *
940
- * @example
941
- * ```ts
942
- * const propertyQuery = await fetchPropertyQuery(["0c0aae37-7246-495b-9547-e25dbf5b99a3"], ["9c4da06b-f15e-40af-a747-0933eaf3587e"]);
943
- * if (propertyQuery === null) {
944
- * console.error("Failed to fetch property query");
945
- * return;
946
- * }
947
- * console.log(`Fetched property query: ${propertyQuery.item}`);
948
- * ```
949
- *
950
- * @remarks
951
- * The returned property query includes:
952
- * - Property items
953
- */
954
- declare function fetchPropertyQuery(scopeUuids: Array<string>, propertyUuids: Array<string>, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
955
- items: Array<PropertyQueryItem> | null;
956
- error: null;
957
- } | {
958
- items: null;
959
- error: string;
960
- }>;
961
- //#endregion
962
- //#region src/utils/fetchers/uuid-metadata.d.ts
963
- /**
964
- * Fetches raw OCHRE metadata by UUID from the OCHRE API
965
- *
966
- * @param uuid - The UUID of the OCHRE item to fetch
967
- * @returns An object containing the OCHRE metadata or an error message
968
- *
969
- * @example
970
- * ```ts
971
- * const { item, error } = await fetchByUuidMetadata("123e4567-e89b-12d3-a456-426614174000");
972
- * if (error !== null) {
973
- * console.error(`Failed to fetch: ${error}`);
974
- * return;
975
- * }
976
- * // Process data...
977
- * ```
978
- */
979
- declare function fetchByUuidMetadata(uuid: string, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
980
- item: UuidMetadata | null;
981
- error: string | null;
982
- }>;
983
- //#endregion
984
- //#region src/utils/fetchers/website.d.ts
985
- /**
986
- * Fetches and parses a website configuration from the OCHRE API
987
- *
988
- * @param abbreviation - The abbreviation identifier for the website
989
- * @returns The parsed website configuration or null if the fetch/parse fails
990
- *
991
- * @example
992
- * ```ts
993
- * const website = await fetchWebsite("guerrilla-television");
994
- * if (website === null) {
995
- * console.error("Failed to fetch website");
996
- * return;
997
- * }
998
- * console.log(`Fetched website: ${website.identification.label}`);
999
- * console.log(`Contains ${website.pages.length.toLocaleString()} pages`);
1000
- * ```
1001
- *
1002
- * @remarks
1003
- * The returned website configuration includes:
1004
- * - Website metadata and identification
1005
- * - Page structure and content
1006
- * - Layout and styling properties
1007
- * - Navigation configuration
1008
- * - Sidebar elements
1009
- * - Project information
1010
- * - Creator details
1011
- *
1012
- * The abbreviation is case-insensitive and should match the website's configured abbreviation in OCHRE.
1013
- */
1014
- declare function fetchWebsite(abbreviation: string, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<[null, Website] | [string, null]>;
1015
- //#endregion
1016
- //#region src/utils/getters.d.ts
1017
- /**
1018
- * Options for property search operations
1019
- */
1020
- type PropertyOptions = {
1021
- /** Whether to recursively search through nested properties */
1022
- includeNestedProperties: boolean;
1023
- };
1024
- /**
1025
- * Finds a property by its UUID in an array of properties
1026
- *
1027
- * @param properties - Array of properties to search through
1028
- * @param uuid - The UUID to search for
1029
- * @param options - Search options, including whether to include nested properties
1030
- * @returns The matching Property object, or null if not found
1031
- *
1032
- * @example
1033
- * ```ts
1034
- * const property = getPropertyByUuid(properties, "123e4567-e89b-12d3-a456-426614174000", { includeNestedProperties: true });
1035
- * if (property) {
1036
- * console.log(property.values);
1037
- * }
1038
- * ```
1039
- */
1040
- declare function getPropertyByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Property | null;
1041
- /**
1042
- * Retrieves all values for a property with the given UUID
1043
- *
1044
- * @param properties - Array of properties to search through
1045
- * @param uuid - The UUID to search for
1046
- * @param options - Search options, including whether to include nested properties
1047
- * @returns Array of property values as strings, or null if property not found
1048
- *
1049
- * @example
1050
- * ```ts
1051
- * const values = getPropertyValuesByUuid(properties, "123e4567-e89b-12d3-a456-426614174000");
1052
- * if (values) {
1053
- * for (const value of values) {
1054
- * console.log(value);
1055
- * }
1056
- * }
1057
- * ```
1058
- */
1059
- declare function getPropertyValuesByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
1060
- /**
1061
- * Gets the first value of a property with the given UUID
1062
- *
1063
- * @param properties - Array of properties to search through
1064
- * @param uuid - The UUID to search for
1065
- * @param options - Search options, including whether to include nested properties
1066
- * @returns The first property value as string, or null if property not found
1067
- *
1068
- * @example
1069
- * ```ts
1070
- * const title = getPropertyValueByUuid(properties, "123e4567-e89b-12d3-a456-426614174000");
1071
- * if (title) {
1072
- * console.log(`Document title: ${title}`);
1073
- * }
1074
- * ```
1075
- */
1076
- declare function getPropertyValueByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): string | number | boolean | Date | null;
1077
- /**
1078
- * Finds a property by its label in an array of properties
1079
- *
1080
- * @param properties - Array of properties to search through
1081
- * @param label - The label to search for
1082
- * @param options - Search options, including whether to include nested properties
1083
- * @returns The matching Property object, or null if not found
1084
- *
1085
- * @example
1086
- * ```ts
1087
- * const property = getPropertyByLabel(properties, "author", { includeNestedProperties: true });
1088
- * if (property) {
1089
- * console.log(property.values);
1090
- * }
1091
- * ```
1092
- */
1093
- declare function getPropertyByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Property | null;
1094
- /**
1095
- * Retrieves all values for a property with the given label
1096
- *
1097
- * @param properties - Array of properties to search through
1098
- * @param label - The label to search for
1099
- * @param options - Search options, including whether to include nested properties
1100
- * @returns Array of property values as strings, or null if property not found
1101
- *
1102
- * @example
1103
- * ```ts
1104
- * const values = getPropertyValuesByLabel(properties, "keywords");
1105
- * if (values) {
1106
- * for (const value of values) {
1107
- * console.log(value);
1108
- * }
1109
- * }
1110
- * ```
1111
- */
1112
- declare function getPropertyValuesByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
1113
- /**
1114
- * Gets the first value of a property with the given label
1115
- *
1116
- * @param properties - Array of properties to search through
1117
- * @param label - The label to search for
1118
- * @param options - Search options, including whether to include nested properties
1119
- * @returns The first property value as string, or null if property not found
1120
- *
1121
- * @example
1122
- * ```ts
1123
- * const title = getPropertyValueByLabel(properties, "title");
1124
- * if (title) {
1125
- * console.log(`Document title: ${title}`);
1126
- * }
1127
- * ```
1128
- */
1129
- declare function getPropertyValueByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): string | number | boolean | Date | null;
1130
- /**
1131
- * Gets all unique properties from an array of properties
1132
- *
1133
- * @param properties - Array of properties to get unique properties from
1134
- * @param options - Search options, including whether to include nested properties
1135
- * @returns Array of unique properties
1136
- *
1137
- * @example
1138
- * ```ts
1139
- * const properties = getAllUniqueProperties(properties, { includeNestedProperties: true });
1140
- * console.log(`Available properties: ${properties.map((p) => p.label).join(", ")}`);
1141
- * ```
1142
- */
1143
- declare function getUniqueProperties(properties: Array<Property>, options?: PropertyOptions): Array<Property>;
1144
- /**
1145
- * Gets all unique property labels from an array of properties
1146
- *
1147
- * @param properties - Array of properties to get unique property labels from
1148
- * @param options - Search options, including whether to include nested properties
1149
- * @returns Array of unique property labels
1150
- *
1151
- * @example
1152
- * ```ts
1153
- * const properties = getAllUniquePropertyLabels(properties, { includeNestedProperties: true });
1154
- * console.log(`Available properties: ${properties.join(", ")}`);
1155
- * ```
1156
- */
1157
- declare function getUniquePropertyLabels(properties: Array<Property>, options?: PropertyOptions): Array<string>;
1158
- /**
1159
- * Filters a property based on a label and value criteria
1160
- *
1161
- * @param property - The property to filter
1162
- * @param filter - Filter criteria containing label and value to match
1163
- * @param filter.label - The label to filter by
1164
- * @param filter.value - The value to filter by
1165
- * @param options - Search options, including whether to include nested properties
1166
- * @returns True if the property matches the filter criteria, false otherwise
1167
- *
1168
- * @example
1169
- * ```ts
1170
- * const matches = filterProperties(property, {
1171
- * label: "category",
1172
- * value: "book"
1173
- * });
1174
- * if (matches) {
1175
- * console.log("Property matches filter criteria");
1176
- * }
1177
- * ```
1178
- */
1179
- declare function filterProperties(property: Property, filter: {
1180
- label: string;
1181
- value: string | number | boolean | Date;
1182
- }, options?: PropertyOptions): boolean;
1183
- //#endregion
1184
- 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 };