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