@digitalculture/ochre-sdk 0.5.18 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +465 -689
- package/dist/index.d.cts +59 -362
- package/dist/index.d.ts +59 -362
- package/dist/index.js +464 -679
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { Language } from 'iso-639-3';
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents the core data structure containing item information and metadata
|
|
5
5
|
*/
|
|
6
|
-
type Data = {
|
|
6
|
+
type Data<T extends DataCategory> = {
|
|
7
7
|
uuid: string;
|
|
8
8
|
belongsTo: {
|
|
9
9
|
uuid: string;
|
|
@@ -11,8 +11,9 @@ type Data = {
|
|
|
11
11
|
};
|
|
12
12
|
publicationDateTime: Date;
|
|
13
13
|
metadata: Metadata;
|
|
14
|
-
item: Tree | Set | Resource | SpatialUnit | Concept | Period | Bibliography | Person | PropertyValue;
|
|
14
|
+
item: Tree | Set<T> | Resource | SpatialUnit | Concept | Period | Bibliography | Person | PropertyValue;
|
|
15
15
|
};
|
|
16
|
+
type DataCategory = "tree" | "set" | "resource" | "spatialUnit" | "concept" | "period" | "bibliography" | "person" | "propertyValue";
|
|
16
17
|
/**
|
|
17
18
|
* Basic identification information used across multiple types
|
|
18
19
|
*/
|
|
@@ -199,10 +200,6 @@ type Footnote = {
|
|
|
199
200
|
label: string;
|
|
200
201
|
content: string;
|
|
201
202
|
};
|
|
202
|
-
/**
|
|
203
|
-
* Represents the type of a resource
|
|
204
|
-
*/
|
|
205
|
-
type ResourceType = "audio" | "document" | "drawing" | "FITS" | "geospatial" | "IIIF" | "image" | "model" | "PTM" | "TEI" | "video" | "webpage";
|
|
206
203
|
/**
|
|
207
204
|
* Represents a resource item with associated metadata, content and relationships
|
|
208
205
|
*/
|
|
@@ -210,7 +207,7 @@ type Resource = {
|
|
|
210
207
|
uuid: string;
|
|
211
208
|
category: "resource";
|
|
212
209
|
publicationDateTime: Date | null;
|
|
213
|
-
type:
|
|
210
|
+
type: string;
|
|
214
211
|
number: number;
|
|
215
212
|
context: Context | null;
|
|
216
213
|
license: License | null;
|
|
@@ -230,12 +227,8 @@ type Resource = {
|
|
|
230
227
|
reverseLinks: Array<Link>;
|
|
231
228
|
properties: Array<Property>;
|
|
232
229
|
citedBibliographies: Array<Bibliography>;
|
|
233
|
-
resources: Array<
|
|
230
|
+
resources: Array<Resource>;
|
|
234
231
|
};
|
|
235
|
-
/**
|
|
236
|
-
* A nested version of Resource type without certain metadata fields
|
|
237
|
-
*/
|
|
238
|
-
type NestedResource = Omit<Resource, "publicationDateTime" | "license" | "copyright">;
|
|
239
232
|
/**
|
|
240
233
|
* Represents a spatial unit with geographic coordinates and observations
|
|
241
234
|
*/
|
|
@@ -253,11 +246,6 @@ type SpatialUnit = {
|
|
|
253
246
|
coordinates: Coordinates | null;
|
|
254
247
|
observations: Array<Observation>;
|
|
255
248
|
events: Array<Event>;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* A nested version of SpatialUnit type without certain metadata fields
|
|
259
|
-
*/
|
|
260
|
-
type NestedSpatialUnit = Omit<SpatialUnit, "publicationDateTime" | "license" | "observations" | "events"> & {
|
|
261
249
|
properties: Array<Property>;
|
|
262
250
|
};
|
|
263
251
|
/**
|
|
@@ -273,16 +261,13 @@ type Concept = {
|
|
|
273
261
|
identification: Identification;
|
|
274
262
|
interpretations: Array<Interpretation>;
|
|
275
263
|
};
|
|
276
|
-
/**
|
|
277
|
-
* A nested version of Concept type without certain metadata fields
|
|
278
|
-
*/
|
|
279
|
-
type NestedConcept = Omit<Concept, "publicationDateTime" | "license">;
|
|
280
264
|
/**
|
|
281
265
|
* Represents a set that can contain resources, spatial units and concepts
|
|
282
266
|
*/
|
|
283
|
-
type Set = {
|
|
267
|
+
type Set<T extends DataCategory> = {
|
|
284
268
|
uuid: string;
|
|
285
269
|
category: "set";
|
|
270
|
+
itemCategory: T;
|
|
286
271
|
publicationDateTime: Date | null;
|
|
287
272
|
type: string;
|
|
288
273
|
number: number;
|
|
@@ -292,15 +277,7 @@ type Set = {
|
|
|
292
277
|
isSuppressingBlanks: boolean;
|
|
293
278
|
description: string;
|
|
294
279
|
creators: Array<Person>;
|
|
295
|
-
items:
|
|
296
|
-
resources: Array<NestedResource>;
|
|
297
|
-
spatialUnits: Array<NestedSpatialUnit>;
|
|
298
|
-
concepts: Array<NestedConcept>;
|
|
299
|
-
periods: Array<Period>;
|
|
300
|
-
bibliographies: Array<Bibliography>;
|
|
301
|
-
persons: Array<Person>;
|
|
302
|
-
propertyValues: Array<PropertyValue>;
|
|
303
|
-
};
|
|
280
|
+
items: T extends "resource" ? Array<Resource> : T extends "spatialUnit" ? Array<SpatialUnit> : T extends "concept" ? Array<Concept> : T extends "period" ? Array<Period> : T extends "bibliography" ? Array<Bibliography> : T extends "person" ? Array<Person> : T extends "propertyValue" ? Array<PropertyValue> : never;
|
|
304
281
|
};
|
|
305
282
|
/**
|
|
306
283
|
* Represents a bibliography entry with citation and publication information
|
|
@@ -643,92 +620,54 @@ type WebBlock = {
|
|
|
643
620
|
};
|
|
644
621
|
|
|
645
622
|
/**
|
|
646
|
-
* Fetches and parses
|
|
623
|
+
* Fetches and parses an OCHRE item from the OCHRE API
|
|
647
624
|
*
|
|
648
|
-
* @param uuid - The UUID of the
|
|
649
|
-
* @returns Object containing the parsed
|
|
625
|
+
* @param uuid - The UUID of the OCHRE item to fetch
|
|
626
|
+
* @returns Object containing the parsed OCHRE item and its metadata, or null if the fetch/parse fails
|
|
650
627
|
*
|
|
651
628
|
* @example
|
|
652
629
|
* ```ts
|
|
653
|
-
* const result = await
|
|
630
|
+
* const result = await fetchItem("123e4567-e89b-12d3-a456-426614174000");
|
|
654
631
|
* if (result === null) {
|
|
655
|
-
* console.error("Failed to fetch
|
|
632
|
+
* console.error("Failed to fetch OCHRE item");
|
|
656
633
|
* return;
|
|
657
634
|
* }
|
|
658
|
-
* const { metadata, item } = result;
|
|
659
|
-
* console.log(`Fetched
|
|
635
|
+
* const { metadata, belongsTo, item, category } = result;
|
|
636
|
+
* console.log(`Fetched OCHRE item: ${item.identification.label} with category ${category}`);
|
|
660
637
|
* ```
|
|
661
638
|
*
|
|
662
|
-
*
|
|
663
|
-
* The returned bibliography includes:
|
|
664
|
-
* - Full bibliography metadata
|
|
665
|
-
* - Citation and reference information
|
|
666
|
-
* - Publication information
|
|
667
|
-
* - Source information
|
|
668
|
-
* - Author information
|
|
669
|
-
* - Properties
|
|
670
|
-
*/
|
|
671
|
-
declare function fetchBibliography(uuid: string): Promise<{
|
|
672
|
-
metadata: Metadata;
|
|
673
|
-
bibliography: Bibliography;
|
|
674
|
-
} | null>;
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* Fetches and parses a concept from the OCHRE API
|
|
678
|
-
*
|
|
679
|
-
* @param uuid - The UUID of the concept to fetch
|
|
680
|
-
* @returns Object containing the parsed concept and its metadata, or null if the fetch/parse fails
|
|
681
|
-
*
|
|
682
|
-
* @example
|
|
639
|
+
* Or, if you want to fetch a specific category, you can do so by passing the category as an argument:
|
|
683
640
|
* ```ts
|
|
684
|
-
* const result = await
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
* return;
|
|
688
|
-
* }
|
|
689
|
-
* const { metadata, item } = result;
|
|
690
|
-
* console.log(`Fetched concept: ${item.identification.label}`);
|
|
641
|
+
* const result = await fetchItem("123e4567-e89b-12d3-a456-426614174000", "resource");
|
|
642
|
+
* const { metadata, belongsTo, item, category } = result;
|
|
643
|
+
* console.log(item.category); // "resource"
|
|
691
644
|
* ```
|
|
692
645
|
*
|
|
693
646
|
* @remarks
|
|
694
|
-
* The returned
|
|
695
|
-
* -
|
|
696
|
-
* -
|
|
697
|
-
* -
|
|
698
|
-
* -
|
|
699
|
-
*/
|
|
700
|
-
declare function fetchConcept(uuid: string): Promise<{
|
|
701
|
-
metadata: Metadata;
|
|
702
|
-
concept: Concept;
|
|
703
|
-
} | null>;
|
|
704
|
-
|
|
705
|
-
/**
|
|
706
|
-
* Fetches and parses a gallery from the OCHRE API
|
|
647
|
+
* The returned OCHRE item includes:
|
|
648
|
+
* - Item metadata
|
|
649
|
+
* - Item belongsTo information
|
|
650
|
+
* - Item content
|
|
651
|
+
* - Item category
|
|
707
652
|
*
|
|
708
|
-
*
|
|
709
|
-
* @param filter - The filter to apply to the gallery
|
|
710
|
-
* @param page - The page number to fetch
|
|
711
|
-
* @param perPage - The number of items per page
|
|
712
|
-
* @returns The parsed gallery or null if the fetch/parse fails
|
|
713
|
-
*
|
|
714
|
-
* @example
|
|
715
|
-
* ```ts
|
|
716
|
-
* const gallery = await fetchGallery("9c4da06b-f15e-40af-a747-0933eaf3587e", "1978", 1, 12);
|
|
717
|
-
* if (gallery === null) {
|
|
718
|
-
* console.error("Failed to fetch gallery");
|
|
719
|
-
* return;
|
|
720
|
-
* }
|
|
721
|
-
* console.log(`Fetched gallery: ${gallery.identification.label}`);
|
|
722
|
-
* console.log(`Contains ${gallery.resources.length.toLocaleString()} resources`);
|
|
723
|
-
* ```
|
|
724
|
-
*
|
|
725
|
-
* @remarks
|
|
726
|
-
* The returned gallery includes:
|
|
727
|
-
* - Gallery metadata and identification
|
|
728
|
-
* - Project identification
|
|
729
|
-
* - Resources (gallery items)
|
|
653
|
+
* If the fetch/parse fails, the returned object will have an `error` property.
|
|
730
654
|
*/
|
|
731
|
-
declare function
|
|
655
|
+
declare function fetchItem<T extends DataCategory, U extends DataCategory>(uuid: string, category?: T): Promise<{
|
|
656
|
+
error: null;
|
|
657
|
+
metadata: Metadata;
|
|
658
|
+
belongsTo: {
|
|
659
|
+
uuid: string;
|
|
660
|
+
abbreviation: string;
|
|
661
|
+
};
|
|
662
|
+
item: T extends "resource" ? Resource : T extends "spatialUnit" ? SpatialUnit : T extends "concept" ? Concept : T extends "period" ? Period : T extends "bibliography" ? Bibliography : T extends "person" ? Person : T extends "propertyValue" ? PropertyValue : T extends "set" ? Set<U> : T extends "tree" ? Tree : never;
|
|
663
|
+
category: T;
|
|
664
|
+
} | {
|
|
665
|
+
error: string;
|
|
666
|
+
metadata: never;
|
|
667
|
+
belongsTo: never;
|
|
668
|
+
item: never;
|
|
669
|
+
category: never;
|
|
670
|
+
}>;
|
|
732
671
|
|
|
733
672
|
/**
|
|
734
673
|
* Raw string value that can be a string, number, or boolean
|
|
@@ -935,17 +874,9 @@ type OchreResource = {
|
|
|
935
874
|
citedBibliography?: {
|
|
936
875
|
reference: OchreBibliography | Array<OchreBibliography>;
|
|
937
876
|
};
|
|
938
|
-
resource?:
|
|
877
|
+
resource?: OchreResource | Array<OchreResource>;
|
|
939
878
|
};
|
|
940
879
|
|
|
941
|
-
/**
|
|
942
|
-
* Raw nested resource structure corresponding to the parsed NestedResource type
|
|
943
|
-
*/
|
|
944
|
-
type OchreNestedResource = Omit<
|
|
945
|
-
OchreResource,
|
|
946
|
-
"context" | "availability" | "copyright"
|
|
947
|
-
>;
|
|
948
|
-
|
|
949
880
|
/**
|
|
950
881
|
* Raw spatial unit structure corresponding to the parsed SpatialUnit type
|
|
951
882
|
*/
|
|
@@ -963,15 +894,6 @@ type OchreSpatialUnit = {
|
|
|
963
894
|
events?: { event: OchreEvent | Array<OchreEvent> };
|
|
964
895
|
observations?: { observation: OchreObservation | Array<OchreObservation> };
|
|
965
896
|
observation?: OchreObservation;
|
|
966
|
-
};
|
|
967
|
-
|
|
968
|
-
/**
|
|
969
|
-
* Raw nested spatial unit structure corresponding to the parsed NestedSpatialUnit type
|
|
970
|
-
*/
|
|
971
|
-
type OchreNestedSpatialUnit = Omit<
|
|
972
|
-
OchreSpatialUnit,
|
|
973
|
-
"context" | "availability" | "observations" | "events"
|
|
974
|
-
> & {
|
|
975
897
|
properties?: { property: OchreProperty | Array<OchreProperty> };
|
|
976
898
|
};
|
|
977
899
|
|
|
@@ -990,11 +912,6 @@ type OchreConcept = {
|
|
|
990
912
|
};
|
|
991
913
|
};
|
|
992
914
|
|
|
993
|
-
/**
|
|
994
|
-
* Raw nested concept structure corresponding to the parsed NestedConcept type
|
|
995
|
-
*/
|
|
996
|
-
type OchreNestedConcept = Omit<OchreConcept, "context" | "availability">;
|
|
997
|
-
|
|
998
915
|
/**
|
|
999
916
|
* Raw property value structure corresponding to the parsed PropertyValue type
|
|
1000
917
|
*/
|
|
@@ -1339,222 +1256,6 @@ type OchrePropertyValue = {
|
|
|
1339
1256
|
*/
|
|
1340
1257
|
declare function fetchByUuid(uuid: string): Promise<[null, OchreData] | [string, null]>;
|
|
1341
1258
|
|
|
1342
|
-
/**
|
|
1343
|
-
* Fetches and parses a period from the OCHRE API
|
|
1344
|
-
*
|
|
1345
|
-
* @param uuid - The UUID of the period to fetch
|
|
1346
|
-
* @returns Object containing the parsed period and its metadata, or null if the fetch/parse fails
|
|
1347
|
-
*
|
|
1348
|
-
* @example
|
|
1349
|
-
* ```ts
|
|
1350
|
-
* const result = await fetchPeriod("123e4567-e89b-12d3-a456-426614174000");
|
|
1351
|
-
* if (result === null) {
|
|
1352
|
-
* console.error("Failed to fetch period");
|
|
1353
|
-
* return;
|
|
1354
|
-
* }
|
|
1355
|
-
* const { metadata, item } = result;
|
|
1356
|
-
* console.log(`Fetched period: ${item.identification.label}`);
|
|
1357
|
-
* ```
|
|
1358
|
-
*
|
|
1359
|
-
* @remarks
|
|
1360
|
-
* The returned period includes:
|
|
1361
|
-
* - Full period metadata
|
|
1362
|
-
* - Identification information
|
|
1363
|
-
* - Description
|
|
1364
|
-
* - Properties
|
|
1365
|
-
*/
|
|
1366
|
-
declare function fetchPeriod(uuid: string): Promise<{
|
|
1367
|
-
metadata: Metadata;
|
|
1368
|
-
period: Period;
|
|
1369
|
-
} | null>;
|
|
1370
|
-
|
|
1371
|
-
/**
|
|
1372
|
-
* Fetches and parses a property value from the OCHRE API
|
|
1373
|
-
*
|
|
1374
|
-
* @param uuid - The UUID of the property value to fetch
|
|
1375
|
-
* @returns Object containing the parsed property value and its metadata, or null if the fetch/parse fails
|
|
1376
|
-
*
|
|
1377
|
-
* @example
|
|
1378
|
-
* ```ts
|
|
1379
|
-
* const result = await fetchPropertyValue("123e4567-e89b-12d3-a456-426614174000");
|
|
1380
|
-
* if (result === null) {
|
|
1381
|
-
* console.error("Failed to fetch property value");
|
|
1382
|
-
* return;
|
|
1383
|
-
* }
|
|
1384
|
-
* const { metadata, item } = result;
|
|
1385
|
-
* console.log(`Fetched property value: ${item.identification.label}`);
|
|
1386
|
-
* ```
|
|
1387
|
-
*
|
|
1388
|
-
* @remarks
|
|
1389
|
-
* The returned property value includes:
|
|
1390
|
-
* - Identification
|
|
1391
|
-
* - Description
|
|
1392
|
-
* - Notes
|
|
1393
|
-
* - Links
|
|
1394
|
-
*/
|
|
1395
|
-
declare function fetchPropertyValue(uuid: string): Promise<{
|
|
1396
|
-
metadata: Metadata;
|
|
1397
|
-
propertyValue: PropertyValue;
|
|
1398
|
-
} | null>;
|
|
1399
|
-
|
|
1400
|
-
/**
|
|
1401
|
-
* Fetches and parses a resource from the OCHRE API
|
|
1402
|
-
*
|
|
1403
|
-
* @param uuid - The UUID of the resource to fetch
|
|
1404
|
-
* @returns Object containing the parsed resource and its metadata, or null if the fetch/parse fails
|
|
1405
|
-
*
|
|
1406
|
-
* @example
|
|
1407
|
-
* ```ts
|
|
1408
|
-
* const result = await fetchResource("123e4567-e89b-12d3-a456-426614174000");
|
|
1409
|
-
* if (result === null) {
|
|
1410
|
-
* console.error("Failed to fetch resource");
|
|
1411
|
-
* return;
|
|
1412
|
-
* }
|
|
1413
|
-
* const { metadata, item } = result;
|
|
1414
|
-
* console.log(`Fetched resource: ${item.identification.label}`);
|
|
1415
|
-
* ```
|
|
1416
|
-
*
|
|
1417
|
-
* @remarks
|
|
1418
|
-
* The returned resource includes:
|
|
1419
|
-
* - Full resource metadata
|
|
1420
|
-
* - Associated documents and images
|
|
1421
|
-
* - Links and reverse links
|
|
1422
|
-
* - Creator information
|
|
1423
|
-
* - Notes and bibliographic references
|
|
1424
|
-
* - Properties and nested resources
|
|
1425
|
-
*/
|
|
1426
|
-
declare function fetchResource(uuid: string): Promise<{
|
|
1427
|
-
metadata: Metadata;
|
|
1428
|
-
resource: Resource;
|
|
1429
|
-
} | null>;
|
|
1430
|
-
|
|
1431
|
-
/**
|
|
1432
|
-
* Fetches and parses a set from the OCHRE API
|
|
1433
|
-
*
|
|
1434
|
-
* @param uuid - The UUID of the set to fetch
|
|
1435
|
-
* @returns Object containing the parsed set and its metadata, or null if the fetch/parse fails
|
|
1436
|
-
*
|
|
1437
|
-
* @example
|
|
1438
|
-
* ```ts
|
|
1439
|
-
* const result = await fetchSet("123e4567-e89b-12d3-a456-426614174000");
|
|
1440
|
-
* if (result === null) {
|
|
1441
|
-
* console.error("Failed to fetch set");
|
|
1442
|
-
* return;
|
|
1443
|
-
* }
|
|
1444
|
-
* const { metadata, item } = result;
|
|
1445
|
-
* console.log(`Fetched set: ${item.identification.label}`);
|
|
1446
|
-
* console.log(`Contains ${item.items.resources.length.toLocaleString()} resources`);
|
|
1447
|
-
* ```
|
|
1448
|
-
*
|
|
1449
|
-
* @remarks
|
|
1450
|
-
* The returned set includes:
|
|
1451
|
-
* - Full set metadata
|
|
1452
|
-
* - Nested resources, spatial units, and concepts
|
|
1453
|
-
* - Creator information
|
|
1454
|
-
* - Description and type information
|
|
1455
|
-
* - License details
|
|
1456
|
-
*/
|
|
1457
|
-
declare function fetchSet(uuid: string): Promise<{
|
|
1458
|
-
metadata: Metadata;
|
|
1459
|
-
set: Set;
|
|
1460
|
-
} | null>;
|
|
1461
|
-
|
|
1462
|
-
/**
|
|
1463
|
-
* Fetches and parses a spatial unit from the OCHRE API
|
|
1464
|
-
*
|
|
1465
|
-
* @param uuid - The UUID of the spatial unit to fetch
|
|
1466
|
-
* @returns Object containing the parsed spatial unit and its metadata, or null if the fetch/parse fails
|
|
1467
|
-
*
|
|
1468
|
-
* @example
|
|
1469
|
-
* ```ts
|
|
1470
|
-
* const result = await fetchSpatialUnit("123e4567-e89b-12d3-a456-426614174000");
|
|
1471
|
-
* if (result === null) {
|
|
1472
|
-
* console.error("Failed to fetch spatial unit");
|
|
1473
|
-
* return;
|
|
1474
|
-
* }
|
|
1475
|
-
* const { metadata, item } = result;
|
|
1476
|
-
* console.log(`Fetched spatial unit: ${item.identification.label}`);
|
|
1477
|
-
* if (item.coordinates) {
|
|
1478
|
-
* console.log(`Location: ${item.coordinates.latitude}, ${item.coordinates.longitude}`);
|
|
1479
|
-
* }
|
|
1480
|
-
* ```
|
|
1481
|
-
*
|
|
1482
|
-
* @remarks
|
|
1483
|
-
* The returned spatial unit includes:
|
|
1484
|
-
* - Full spatial unit metadata
|
|
1485
|
-
* - Geographic coordinates
|
|
1486
|
-
* - Observations and events
|
|
1487
|
-
* - Associated images
|
|
1488
|
-
* - Context information
|
|
1489
|
-
* - License details
|
|
1490
|
-
*/
|
|
1491
|
-
declare function fetchSpatialUnit(uuid: string): Promise<{
|
|
1492
|
-
metadata: Metadata;
|
|
1493
|
-
spatialUnit: SpatialUnit;
|
|
1494
|
-
} | null>;
|
|
1495
|
-
|
|
1496
|
-
/**
|
|
1497
|
-
* Fetches and parses a tree from the OCHRE API
|
|
1498
|
-
*
|
|
1499
|
-
* @param uuid - The UUID of the tree to fetch
|
|
1500
|
-
* @returns Object containing the parsed tree and its metadata, or null if the fetch/parse fails
|
|
1501
|
-
*
|
|
1502
|
-
* @example
|
|
1503
|
-
* ```ts
|
|
1504
|
-
* const result = await fetchTree("123e4567-e89b-12d3-a456-426614174000");
|
|
1505
|
-
* if (result === null) {
|
|
1506
|
-
* console.error("Failed to fetch tree");
|
|
1507
|
-
* return;
|
|
1508
|
-
* }
|
|
1509
|
-
* const { metadata, item } = result;
|
|
1510
|
-
* console.log(`Fetched tree: ${item.identification.label}`);
|
|
1511
|
-
* console.log(`Contains ${item.items.resources.length} resources`);
|
|
1512
|
-
* ```
|
|
1513
|
-
*
|
|
1514
|
-
* @remarks
|
|
1515
|
-
* The returned tree includes:
|
|
1516
|
-
* - Full tree metadata
|
|
1517
|
-
* - Hierarchical structure of resources, spatial units, and concepts
|
|
1518
|
-
* - Creator information
|
|
1519
|
-
* - Properties and type information
|
|
1520
|
-
* - License details
|
|
1521
|
-
*/
|
|
1522
|
-
declare function fetchTree(uuid: string): Promise<{
|
|
1523
|
-
metadata: Metadata;
|
|
1524
|
-
tree: Tree;
|
|
1525
|
-
} | null>;
|
|
1526
|
-
|
|
1527
|
-
/**
|
|
1528
|
-
* Fetches and parses a website configuration from the OCHRE API
|
|
1529
|
-
*
|
|
1530
|
-
* @param abbreviation - The abbreviation identifier for the website
|
|
1531
|
-
* @returns The parsed website configuration or null if the fetch/parse fails
|
|
1532
|
-
*
|
|
1533
|
-
* @example
|
|
1534
|
-
* ```ts
|
|
1535
|
-
* const website = await fetchWebsite("guerrilla-television");
|
|
1536
|
-
* if (website === null) {
|
|
1537
|
-
* console.error("Failed to fetch website");
|
|
1538
|
-
* return;
|
|
1539
|
-
* }
|
|
1540
|
-
* console.log(`Fetched website: ${website.identification.label}`);
|
|
1541
|
-
* console.log(`Contains ${website.pages.length.toLocaleString()} pages`);
|
|
1542
|
-
* ```
|
|
1543
|
-
*
|
|
1544
|
-
* @remarks
|
|
1545
|
-
* The returned website configuration includes:
|
|
1546
|
-
* - Website metadata and identification
|
|
1547
|
-
* - Page structure and content
|
|
1548
|
-
* - Layout and styling properties
|
|
1549
|
-
* - Navigation configuration
|
|
1550
|
-
* - Sidebar elements
|
|
1551
|
-
* - Project information
|
|
1552
|
-
* - Creator details
|
|
1553
|
-
*
|
|
1554
|
-
* The abbreviation is case-insensitive and should match the website's configured abbreviation in OCHRE.
|
|
1555
|
-
*/
|
|
1556
|
-
declare function fetchWebsite(abbreviation: string): Promise<Website | null>;
|
|
1557
|
-
|
|
1558
1259
|
/**
|
|
1559
1260
|
* Options for property search operations
|
|
1560
1261
|
*/
|
|
@@ -1840,60 +1541,56 @@ declare function parsePropertyValues(propertyValues: Array<OchrePropertyValue>):
|
|
|
1840
1541
|
* @param tree - Raw tree data in OCHRE format
|
|
1841
1542
|
* @returns Parsed Tree object or null if invalid
|
|
1842
1543
|
*/
|
|
1843
|
-
declare function parseTree(tree: OchreTree): Tree
|
|
1544
|
+
declare function parseTree(tree: OchreTree): Tree;
|
|
1844
1545
|
/**
|
|
1845
1546
|
* Parses raw set data into a standardized Set structure
|
|
1846
1547
|
*
|
|
1847
1548
|
* @param set - Raw set data in OCHRE format
|
|
1848
1549
|
* @returns Parsed Set object
|
|
1849
1550
|
*/
|
|
1850
|
-
declare function parseSet(set: OchreSet): Set
|
|
1551
|
+
declare function parseSet<T extends DataCategory>(set: OchreSet): Set<T>;
|
|
1851
1552
|
/**
|
|
1852
1553
|
* Parses raw resource data into a standardized Resource structure
|
|
1853
1554
|
*
|
|
1854
1555
|
* @param resource - Raw resource data in OCHRE format
|
|
1855
1556
|
* @returns Parsed Resource object
|
|
1856
1557
|
*/
|
|
1857
|
-
declare function parseResource(resource: OchreResource
|
|
1558
|
+
declare function parseResource(resource: OchreResource): Resource;
|
|
1858
1559
|
/**
|
|
1859
1560
|
* Parses raw resource data into a standardized Resource structure
|
|
1860
1561
|
*
|
|
1861
1562
|
* @param resources - Raw resource data in OCHRE format
|
|
1862
1563
|
* @returns Parsed Resource object
|
|
1863
1564
|
*/
|
|
1864
|
-
declare function parseResources(resources: Array<OchreResource>
|
|
1565
|
+
declare function parseResources(resources: Array<OchreResource>): Array<Resource>;
|
|
1865
1566
|
/**
|
|
1866
|
-
* Parses raw spatial units into standardized SpatialUnit
|
|
1567
|
+
* Parses raw spatial units into standardized SpatialUnit objects
|
|
1867
1568
|
*
|
|
1868
1569
|
* @param spatialUnit - Raw spatial unit in OCHRE format
|
|
1869
|
-
* @
|
|
1870
|
-
* @returns Parsed SpatialUnit or NestedSpatialUnit object
|
|
1570
|
+
* @returns Parsed SpatialUnit object
|
|
1871
1571
|
*/
|
|
1872
|
-
declare function parseSpatialUnit(spatialUnit: OchreSpatialUnit
|
|
1572
|
+
declare function parseSpatialUnit(spatialUnit: OchreSpatialUnit): SpatialUnit;
|
|
1873
1573
|
/**
|
|
1874
|
-
* Parses an array of raw spatial units into standardized SpatialUnit
|
|
1574
|
+
* Parses an array of raw spatial units into standardized SpatialUnit objects
|
|
1875
1575
|
*
|
|
1876
1576
|
* @param spatialUnits - Array of raw spatial units in OCHRE format
|
|
1877
|
-
* @
|
|
1878
|
-
* @returns Array of parsed SpatialUnit or NestedSpatialUnit objects
|
|
1577
|
+
* @returns Array of parsed SpatialUnit objects
|
|
1879
1578
|
*/
|
|
1880
|
-
declare function parseSpatialUnits
|
|
1579
|
+
declare function parseSpatialUnits(spatialUnits: Array<OchreSpatialUnit>): Array<SpatialUnit>;
|
|
1881
1580
|
/**
|
|
1882
|
-
* Parses a raw concept into a standardized Concept
|
|
1581
|
+
* Parses a raw concept into a standardized Concept object
|
|
1883
1582
|
*
|
|
1884
1583
|
* @param concept - Raw concept data in OCHRE format
|
|
1885
|
-
* @
|
|
1886
|
-
* @returns Parsed Concept or NestedConcept object
|
|
1584
|
+
* @returns Parsed Concept object
|
|
1887
1585
|
*/
|
|
1888
|
-
declare function parseConcept(concept: OchreConcept
|
|
1586
|
+
declare function parseConcept(concept: OchreConcept): Concept;
|
|
1889
1587
|
/**
|
|
1890
|
-
* Parses raw concept data into standardized Concept
|
|
1588
|
+
* Parses raw concept data into standardized Concept objects
|
|
1891
1589
|
*
|
|
1892
1590
|
* @param concepts - Array of raw concept data in OCHRE format
|
|
1893
|
-
* @
|
|
1894
|
-
* @returns Array of parsed Concept or NestedConcept objects
|
|
1591
|
+
* @returns Array of parsed Concept objects
|
|
1895
1592
|
*/
|
|
1896
|
-
declare function parseConcepts(concepts: Array<OchreConcept>
|
|
1593
|
+
declare function parseConcepts(concepts: Array<OchreConcept>): Array<Concept>;
|
|
1897
1594
|
declare function parseWebsite(websiteTree: OchreTree, projectName: FakeString, website: FakeString | null): Promise<Website>;
|
|
1898
1595
|
|
|
1899
1596
|
/**
|
|
@@ -1947,4 +1644,4 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
|
|
|
1947
1644
|
*/
|
|
1948
1645
|
declare function parseStringContent(content: OchreStringContent, language?: string): string;
|
|
1949
1646
|
|
|
1950
|
-
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
|
|
1647
|
+
export { type Bibliography, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type DataCategory, 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 Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueContent, type PropertyValueContentType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebBlock, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchByUuid, fetchItem, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmail, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseProperty, parsePropertyValue, parsePropertyValues, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite };
|