@digitalculture/ochre-sdk 0.1.20 → 0.1.22

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