@digitalculture/ochre-sdk 0.1.20 → 0.1.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.
@@ -0,0 +1,1654 @@
1
+ import { Language } from 'iso-639-3';
2
+
3
+ /**
4
+ * Represents the core data structure containing item information and metadata
5
+ */
6
+ type Data = {
7
+ uuid: string;
8
+ belongsTo: {
9
+ uuid: string;
10
+ abbreviation: string;
11
+ };
12
+ publicationDateTime: Date;
13
+ metadata: Metadata;
14
+ item: Tree | Set | Resource | SpatialUnit | Concept;
15
+ };
16
+ /**
17
+ * Basic identification information used across multiple types
18
+ */
19
+ type Identification = {
20
+ label: string;
21
+ abbreviation: string;
22
+ };
23
+ /**
24
+ * Metadata information for items including project, publisher and language details
25
+ */
26
+ type Metadata = {
27
+ project: {
28
+ identification: Identification & {
29
+ website: string | null;
30
+ };
31
+ } | null;
32
+ item: {
33
+ identification: Identification;
34
+ category: string;
35
+ type: string;
36
+ maxLength: number | null;
37
+ } | null;
38
+ dataset: string;
39
+ publisher: string;
40
+ languages: Array<Language["iso6393"]>;
41
+ identifier: string;
42
+ description: string;
43
+ };
44
+ /**
45
+ * Represents a single item in a context hierarchy with its metadata
46
+ */
47
+ type ContextItem = {
48
+ uuid: string;
49
+ publicationDateTime: Date | null;
50
+ number: number;
51
+ content: string;
52
+ };
53
+ /**
54
+ * Represents a node in the context tree containing tree, project and spatial unit information
55
+ */
56
+ type ContextNode = {
57
+ tree: ContextItem;
58
+ project: ContextItem;
59
+ spatialUnit: Array<ContextItem>;
60
+ };
61
+ /**
62
+ * Contains the full context information including nodes and display path
63
+ */
64
+ type Context = {
65
+ nodes: Array<ContextNode>;
66
+ displayPath: string;
67
+ };
68
+ /**
69
+ * License information for content items
70
+ */
71
+ type License = {
72
+ content: string;
73
+ url: string;
74
+ };
75
+ /**
76
+ * Represents a person (author, creator, etc.) with their identification and metadata
77
+ */
78
+ type Person = {
79
+ uuid: string;
80
+ publicationDateTime: Date | null;
81
+ type: string | null;
82
+ date: Date | null;
83
+ identification: Identification | null;
84
+ content: string | null;
85
+ };
86
+ /**
87
+ * Represents a note with number, title and content
88
+ */
89
+ type Note = {
90
+ number: number;
91
+ title: string | null;
92
+ content: string;
93
+ };
94
+ /**
95
+ * Represents an image with its metadata and content
96
+ */
97
+ type Image = {
98
+ publicationDateTime: Date | null;
99
+ identification: Identification | null;
100
+ url: string | null;
101
+ htmlPrefix: string | null;
102
+ content: string | null;
103
+ };
104
+ /**
105
+ * Represents a link to another item with optional image and bibliographic references
106
+ */
107
+ type Link = {
108
+ uuid: string;
109
+ publicationDateTime: Date | null;
110
+ type: string | null;
111
+ category: "resource" | "concept" | "set" | "tree" | "person" | "bibliography" | "epigraphicUnit" | null;
112
+ identification: Identification | null;
113
+ content: string | null;
114
+ image: {
115
+ isInline: boolean;
116
+ heightPreview: number;
117
+ widthPreview: number;
118
+ height: number;
119
+ width: number;
120
+ } | null;
121
+ bibliographies: Array<Bibliography> | null;
122
+ };
123
+ /**
124
+ * Represents a clickable/interactive area on an image map
125
+ */
126
+ type ImageMapArea = {
127
+ uuid: string;
128
+ publicationDateTime: Date | null;
129
+ type: string;
130
+ title: string;
131
+ shape: "rectangle" | "polygon";
132
+ coords: Array<number>;
133
+ };
134
+ /**
135
+ * Contains image map areas and dimensions
136
+ */
137
+ type ImageMap = {
138
+ area: Array<ImageMapArea>;
139
+ width: number;
140
+ height: number;
141
+ };
142
+ /**
143
+ * Geographic coordinates with optional type and label
144
+ */
145
+ type Coordinates = {
146
+ latitude: number;
147
+ longitude: number;
148
+ type: string | null;
149
+ label: string | null;
150
+ };
151
+ /**
152
+ * Represents an observation with notes, links and properties
153
+ */
154
+ type Observation = {
155
+ number: number;
156
+ date: Date | null;
157
+ observers: Array<string>;
158
+ notes: Array<Note>;
159
+ links: Array<Link>;
160
+ properties: Array<Property>;
161
+ };
162
+ /**
163
+ * Represents an event with date, label and optional agent
164
+ */
165
+ type Event = {
166
+ date: Date | null;
167
+ label: string;
168
+ agent: {
169
+ uuid: string;
170
+ content: string;
171
+ } | null;
172
+ };
173
+ /**
174
+ * Represents an interpretation with date and properties
175
+ */
176
+ type Interpretation = {
177
+ date: Date | null;
178
+ number: number;
179
+ properties: Array<Property>;
180
+ };
181
+ /**
182
+ * Represents a document with content and footnotes
183
+ */
184
+ type Document = {
185
+ content: string;
186
+ footnotes: Array<Footnote>;
187
+ };
188
+ /**
189
+ * Represents a footnote in a document
190
+ */
191
+ type Footnote = {
192
+ uuid: string;
193
+ label: string;
194
+ content: string;
195
+ };
196
+ /**
197
+ * Represents a resource item with associated metadata, content and relationships
198
+ */
199
+ type Resource = {
200
+ uuid: string;
201
+ category: "resource";
202
+ publicationDateTime: Date | null;
203
+ type: string;
204
+ number: number;
205
+ context: Context | null;
206
+ license: License | null;
207
+ copyright: string | null;
208
+ identification: Identification;
209
+ date: Date | null;
210
+ image: Image | null;
211
+ creators: Array<Person>;
212
+ notes: Array<Note>;
213
+ description: string;
214
+ document: Document | null;
215
+ href: string | null;
216
+ imageMap: ImageMap | null;
217
+ periods: Array<Period>;
218
+ format: string | null;
219
+ links: Array<Link>;
220
+ reverseLinks: Array<Link>;
221
+ properties: Array<Property>;
222
+ citedBibliographies: Array<Bibliography>;
223
+ resources: Array<NestedResource>;
224
+ };
225
+ /**
226
+ * A nested version of Resource type without certain metadata fields
227
+ */
228
+ type NestedResource = Omit<Resource, "publicationDateTime" | "license" | "copyright">;
229
+ /**
230
+ * Represents a spatial unit with geographic coordinates and observations
231
+ */
232
+ type SpatialUnit = {
233
+ uuid: string;
234
+ category: "spatialUnit";
235
+ publicationDateTime: Date | null;
236
+ type: string;
237
+ number: number;
238
+ context: Context | null;
239
+ license: License | null;
240
+ identification: Identification;
241
+ image: Image | null;
242
+ description: string | null;
243
+ coordinates: Coordinates | null;
244
+ observations: Array<Observation>;
245
+ events: Array<Event>;
246
+ };
247
+ /**
248
+ * A nested version of SpatialUnit type without certain metadata fields
249
+ */
250
+ type NestedSpatialUnit = Omit<SpatialUnit, "publicationDateTime" | "license" | "observations" | "events"> & {
251
+ properties: Array<Property>;
252
+ };
253
+ /**
254
+ * Represents a concept with associated interpretations
255
+ */
256
+ type Concept = {
257
+ uuid: string;
258
+ category: "concept";
259
+ publicationDateTime: Date | null;
260
+ number: number;
261
+ license: License | null;
262
+ context: Context | null;
263
+ identification: Identification;
264
+ interpretations: Array<Interpretation>;
265
+ };
266
+ /**
267
+ * A nested version of Concept type without certain metadata fields
268
+ */
269
+ type NestedConcept = Omit<Concept, "publicationDateTime" | "license">;
270
+ /**
271
+ * Represents a set that can contain resources, spatial units and concepts
272
+ */
273
+ type Set = {
274
+ uuid: string;
275
+ category: "set";
276
+ publicationDateTime: Date | null;
277
+ type: string;
278
+ number: number;
279
+ date: Date | null;
280
+ license: License | null;
281
+ identification: Identification;
282
+ isSuppressingBlanks: boolean;
283
+ description: string;
284
+ creators: Array<Person>;
285
+ items: {
286
+ resources: Array<NestedResource>;
287
+ spatialUnits: Array<NestedSpatialUnit>;
288
+ concepts: Array<NestedConcept>;
289
+ periods: Array<Period>;
290
+ };
291
+ };
292
+ /**
293
+ * Represents a bibliography entry with citation and publication information
294
+ */
295
+ type Bibliography = {
296
+ uuid: string;
297
+ publicationDateTime: Date | null;
298
+ type: string | null;
299
+ number: number | null;
300
+ identification: Identification | null;
301
+ projectIdentification: Identification | null;
302
+ context: Context | null;
303
+ citation: {
304
+ format: string | null;
305
+ short: string | null;
306
+ long: string | null;
307
+ };
308
+ publicationInfo: {
309
+ publishers: Array<Person>;
310
+ startDate: Date | null;
311
+ };
312
+ entryInfo: {
313
+ startIssue: string;
314
+ startVolume: string;
315
+ } | null;
316
+ source: {
317
+ resource: Pick<Resource, "uuid" | "publicationDateTime" | "type" | "identification"> | null;
318
+ documentUrl: string | null;
319
+ };
320
+ authors: Array<Person>;
321
+ properties: Array<Property>;
322
+ };
323
+ /**
324
+ * Represents a time period with identification
325
+ */
326
+ type Period = {
327
+ uuid: string;
328
+ publicationDateTime: Date | null;
329
+ type: string | null;
330
+ number: number | null;
331
+ identification: Identification;
332
+ description: string | null;
333
+ };
334
+ /**
335
+ * Valid types for property values
336
+ */
337
+ type PropertyValueType = "string" | "number" | "integer" | "boolean" | "date" | "dateTime" | "time" | "IDREF";
338
+ /**
339
+ * Represents a property value with type information
340
+ */
341
+ type PropertyValue = {
342
+ content: string;
343
+ type: PropertyValueType;
344
+ category: string | null;
345
+ uuid: string | null;
346
+ publicationDateTime: Date | null;
347
+ };
348
+ /**
349
+ * Represents a property with label, values and nested properties
350
+ */
351
+ type Property = {
352
+ label: string;
353
+ values: Array<PropertyValue>;
354
+ comment: string | null;
355
+ properties: Array<Property>;
356
+ };
357
+ /**
358
+ * Represents a tree structure containing resources, spatial units and concepts
359
+ */
360
+ type Tree = {
361
+ uuid: string;
362
+ category: "tree";
363
+ publicationDateTime: Date | null;
364
+ type: string;
365
+ number: number;
366
+ date: Date | null;
367
+ license: License | null;
368
+ identification: Identification;
369
+ creators: Array<Person>;
370
+ items: {
371
+ resources: Array<Resource>;
372
+ spatialUnits: Array<SpatialUnit>;
373
+ concepts: Array<Concept>;
374
+ periods: Array<Period>;
375
+ };
376
+ properties: Array<Property>;
377
+ };
378
+ /**
379
+ * Represents a website with its properties and elements
380
+ */
381
+ type Website = {
382
+ uuid: string;
383
+ publicationDateTime: Date | null;
384
+ identification: Identification;
385
+ project: {
386
+ name: string;
387
+ website: string | null;
388
+ };
389
+ creators: Array<Person>;
390
+ license: License | null;
391
+ pages: Array<Webpage>;
392
+ sidebarElements: Array<WebElement>;
393
+ properties: WebsiteProperties;
394
+ };
395
+ /**
396
+ * Properties for configuring website display and styling
397
+ */
398
+ type WebsiteProperties = {
399
+ type: "traditional" | "digital-collection" | "plum" | "cedar" | "elm" | "maple" | "oak" | "palm";
400
+ privacy: "public" | "password" | "private";
401
+ status: "development" | "preview" | "production";
402
+ isHeaderDisplayed: boolean;
403
+ headerVariant: "default" | "floating";
404
+ isFooterDisplayed: boolean;
405
+ isSidebarDisplayed: boolean;
406
+ searchCollectionUuid: string | null;
407
+ logoUrl: string | null;
408
+ };
409
+ type Webpage = {
410
+ title: string;
411
+ slug: string;
412
+ properties: WebpageProperties;
413
+ elements: Array<WebElement>;
414
+ webpages: Array<Webpage>;
415
+ };
416
+ /**
417
+ * Properties for configuring webpage display and styling
418
+ */
419
+ type WebpageProperties = {
420
+ displayedInHeader: boolean;
421
+ width: "full" | "large" | "narrow" | "default";
422
+ variant: "default" | "no-background";
423
+ backgroundImageUrl: string | null;
424
+ cssStyles: Array<Style>;
425
+ };
426
+ /**
427
+ * Base properties for web elements
428
+ */
429
+ type WebElement = {
430
+ uuid: string;
431
+ title: string;
432
+ cssStyles: Array<Style>;
433
+ } & WebElementComponent;
434
+ /**
435
+ * Union type of all possible web element components
436
+ */
437
+ type WebElementComponent = {
438
+ component: "annotated-document";
439
+ document: Document;
440
+ } | {
441
+ component: "annotated-image";
442
+ imageUuid: string;
443
+ } | {
444
+ component: "bibliography";
445
+ bibliographies: Array<Bibliography>;
446
+ layout: "long" | "short";
447
+ } | {
448
+ component: "blog";
449
+ blogId: string;
450
+ } | {
451
+ component: "button";
452
+ href: string;
453
+ isExternal: boolean;
454
+ label: string;
455
+ } | {
456
+ component: "collection";
457
+ variant: "full" | "highlights";
458
+ layout: "image-top" | "image-bottom" | "image-start" | "image-end";
459
+ collectionId: string;
460
+ } | {
461
+ component: "iiif-viewer";
462
+ IIIFId: string;
463
+ } | {
464
+ component: "image";
465
+ image: WebImage;
466
+ } | {
467
+ component: "image-gallery";
468
+ galleryId: string;
469
+ } | {
470
+ component: "interactive-chapter-table";
471
+ } | {
472
+ component: "item-gallery";
473
+ galleryId: string;
474
+ } | {
475
+ component: "menu";
476
+ } | {
477
+ component: "menu-item";
478
+ } | {
479
+ component: "n-columns";
480
+ columns: Array<WebElement>;
481
+ } | {
482
+ component: "n-rows";
483
+ rows: Array<WebElement>;
484
+ } | {
485
+ component: "network-graph";
486
+ } | {
487
+ component: "table";
488
+ tableId: string;
489
+ } | {
490
+ component: "text";
491
+ variant: "title" | "block" | "banner";
492
+ content: string;
493
+ } | {
494
+ component: "text-image";
495
+ variant: "title" | "block" | "banner";
496
+ layout: "image-top" | "image-bottom" | "image-start" | "image-end" | "image-background";
497
+ captionLayout: "top" | "bottom" | "suppress";
498
+ image: WebImage;
499
+ imageOpacity: number | null;
500
+ content: string;
501
+ };
502
+ /**
503
+ * Represents an image used in web elements
504
+ */
505
+ type WebImage = {
506
+ url: string;
507
+ label: string | null;
508
+ width: number;
509
+ height: number;
510
+ };
511
+ /**
512
+ * Represents a CSS style with label and value
513
+ */
514
+ type Style = {
515
+ label: string;
516
+ value: string;
517
+ };
518
+
519
+ /**
520
+ * Fetches and parses a concept from the OCHRE API
521
+ *
522
+ * @param uuid - The UUID of the concept to fetch
523
+ * @returns Object containing the parsed concept and its metadata, or null if the fetch/parse fails
524
+ *
525
+ * @example
526
+ * ```ts
527
+ * const result = await fetchConcept("123e4567-e89b-12d3-a456-426614174000");
528
+ * if (result === null) {
529
+ * console.error("Failed to fetch concept");
530
+ * return;
531
+ * }
532
+ * const { metadata, item } = result;
533
+ * console.log(`Fetched concept: ${item.identification.label}`);
534
+ * ```
535
+ *
536
+ * @remarks
537
+ * The returned concept includes:
538
+ * - Full concept metadata
539
+ * - Interpretations and their properties
540
+ * - Context information
541
+ * - License details
542
+ */
543
+ declare function fetchConcept(uuid: string): Promise<{
544
+ metadata: Metadata;
545
+ concept: Concept;
546
+ } | null>;
547
+
548
+ /**
549
+ * Raw string value that can be a string, number, or boolean
550
+ */
551
+ type FakeString = string | number | boolean;
552
+
553
+ /**
554
+ * Raw content item with rendering and whitespace options
555
+ */
556
+ type OchreStringItemContent = {
557
+ rend?: string; // "bold" | "italic" | "underline" (space separated)
558
+ whitespace?: string; // "newline" | "trailing" | "leading" (space separated)
559
+ content: FakeString;
560
+ };
561
+
562
+ /**
563
+ * Raw string item with language metadata
564
+ */
565
+ type OchreStringItem = {
566
+ string: FakeString | OchreStringItemContent | Array<OchreStringItemContent>;
567
+ lang?: Language["iso6393"]; // 3 character code (zxx = "a.k.a.")
568
+ languages?: string; // 3 character codes, semicolon separated
569
+ };
570
+
571
+ /**
572
+ * Container for raw string content
573
+ */
574
+ type OchreStringContent = {
575
+ content: FakeString | OchreStringItem | Array<OchreStringItem>;
576
+ };
577
+
578
+ /**
579
+ * Rich text content item with formatting and language metadata
580
+ */
581
+ type OchreStringRichTextItemContent = {
582
+ content: FakeString;
583
+ title?: FakeString;
584
+ lang?: Language["iso6393"]; // 3 character code (zxx = "a.k.a.")
585
+ whitespace?: string; // "newline" | "trailing" | "leading" (space separated)
586
+ rend?: string; // "bold" | "italic" | "underline" (space separated)
587
+ };
588
+
589
+ /**
590
+ * Annotated rich text item with links
591
+ */
592
+ type OchreStringRichTextItemAnnotation = {
593
+ annotation: string; // UUID
594
+ string: FakeString;
595
+ links: OchreLink | Array<OchreLink>;
596
+ };
597
+
598
+ /**
599
+ * Union type for different rich text item formats
600
+ */
601
+ type OchreStringRichTextItem =
602
+ | FakeString
603
+ | OchreStringRichTextItemContent
604
+ | {
605
+ string:
606
+ | OchreStringRichTextItemAnnotation
607
+ | Array<OchreStringRichTextItemAnnotation>;
608
+ whitespace?: string; // "newline" | "trailing" | "leading" (space separated)
609
+ }
610
+ | {
611
+ whitespace: string; // "newline" | "trailing" | "leading" (space separated)
612
+ }
613
+ | OchreStringRichTextItemAnnotation;
614
+
615
+ /**
616
+ * Container for rich text content with language metadata
617
+ */
618
+ type OchreStringRichText = {
619
+ string: FakeString | OchreStringRichTextItem | Array<OchreStringRichTextItem>;
620
+ title?: FakeString;
621
+ lang?: Language["iso6393"]; // 3 character code (zxx = "a.k.a.")
622
+ };
623
+
624
+ /**
625
+ * Raw data structure corresponding to the parsed Data type
626
+ */
627
+ type OchreData = {
628
+ ochre: {
629
+ uuid: string;
630
+ uuidBelongsTo: string;
631
+ belongsTo: FakeString;
632
+ publicationDateTime: string; // YYYY-MM-DDThh:mm:ssZ
633
+ metadata: OchreMetadata;
634
+ languages?: string; // 3 character codes, semicolon separated
635
+ } & (
636
+ | { tree: OchreTree }
637
+ | { set: OchreSet }
638
+ | { resource: OchreResource }
639
+ | { spatialUnit: OchreSpatialUnit }
640
+ | { concept: OchreConcept }
641
+ | { bibliography: OchreBibliography }
642
+ );
643
+ };
644
+
645
+ /**
646
+ * Raw metadata structure corresponding to the parsed Metadata type
647
+ */
648
+ type OchreMetadata = {
649
+ identifier: OchreStringContent;
650
+ item?: {
651
+ label?: OchreStringContent; // Faulty, only exists in old items that have not been republished
652
+ abbreviation?: OchreStringContent; // Faulty, only exists in old items that have not been republished
653
+ identification: OchreIdentification;
654
+ category: string;
655
+ type: string;
656
+ maxLength?: number;
657
+ };
658
+ publisher: OchreStringContent;
659
+ dataset: OchreStringContent;
660
+ project?: { identification: OchreIdentification };
661
+ language: OchreLanguage | Array<OchreLanguage>;
662
+ description: OchreStringContent;
663
+ };
664
+
665
+ /**
666
+ * Raw tree structure corresponding to the parsed Tree type
667
+ */
668
+ type OchreTree = {
669
+ uuid: string;
670
+ publicationDateTime: string; // YYYY-MM-DDThh:mm:ssZ
671
+ type: string;
672
+ n: number;
673
+ availability: OchreLicense;
674
+ identification: OchreIdentification;
675
+ date?: string; // YYYY-MM-DD
676
+ creators?: { creator: OchrePerson | Array<OchrePerson> };
677
+ items:
678
+ | string
679
+ | {
680
+ resource: OchreResource | Array<OchreResource>;
681
+ }
682
+ | { spatialUnit: OchreSpatialUnit | Array<OchreSpatialUnit> }
683
+ | { concept: OchreConcept | Array<OchreConcept> }
684
+ | { period: OchrePeriod | Array<OchrePeriod> };
685
+ properties?: { property: OchreProperty | Array<OchreProperty> };
686
+ };
687
+
688
+ /**
689
+ * Raw set structure corresponding to the parsed Set type
690
+ */
691
+ type OchreSet = {
692
+ uuid: string;
693
+ publicationDateTime: string; // YYYY-MM-DDThh:mm:ssZ
694
+ type: string;
695
+ n: number;
696
+ availability: OchreLicense;
697
+ identification: OchreIdentification;
698
+ date?: string; // YYYY-MM-DD
699
+ suppressBlanks?: boolean;
700
+ description?: OchreStringContent;
701
+ creators?: { creator: OchrePerson | Array<OchrePerson> };
702
+ items:
703
+ | string
704
+ | { resource: OchreResource | Array<OchreResource> }
705
+ | { spatialUnit: OchreSpatialUnit | Array<OchreSpatialUnit> }
706
+ | { concept: OchreConcept | Array<OchreConcept> }
707
+ | { period: OchrePeriod | Array<OchrePeriod> };
708
+ };
709
+
710
+ /**
711
+ * Raw resource structure corresponding to the parsed Resource type
712
+ */
713
+ type OchreResource = {
714
+ uuid: string;
715
+ publicationDateTime: string; // YYYY-MM-DDThh:mm:ssZ
716
+ type: string;
717
+ n: number;
718
+ slug?: string;
719
+ format?: string;
720
+ context?: OchreContext;
721
+ availability?: OchreLicense;
722
+ copyright?: FakeString;
723
+ identification: OchreIdentification;
724
+ href?: string;
725
+ description?: OchreStringContent;
726
+ date?: string; // YYYY-MM-DD
727
+ image?: OchreImage;
728
+ creators?: { creator: OchrePerson | Array<OchrePerson> };
729
+ notes?: { note: OchreNote | Array<OchreNote> };
730
+ document?: {
731
+ content: OchreStringRichText | Array<OchreStringRichText>;
732
+ };
733
+ imagemap?: OchreImageMap;
734
+ periods?: { period: OchrePeriod | Array<OchrePeriod> };
735
+ links?: OchreLink | Array<OchreLink>;
736
+ reverseLinks?: OchreLink | Array<OchreLink>;
737
+ properties?: { property: OchreProperty | Array<OchreProperty> };
738
+ citedBibliography?: {
739
+ reference: OchreBibliography | Array<OchreBibliography>;
740
+ };
741
+ resource?: OchreNestedResource | Array<OchreNestedResource>;
742
+ };
743
+
744
+ /**
745
+ * Raw nested resource structure corresponding to the parsed NestedResource type
746
+ */
747
+ type OchreNestedResource = Omit<
748
+ OchreResource,
749
+ "context" | "availability" | "copyright"
750
+ >;
751
+
752
+ /**
753
+ * Raw spatial unit structure corresponding to the parsed SpatialUnit type
754
+ */
755
+ type OchreSpatialUnit = {
756
+ uuid: string;
757
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
758
+ type: string;
759
+ n: number;
760
+ availability?: OchreLicense;
761
+ context?: OchreContext;
762
+ identification: OchreIdentification;
763
+ image?: OchreImage;
764
+ description?: OchreStringContent;
765
+ coordinates?: OchreCoordinates;
766
+ events?: { event: OchreEvent | Array<OchreEvent> };
767
+ observations?: { observation: OchreObservation | Array<OchreObservation> };
768
+ observation?: OchreObservation;
769
+ };
770
+
771
+ /**
772
+ * Raw nested spatial unit structure corresponding to the parsed NestedSpatialUnit type
773
+ */
774
+ type OchreNestedSpatialUnit = Omit<
775
+ OchreSpatialUnit,
776
+ "context" | "availability" | "observations" | "events"
777
+ > & {
778
+ properties?: { property: OchreProperty | Array<OchreProperty> };
779
+ };
780
+
781
+ /**
782
+ * Raw concept structure corresponding to the parsed Concept type
783
+ */
784
+ type OchreConcept = {
785
+ uuid: string;
786
+ publicationDateTime: string; // YYYY-MM-DDThh:mm:ssZ
787
+ n: number;
788
+ availability?: OchreLicense;
789
+ context?: OchreContext;
790
+ identification: OchreIdentification;
791
+ interpretations: {
792
+ interpretation: OchreInterpretation | Array<OchreInterpretation>;
793
+ };
794
+ };
795
+
796
+ /**
797
+ * Raw nested concept structure corresponding to the parsed NestedConcept type
798
+ */
799
+ type OchreNestedConcept = Omit<OchreConcept, "context" | "availability">;
800
+
801
+ /**
802
+ * Raw property value structure corresponding to the parsed PropertyValue type
803
+ */
804
+ type OchrePropertyValue = OchreStringContent & {
805
+ uuid?: string;
806
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
807
+ type: string;
808
+ category?: string;
809
+ };
810
+
811
+ /**
812
+ * Raw property structure corresponding to the parsed Property type
813
+ */
814
+ type OchreProperty = {
815
+ label: OchreStringContent & { uuid: string };
816
+ value?: OchrePropertyValue | Array<OchrePropertyValue>;
817
+ comment?: FakeString;
818
+ property?: OchreProperty | Array<OchreProperty>;
819
+ };
820
+
821
+ /**
822
+ * Raw identification structure corresponding to the parsed Identification type
823
+ */
824
+ type OchreIdentification = {
825
+ label: OchreStringContent;
826
+ abbreviation?: OchreStringContent;
827
+ MIMEType?: string;
828
+ widthPreview?: number;
829
+ heightPreview?: number;
830
+ height?: number;
831
+ width?: number;
832
+ website?: string;
833
+ };
834
+
835
+ /**
836
+ * Raw license structure corresponding to the parsed License type
837
+ */
838
+ type OchreLicense = {
839
+ license: { content: string; target: string } | string;
840
+ };
841
+
842
+ /**
843
+ * Raw language structure for specifying content languages
844
+ */
845
+ type OchreLanguage = {
846
+ default?: boolean;
847
+ content: string; // 3 character code
848
+ };
849
+
850
+ /**
851
+ * Raw link item structure for various linked content types
852
+ */
853
+ type OchreLinkItem = {
854
+ uuid: string;
855
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
856
+ type?: string;
857
+ identification?: OchreIdentification;
858
+ rend?: "inline";
859
+ content?: FakeString;
860
+ heightPreview?: number;
861
+ widthPreview?: number;
862
+ height?: number;
863
+ width?: number;
864
+ };
865
+
866
+ /**
867
+ * Raw link structure corresponding to the parsed Link type
868
+ */
869
+ type OchreLink =
870
+ | { resource: OchreLinkItem | Array<OchreLinkItem> }
871
+ | { concept: OchreLinkItem | Array<OchreLinkItem> }
872
+ | { set: OchreLinkItem | Array<OchreLinkItem> }
873
+ | { tree: OchreLinkItem | Array<OchreLinkItem> }
874
+ | { person: OchreLinkItem | Array<OchreLinkItem> }
875
+ | { epigraphicUnit: OchreLinkItem | Array<OchreLinkItem> }
876
+ | { bibliography: OchreBibliography | Array<OchreBibliography> };
877
+
878
+ /**
879
+ * Raw image structure corresponding to the parsed Image type
880
+ */
881
+ type OchreImage = {
882
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
883
+ identification?: OchreIdentification;
884
+ href?: string;
885
+ htmlImgSrcPrefix?: string;
886
+ content?: FakeString;
887
+ };
888
+
889
+ /**
890
+ * Raw bibliography structure corresponding to the parsed Bibliography type
891
+ */
892
+ type OchreBibliography = {
893
+ uuid: string;
894
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
895
+ type?: string;
896
+ n?: number;
897
+ identification?: OchreIdentification;
898
+ project?: { identification: OchreIdentification };
899
+ context?: OchreContext;
900
+ sourceDocument?: {
901
+ uuid: string;
902
+ content: FakeString;
903
+ };
904
+ publicationInfo?: {
905
+ publishers?: { publishers: { person: OchrePerson | Array<OchrePerson> } };
906
+ startDate?: {
907
+ month: number;
908
+ year: number;
909
+ day: number;
910
+ };
911
+ };
912
+ entryInfo?: {
913
+ startIssue: FakeString;
914
+ startVolume: FakeString;
915
+ };
916
+ citationFormat?: string;
917
+ citationFormatSpan?:
918
+ | {
919
+ span: {
920
+ content: FakeString;
921
+ };
922
+ }
923
+ | {
924
+ "default:span": {
925
+ content: FakeString;
926
+ };
927
+ };
928
+ referenceFormatDiv?:
929
+ | {
930
+ div: {
931
+ div: {
932
+ class: string;
933
+ content: FakeString;
934
+ };
935
+ style: string;
936
+ class: string;
937
+ };
938
+ }
939
+ | {
940
+ "default:div": {
941
+ "default:div": {
942
+ class: string;
943
+ content: FakeString;
944
+ };
945
+ style: string;
946
+ class: string;
947
+ };
948
+ };
949
+ source?: {
950
+ resource: Pick<
951
+ OchreResource,
952
+ "uuid" | "type" | "publicationDateTime" | "identification"
953
+ >;
954
+ };
955
+ authors?: { person: OchrePerson | Array<OchrePerson> };
956
+ properties?: { property: OchreProperty | Array<OchreProperty> };
957
+ };
958
+
959
+ /**
960
+ * Raw note structure corresponding to the parsed Note type
961
+ */
962
+ type OchreNote =
963
+ | string
964
+ | {
965
+ noteNo: number;
966
+ content: OchreStringRichText | Array<OchreStringRichText>;
967
+ };
968
+
969
+ /**
970
+ * Raw period structure corresponding to the parsed Period type
971
+ */
972
+ type OchrePeriod = {
973
+ uuid: string;
974
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
975
+ type?: string;
976
+ n?: number;
977
+ identification: OchreIdentification;
978
+ description?: OchreStringContent;
979
+ };
980
+
981
+ /**
982
+ * Raw image map area structure corresponding to the parsed ImageMapArea type
983
+ */
984
+ type OchreImageMapArea = {
985
+ uuid: string;
986
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
987
+ type: string;
988
+ title: FakeString;
989
+ shape: "rect" | "poly";
990
+ coords: string; // comma separated list of numbers
991
+ };
992
+
993
+ /**
994
+ * Raw image map structure corresponding to the parsed ImageMap type
995
+ */
996
+ type OchreImageMap = {
997
+ area: OchreImageMapArea | Array<OchreImageMapArea>;
998
+ width: number;
999
+ height: number;
1000
+ };
1001
+
1002
+ /**
1003
+ * Raw context structure corresponding to the parsed Context type
1004
+ */
1005
+ type OchreContext = {
1006
+ context: OchreContextValue | Array<OchreContextValue>;
1007
+ displayPath: string;
1008
+ };
1009
+
1010
+ /**
1011
+ * Raw context value structure containing tree, project and spatial unit information
1012
+ */
1013
+ type OchreContextValue = {
1014
+ tree: OchreContextItem;
1015
+ project: OchreContextItem;
1016
+ spatialUnit?: OchreContextItem | Array<OchreContextItem>;
1017
+ displayPath: string;
1018
+ };
1019
+
1020
+ /**
1021
+ * Raw context item structure corresponding to the parsed ContextItem type
1022
+ */
1023
+ type OchreContextItem = {
1024
+ uuid: string;
1025
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
1026
+ n: number; // negative number
1027
+ content: FakeString;
1028
+ };
1029
+
1030
+ /**
1031
+ * Raw person structure corresponding to the parsed Person type
1032
+ */
1033
+ type OchrePerson = {
1034
+ uuid: string;
1035
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
1036
+ type?: string;
1037
+ date?: string; // YYYY-MM-DD
1038
+ identification?: OchreIdentification;
1039
+ content?: FakeString | null;
1040
+ };
1041
+
1042
+ /**
1043
+ * Raw observation structure corresponding to the parsed Observation type
1044
+ */
1045
+ type OchreObservation = {
1046
+ observationNo: number;
1047
+ date?: string; // YYYY-MM-DD
1048
+ observers?: FakeString;
1049
+ notes?: { note: OchreNote | Array<OchreNote> };
1050
+ links?: OchreLink | Array<OchreLink>;
1051
+ properties?: { property: OchreProperty | Array<OchreProperty> };
1052
+ };
1053
+
1054
+ /**
1055
+ * Raw coordinates structure corresponding to the parsed Coordinates type
1056
+ */
1057
+ type OchreCoordinates = {
1058
+ latitude: number;
1059
+ longitude: number;
1060
+ coordinatesArray?: string;
1061
+ coord?: {
1062
+ coordLatitude: number;
1063
+ coordLongitude: number;
1064
+ coordType: string;
1065
+ coordLabel: FakeString;
1066
+ arrayString: string;
1067
+ uuid: string;
1068
+ };
1069
+ };
1070
+
1071
+ /**
1072
+ * Raw event structure corresponding to the parsed Event type
1073
+ */
1074
+ type OchreEvent = {
1075
+ dateTime?: string; // YYYY-MM-DD
1076
+ agent?: {
1077
+ uuid: string;
1078
+ content: FakeString;
1079
+ };
1080
+ label: OchreStringContent;
1081
+ };
1082
+
1083
+ /**
1084
+ * Raw interpretation structure corresponding to the parsed Interpretation type
1085
+ */
1086
+ type OchreInterpretation = {
1087
+ date: string; // YYYY-MM-DD
1088
+ interpretationNo: number;
1089
+ properties?: { property: OchreProperty | Array<OchreProperty> };
1090
+ };
1091
+
1092
+ /**
1093
+ * Fetches raw OCHRE data by UUID from the OCHRE API
1094
+ *
1095
+ * @param uuid - The UUID of the OCHRE item to fetch
1096
+ * @returns A tuple containing either [null, OchreData] on success or [error message, null] on failure
1097
+ *
1098
+ * @example
1099
+ * ```ts
1100
+ * const [error, data] = await fetchByUuid("123e4567-e89b-12d3-a456-426614174000");
1101
+ * if (error !== null) {
1102
+ * console.error(`Failed to fetch: ${error}`);
1103
+ * return;
1104
+ * }
1105
+ * // Process data...
1106
+ * ```
1107
+ *
1108
+ * @internal
1109
+ */
1110
+ declare function fetchByUuid(uuid: string): Promise<[null, OchreData] | [string, null]>;
1111
+
1112
+ /**
1113
+ * Fetches and parses a resource from the OCHRE API
1114
+ *
1115
+ * @param uuid - The UUID of the resource to fetch
1116
+ * @returns Object containing the parsed resource and its metadata, or null if the fetch/parse fails
1117
+ *
1118
+ * @example
1119
+ * ```ts
1120
+ * const result = await fetchResource("123e4567-e89b-12d3-a456-426614174000");
1121
+ * if (result === null) {
1122
+ * console.error("Failed to fetch resource");
1123
+ * return;
1124
+ * }
1125
+ * const { metadata, item } = result;
1126
+ * console.log(`Fetched resource: ${item.identification.label}`);
1127
+ * ```
1128
+ *
1129
+ * @remarks
1130
+ * The returned resource includes:
1131
+ * - Full resource metadata
1132
+ * - Associated documents and images
1133
+ * - Links and reverse links
1134
+ * - Creator information
1135
+ * - Notes and bibliographic references
1136
+ * - Properties and nested resources
1137
+ */
1138
+ declare function fetchResource(uuid: string): Promise<{
1139
+ metadata: Metadata;
1140
+ resource: Resource;
1141
+ } | null>;
1142
+
1143
+ /**
1144
+ * Fetches and parses a set from the OCHRE API
1145
+ *
1146
+ * @param uuid - The UUID of the set to fetch
1147
+ * @returns Object containing the parsed set and its metadata, or null if the fetch/parse fails
1148
+ *
1149
+ * @example
1150
+ * ```ts
1151
+ * const result = await fetchSet("123e4567-e89b-12d3-a456-426614174000");
1152
+ * if (result === null) {
1153
+ * console.error("Failed to fetch set");
1154
+ * return;
1155
+ * }
1156
+ * const { metadata, item } = result;
1157
+ * console.log(`Fetched set: ${item.identification.label}`);
1158
+ * console.log(`Contains ${item.items.resources.length.toLocaleString()} resources`);
1159
+ * ```
1160
+ *
1161
+ * @remarks
1162
+ * The returned set includes:
1163
+ * - Full set metadata
1164
+ * - Nested resources, spatial units, and concepts
1165
+ * - Creator information
1166
+ * - Description and type information
1167
+ * - License details
1168
+ */
1169
+ declare function fetchSet(uuid: string): Promise<{
1170
+ metadata: Metadata;
1171
+ set: Set;
1172
+ } | null>;
1173
+
1174
+ /**
1175
+ * Fetches and parses a spatial unit from the OCHRE API
1176
+ *
1177
+ * @param uuid - The UUID of the spatial unit to fetch
1178
+ * @returns Object containing the parsed spatial unit and its metadata, or null if the fetch/parse fails
1179
+ *
1180
+ * @example
1181
+ * ```ts
1182
+ * const result = await fetchSpatialUnit("123e4567-e89b-12d3-a456-426614174000");
1183
+ * if (result === null) {
1184
+ * console.error("Failed to fetch spatial unit");
1185
+ * return;
1186
+ * }
1187
+ * const { metadata, item } = result;
1188
+ * console.log(`Fetched spatial unit: ${item.identification.label}`);
1189
+ * if (item.coordinates) {
1190
+ * console.log(`Location: ${item.coordinates.latitude}, ${item.coordinates.longitude}`);
1191
+ * }
1192
+ * ```
1193
+ *
1194
+ * @remarks
1195
+ * The returned spatial unit includes:
1196
+ * - Full spatial unit metadata
1197
+ * - Geographic coordinates
1198
+ * - Observations and events
1199
+ * - Associated images
1200
+ * - Context information
1201
+ * - License details
1202
+ */
1203
+ declare function fetchSpatialUnit(uuid: string): Promise<{
1204
+ metadata: Metadata;
1205
+ spatialUnit: SpatialUnit;
1206
+ } | null>;
1207
+
1208
+ /**
1209
+ * Fetches and parses a tree from the OCHRE API
1210
+ *
1211
+ * @param uuid - The UUID of the tree to fetch
1212
+ * @returns Object containing the parsed tree and its metadata, or null if the fetch/parse fails
1213
+ *
1214
+ * @example
1215
+ * ```ts
1216
+ * const result = await fetchTree("123e4567-e89b-12d3-a456-426614174000");
1217
+ * if (result === null) {
1218
+ * console.error("Failed to fetch tree");
1219
+ * return;
1220
+ * }
1221
+ * const { metadata, item } = result;
1222
+ * console.log(`Fetched tree: ${item.identification.label}`);
1223
+ * console.log(`Contains ${item.items.resources.length} resources`);
1224
+ * ```
1225
+ *
1226
+ * @remarks
1227
+ * The returned tree includes:
1228
+ * - Full tree metadata
1229
+ * - Hierarchical structure of resources, spatial units, and concepts
1230
+ * - Creator information
1231
+ * - Properties and type information
1232
+ * - License details
1233
+ */
1234
+ declare function fetchTree(uuid: string): Promise<{
1235
+ metadata: Metadata;
1236
+ tree: Tree;
1237
+ } | null>;
1238
+
1239
+ /**
1240
+ * Fetches and parses a website configuration from the OCHRE API
1241
+ *
1242
+ * @param abbreviation - The abbreviation identifier for the website
1243
+ * @returns The parsed website configuration or null if the fetch/parse fails
1244
+ *
1245
+ * @example
1246
+ * ```ts
1247
+ * const website = await fetchWebsite("guerrilla-television");
1248
+ * if (website === null) {
1249
+ * console.error("Failed to fetch website");
1250
+ * return;
1251
+ * }
1252
+ * console.log(`Fetched website: ${website.identification.label}`);
1253
+ * console.log(`Contains ${website.pages.length.toLocaleString()} pages`);
1254
+ * ```
1255
+ *
1256
+ * @remarks
1257
+ * The returned website configuration includes:
1258
+ * - Website metadata and identification
1259
+ * - Page structure and content
1260
+ * - Layout and styling properties
1261
+ * - Navigation configuration
1262
+ * - Sidebar elements
1263
+ * - Project information
1264
+ * - Creator details
1265
+ *
1266
+ * The abbreviation is case-insensitive and should match the website's configured abbreviation in OCHRE.
1267
+ */
1268
+ declare function fetchWebsite(abbreviation: string): Promise<Website | null>;
1269
+
1270
+ /**
1271
+ * Options for property search operations
1272
+ */
1273
+ type PropertyOptions = {
1274
+ /** Whether to recursively search through nested properties */
1275
+ searchNestedProperties: boolean;
1276
+ };
1277
+ /**
1278
+ * Finds a property by its label in an array of properties
1279
+ *
1280
+ * @param properties - Array of properties to search through
1281
+ * @param label - The label to search for
1282
+ * @param options - Search options, including whether to search nested properties
1283
+ * @returns The matching Property object, or null if not found
1284
+ *
1285
+ * @example
1286
+ * ```ts
1287
+ * const property = getPropertyByLabel(properties, "author", { searchNestedProperties: true });
1288
+ * if (property) {
1289
+ * console.log(property.values);
1290
+ * }
1291
+ * ```
1292
+ */
1293
+ declare function getPropertyByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Property | null;
1294
+ /**
1295
+ * Retrieves all values for a property with the given label
1296
+ *
1297
+ * @param properties - Array of properties to search through
1298
+ * @param label - The label to search for
1299
+ * @param options - Search options, including whether to search nested properties
1300
+ * @returns Array of property values as strings, or null if property not found
1301
+ *
1302
+ * @example
1303
+ * ```ts
1304
+ * const values = getPropertyValuesByLabel(properties, "keywords");
1305
+ * if (values) {
1306
+ * for (const value of values) {
1307
+ * console.log(value);
1308
+ * }
1309
+ * }
1310
+ * ```
1311
+ */
1312
+ declare function getPropertyValuesByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Array<string> | null;
1313
+ /**
1314
+ * Gets the first value of a property with the given label
1315
+ *
1316
+ * @param properties - Array of properties to search through
1317
+ * @param label - The label to search for
1318
+ * @param options - Search options, including whether to search nested properties
1319
+ * @returns The first property value as string, or null if property not found
1320
+ *
1321
+ * @example
1322
+ * ```ts
1323
+ * const title = getPropertyValueByLabel(properties, "title");
1324
+ * if (title) {
1325
+ * console.log(`Document title: ${title}`);
1326
+ * }
1327
+ * ```
1328
+ */
1329
+ declare function getPropertyValueByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): string | null;
1330
+ /**
1331
+ * Gets all unique property labels from an array of properties
1332
+ *
1333
+ * @param properties - Array of properties to get labels from
1334
+ * @param options - Search options, including whether to include nested property labels
1335
+ * @returns Array of unique property labels
1336
+ *
1337
+ * @example
1338
+ * ```ts
1339
+ * const labels = getAllPropertyLabels(properties, { searchNestedProperties: true });
1340
+ * console.log(`Available properties: ${labels.join(", ")}`);
1341
+ * ```
1342
+ */
1343
+ declare function getAllPropertyLabels(properties: Array<Property>, options?: PropertyOptions): Array<string>;
1344
+ /**
1345
+ * Filters a property based on a label and value criteria
1346
+ *
1347
+ * @param property - The property to filter
1348
+ * @param filter - Filter criteria containing label and value to match
1349
+ * @param filter.label - The label to filter by
1350
+ * @param filter.value - The value to filter by
1351
+ * @param options - Search options, including whether to search nested properties
1352
+ * @returns True if the property matches the filter criteria, false otherwise
1353
+ *
1354
+ * @example
1355
+ * ```ts
1356
+ * const matches = filterProperties(property, {
1357
+ * label: "category",
1358
+ * value: "book"
1359
+ * });
1360
+ * if (matches) {
1361
+ * console.log("Property matches filter criteria");
1362
+ * }
1363
+ * ```
1364
+ */
1365
+ declare function filterProperties(property: Property, filter: {
1366
+ label: string;
1367
+ value: string;
1368
+ }, options?: PropertyOptions): boolean;
1369
+
1370
+ /**
1371
+ * Parses raw identification data into the standardized Identification type
1372
+ *
1373
+ * @param identification - Raw identification data from OCHRE format
1374
+ * @returns Parsed Identification object with label and abbreviation
1375
+ */
1376
+ declare function parseIdentification(identification: OchreIdentification): Identification;
1377
+ /**
1378
+ * Parses raw language data into an array of language codes
1379
+ *
1380
+ * @param language - Raw language data, either single or array
1381
+ * @returns Array of language codes as strings
1382
+ */
1383
+ declare function parseLanguages(language: OchreLanguage | Array<OchreLanguage>): Array<string>;
1384
+ /**
1385
+ * Parses raw metadata into the standardized Metadata type
1386
+ *
1387
+ * @param metadata - Raw metadata from OCHRE format
1388
+ * @returns Parsed Metadata object
1389
+ */
1390
+ declare function parseMetadata(metadata: OchreMetadata): Metadata;
1391
+ /**
1392
+ * Parses raw context data into the standardized Context type
1393
+ *
1394
+ * @param context - Raw context data from OCHRE format
1395
+ * @returns Parsed Context object
1396
+ */
1397
+ declare function parseContext(context: OchreContext): Context;
1398
+ /**
1399
+ * Parses raw license data into the standardized License type
1400
+ *
1401
+ * @param license - Raw license data from OCHRE format
1402
+ * @returns Parsed License object or null if invalid
1403
+ */
1404
+ declare function parseLicense(license: OchreLicense): License | null;
1405
+ /**
1406
+ * Parses raw person data into the standardized Person type
1407
+ *
1408
+ * @param persons - Raw person data from OCHRE format
1409
+ * @returns Array of parsed Person objects
1410
+ */
1411
+ declare function parsePersons(persons: Array<OchrePerson>): Array<Person>;
1412
+ /**
1413
+ * Parses an array of raw links into standardized Link objects
1414
+ *
1415
+ * @param linkRaw - Raw OCHRE link
1416
+ * @returns Parsed Link object
1417
+ */
1418
+ declare function parseLink(linkRaw: OchreLink): Array<Link>;
1419
+ /**
1420
+ * Parses an array of raw links into standardized Link objects
1421
+ *
1422
+ * @param links - Array of raw OCHRE links
1423
+ * @returns Array of parsed Link objects
1424
+ */
1425
+ declare function parseLinks(links: Array<OchreLink>): Array<Link>;
1426
+ /**
1427
+ * Parses raw document content into a standardized Document structure
1428
+ *
1429
+ * @param document - Raw document content in OCHRE format
1430
+ * @param language - Language code to use for content selection (defaults to "eng")
1431
+ * @returns Parsed Document object with content and footnotes
1432
+ */
1433
+ declare function parseDocument(document: OchreStringRichText | Array<OchreStringRichText>, language?: string): Document;
1434
+ /**
1435
+ * Parses raw image data into a standardized Image structure
1436
+ *
1437
+ * @param image - Raw image data in OCHRE format
1438
+ * @returns Parsed Image object or null if invalid
1439
+ */
1440
+ declare function parseImage(image: OchreImage): Image | null;
1441
+ /**
1442
+ * Parses raw notes into standardized Note objects
1443
+ *
1444
+ * @param notes - Array of raw notes in OCHRE format
1445
+ * @param language - Language code for content selection (defaults to "eng")
1446
+ * @returns Array of parsed Note objects
1447
+ */
1448
+ declare function parseNotes(notes: Array<OchreNote>, language?: string): Array<Note>;
1449
+ /**
1450
+ * Parses raw coordinates data into a standardized Coordinates structure
1451
+ *
1452
+ * @param coordinates - Raw coordinates data in OCHRE format
1453
+ * @returns Parsed Coordinates object
1454
+ */
1455
+ declare function parseCoordinates(coordinates: OchreCoordinates): Coordinates;
1456
+ /**
1457
+ * Parses a raw observation into a standardized Observation structure
1458
+ *
1459
+ * @param observation - Raw observation data in OCHRE format
1460
+ * @returns Parsed Observation object
1461
+ */
1462
+ declare function parseObservation(observation: OchreObservation): Observation;
1463
+ /**
1464
+ * Parses an array of raw observations into standardized Observation objects
1465
+ *
1466
+ * @param observations - Array of raw observations in OCHRE format
1467
+ * @returns Array of parsed Observation objects
1468
+ */
1469
+ declare function parseObservations(observations: Array<OchreObservation>): Array<Observation>;
1470
+ /**
1471
+ * Parses an array of raw events into standardized Event objects
1472
+ *
1473
+ * @param events - Array of raw events in OCHRE format
1474
+ * @returns Array of parsed Event objects
1475
+ */
1476
+ declare function parseEvents(events: Array<OchreEvent>): Array<Event>;
1477
+ /**
1478
+ * Parses raw properties into standardized Property objects
1479
+ *
1480
+ * @param properties - Array of raw properties in OCHRE format
1481
+ * @param language - Language code for content selection (defaults to "eng")
1482
+ * @returns Array of parsed Property objects
1483
+ */
1484
+ declare function parseProperties(properties: Array<OchreProperty>, language?: string): Array<Property>;
1485
+ /**
1486
+ * Parses raw interpretations into standardized Interpretation objects
1487
+ *
1488
+ * @param interpretations - Array of raw interpretations in OCHRE format
1489
+ * @returns Array of parsed Interpretation objects
1490
+ */
1491
+ declare function parseInterpretations(interpretations: Array<OchreInterpretation>): Array<Interpretation>;
1492
+ /**
1493
+ * Parses raw image map data into a standardized ImageMap structure
1494
+ *
1495
+ * @param imageMap - Raw image map data in OCHRE format
1496
+ * @returns Parsed ImageMap object
1497
+ */
1498
+ declare function parseImageMap(imageMap: OchreImageMap): ImageMap;
1499
+ /**
1500
+ * Parses raw period data into a standardized Period structure
1501
+ *
1502
+ * @param period - Raw period data in OCHRE format
1503
+ * @returns Parsed Period object
1504
+ */
1505
+ declare function parsePeriod(period: OchrePeriod): Period;
1506
+ /**
1507
+ * Parses an array of raw periods into standardized Period objects
1508
+ *
1509
+ * @param periods - Array of raw periods in OCHRE format
1510
+ * @returns Array of parsed Period objects
1511
+ */
1512
+ declare function parsePeriods(periods: Array<OchrePeriod>): Array<Period>;
1513
+ /**
1514
+ * Parses raw bibliography data into a standardized Bibliography structure
1515
+ *
1516
+ * @param bibliography - Raw bibliography data in OCHRE format
1517
+ * @returns Parsed Bibliography object
1518
+ */
1519
+ declare function parseBibliography(bibliography: OchreBibliography): Bibliography;
1520
+ /**
1521
+ * Parses an array of raw bibliographies into standardized Bibliography objects
1522
+ *
1523
+ * @param bibliographies - Array of raw bibliographies in OCHRE format
1524
+ * @returns Array of parsed Bibliography objects
1525
+ */
1526
+ declare function parseBibliographies(bibliographies: Array<OchreBibliography>): Array<Bibliography>;
1527
+ /**
1528
+ * Parses a raw tree structure into a standardized Tree object
1529
+ *
1530
+ * @param tree - Raw tree data in OCHRE format
1531
+ * @returns Parsed Tree object or null if invalid
1532
+ */
1533
+ declare function parseTree(tree: OchreTree): Tree | null;
1534
+ /**
1535
+ * Parses raw set data into a standardized Set structure
1536
+ *
1537
+ * @param set - Raw set data in OCHRE format
1538
+ * @returns Parsed Set object
1539
+ */
1540
+ declare function parseSet(set: OchreSet): Set;
1541
+ /**
1542
+ * Parses raw resource data into a standardized Resource structure
1543
+ *
1544
+ * @param resource - Raw resource data in OCHRE format
1545
+ * @returns Parsed Resource object
1546
+ */
1547
+ declare function parseResource(resource: OchreResource | OchreNestedResource, isNested?: boolean): Resource | NestedResource;
1548
+ /**
1549
+ * Parses raw resource data into a standardized Resource structure
1550
+ *
1551
+ * @param resources - Raw resource data in OCHRE format
1552
+ * @returns Parsed Resource object
1553
+ */
1554
+ declare function parseResources(resources: Array<OchreResource> | Array<OchreNestedResource>, isNested?: boolean): Array<Resource> | Array<NestedResource>;
1555
+ /**
1556
+ * Parses raw spatial units into standardized SpatialUnit or NestedSpatialUnit objects
1557
+ *
1558
+ * @param spatialUnit - Raw spatial unit in OCHRE format
1559
+ * @param isNested - Whether to parse as nested spatial units
1560
+ * @returns Parsed SpatialUnit or NestedSpatialUnit object
1561
+ */
1562
+ declare function parseSpatialUnit(spatialUnit: OchreSpatialUnit | OchreNestedSpatialUnit, isNested?: boolean): SpatialUnit | NestedSpatialUnit;
1563
+ /**
1564
+ * Parses an array of raw spatial units into standardized SpatialUnit or NestedSpatialUnit objects
1565
+ *
1566
+ * @param spatialUnits - Array of raw spatial units in OCHRE format
1567
+ * @param isNested - Whether to parse as nested spatial units
1568
+ * @returns Array of parsed SpatialUnit or NestedSpatialUnit objects
1569
+ */
1570
+ declare function parseSpatialUnits<T extends boolean>(spatialUnits: Array<T extends true ? OchreNestedSpatialUnit : OchreSpatialUnit>, isNested?: T): Array<T extends true ? NestedSpatialUnit : SpatialUnit>;
1571
+ /**
1572
+ * Parses a raw concept into a standardized Concept or NestedConcept object
1573
+ *
1574
+ * @param concept - Raw concept data in OCHRE format
1575
+ * @param isNested - Whether to parse as a nested concept
1576
+ * @returns Parsed Concept or NestedConcept object
1577
+ */
1578
+ declare function parseConcept(concept: OchreConcept | OchreNestedConcept, isNested?: boolean): Concept | NestedConcept;
1579
+ /**
1580
+ * Parses raw concept data into standardized Concept or NestedConcept objects
1581
+ *
1582
+ * @param concepts - Array of raw concept data in OCHRE format
1583
+ * @param isNested - Whether to parse as nested concepts
1584
+ * @returns Array of parsed Concept or NestedConcept objects
1585
+ */
1586
+ declare function parseConcepts(concepts: Array<OchreConcept> | Array<OchreNestedConcept>, isNested?: boolean): Array<Concept> | Array<NestedConcept>;
1587
+ declare function parseWebsite(websiteTree: OchreTree, projectName: FakeString, website: FakeString | null): Promise<Website>;
1588
+
1589
+ /**
1590
+ * Parses email addresses and URLs in a string into HTML links
1591
+ *
1592
+ * @param string - Input string to parse
1593
+ * @returns String with emails and URLs converted to HTML links
1594
+ *
1595
+ * @example
1596
+ * ```ts
1597
+ * const parsed = parseEmailAndUrl("Contact us at info@example.com or visit www.example.com");
1598
+ * // Returns: "Contact us at <ExternalLink href="mailto:info@example.com">info@example.com</ExternalLink>
1599
+ * // or visit <ExternalLink href="www.example.com">www.example.com</ExternalLink>"
1600
+ * ```
1601
+ */
1602
+ declare function parseEmailAndUrl(string: string): string;
1603
+ /**
1604
+ * Converts a FakeString (string|number|boolean) to a proper string
1605
+ *
1606
+ * @param string - FakeString value to convert
1607
+ * @returns Converted string value
1608
+ *
1609
+ * @example
1610
+ * ```ts
1611
+ * parseFakeString(true); // Returns "Yes"
1612
+ * parseFakeString(123); // Returns "123"
1613
+ * parseFakeString("test"); // Returns "test"
1614
+ * ```
1615
+ */
1616
+ declare function parseFakeString(string: FakeString): string;
1617
+ /**
1618
+ * Parses an OchreStringItem into a formatted string
1619
+ *
1620
+ * @param item - OchreStringItem to parse
1621
+ * @returns Formatted string with applied rendering and whitespace
1622
+ */
1623
+ declare function parseStringItem(item: OchreStringItem): string;
1624
+ /**
1625
+ * Parses rich text content into a formatted string with links and annotations
1626
+ *
1627
+ * @param item - Rich text item to parse
1628
+ * @param footnotes - Optional array to collect footnotes during parsing
1629
+ * @returns Formatted string with HTML/markdown elements
1630
+ */
1631
+ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnotes?: Array<Footnote>): string;
1632
+ /**
1633
+ * Removes trailing line breaks from a string
1634
+ *
1635
+ * @param string - Input string to trim
1636
+ * @returns String with trailing line breaks removed
1637
+ *
1638
+ * @example
1639
+ * ```ts
1640
+ * const trimmed = trimEndLineBreaks("Hello\n<br />\n<br />");
1641
+ * // Returns: "Hello"
1642
+ * ```
1643
+ */
1644
+ declare function trimEndLineBreaks(string: string): string;
1645
+ /**
1646
+ * Parses raw string content into a formatted string
1647
+ *
1648
+ * @param content - Raw string content to parse
1649
+ * @param language - Optional language code for content selection (defaults to "eng")
1650
+ * @returns Parsed and formatted string
1651
+ */
1652
+ declare function parseStringContent(content: OchreStringContent, language?: string): string;
1653
+
1654
+ export { type Bibliography, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchByUuid, fetchConcept, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite, trimEndLineBreaks };