ochre-sdk 0.21.8 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1043,9 +1043,9 @@ type WebElementComponent = {
1043
1043
  uuid: string;
1044
1044
  label: string;
1045
1045
  }> | null;
1046
- variant: "full" | "highlights";
1047
- itemVariant: "detailed" | "card" | "tile" | "showcase";
1046
+ variant: "detailed" | "card" | "tile" | "showcase";
1048
1047
  paginationVariant: "default" | "numeric";
1048
+ loadingVariant: "spinner" | "skeleton" | "animation" | "none";
1049
1049
  layout: "image-top" | "image-bottom" | "image-start" | "image-end";
1050
1050
  imageQuality: "high" | "low";
1051
1051
  isSortDisplayed: boolean;
@@ -1143,9 +1143,9 @@ type WebElementComponent = {
1143
1143
  uuid: string;
1144
1144
  label: string;
1145
1145
  }> | null;
1146
- itemVariant: Extract<WebElementComponent, {
1146
+ variant: Extract<WebElementComponent, {
1147
1147
  component: "collection";
1148
- }>["itemVariant"];
1148
+ }>["variant"];
1149
1149
  paginationVariant: Extract<WebElementComponent, {
1150
1150
  component: "collection";
1151
1151
  }>["paginationVariant"];
@@ -1400,7 +1400,8 @@ declare function fetchWebsite(abbreviation: string, options?: {
1400
1400
  * Options for property search operations
1401
1401
  */
1402
1402
  type PropertyOptions = {
1403
- /** Whether to recursively search through nested properties */includeNestedProperties: boolean;
1403
+ /** Whether to recursively search through nested properties */includeNestedProperties?: boolean; /** Whether to limit the search to leaf properties */
1404
+ limitToLeafPropertyValues?: boolean;
1404
1405
  };
1405
1406
  /**
1406
1407
  * Finds a property by its UUID in an array of properties
@@ -1410,7 +1411,7 @@ type PropertyOptions = {
1410
1411
  * @param options - Search options, including whether to include nested properties
1411
1412
  * @returns The matching Property object, or null if not found
1412
1413
  */
1413
- declare function getPropertyByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Property | null;
1414
+ declare function getPropertyByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): Property<T> | null;
1414
1415
  /**
1415
1416
  * Retrieves all values for a property with the given UUID
1416
1417
  *
@@ -1419,7 +1420,16 @@ declare function getPropertyByUuid(properties: Array<Property>, uuid: string, op
1419
1420
  * @param options - Search options, including whether to include nested properties
1420
1421
  * @returns Array of property values as strings, or null if property not found
1421
1422
  */
1422
- declare function getPropertyValuesByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
1423
+ declare function getPropertyValuesByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1424
+ /**
1425
+ * Retrieves all value contents for a property with the given UUID
1426
+ *
1427
+ * @param properties - Array of properties to search through
1428
+ * @param uuid - The UUID to search for
1429
+ * @param options - Search options, including whether to include nested properties
1430
+ * @returns Array of property value contents as strings, or null if property not found
1431
+ */
1432
+ declare function getPropertyValueContentsByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>["content"]> | null;
1423
1433
  /**
1424
1434
  * Gets the first value of a property with the given UUID
1425
1435
  *
@@ -1428,7 +1438,16 @@ declare function getPropertyValuesByUuid(properties: Array<Property>, uuid: stri
1428
1438
  * @param options - Search options, including whether to include nested properties
1429
1439
  * @returns The first property value as string, or null if property not found
1430
1440
  */
1431
- declare function getPropertyValueByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): string | number | boolean | Date | null;
1441
+ declare function getPropertyValueByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1442
+ /**
1443
+ * Gets the first value content of a property with the given UUID
1444
+ *
1445
+ * @param properties - Array of properties to search through
1446
+ * @param uuid - The UUID to search for
1447
+ * @param options - Search options, including whether to include nested properties
1448
+ * @returns The first property value content as string, or null if property not found
1449
+ */
1450
+ declare function getPropertyValueContentByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): PropertyValueContent<T>["content"] | null;
1432
1451
  /**
1433
1452
  * Finds a property by its label in an array of properties
1434
1453
  *
@@ -1437,7 +1456,7 @@ declare function getPropertyValueByUuid(properties: Array<Property>, uuid: strin
1437
1456
  * @param options - Search options, including whether to include nested properties
1438
1457
  * @returns The matching Property object, or null if not found
1439
1458
  */
1440
- declare function getPropertyByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Property | null;
1459
+ declare function getPropertyByLabel<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, options?: PropertyOptions): Property<T> | null;
1441
1460
  /**
1442
1461
  * Finds a property by its label and all values in an array of properties
1443
1462
  *
@@ -1447,7 +1466,17 @@ declare function getPropertyByLabel(properties: Array<Property>, label: string,
1447
1466
  * @param options - Search options, including whether to include nested properties
1448
1467
  * @returns The matching Property object, or null if not found or all values do not match
1449
1468
  */
1450
- declare function getPropertyByLabelAndValues(properties: Array<Property>, label: string, values: Array<string | number | boolean | Date | null>, options?: PropertyOptions): Property | null;
1469
+ declare function getPropertyByLabelAndValues<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, values: Array<PropertyValueContent<T>>, options?: PropertyOptions): Property<T> | null;
1470
+ /**
1471
+ * Finds a property by its label and all values in an array of properties
1472
+ *
1473
+ * @param properties - Array of properties to search through
1474
+ * @param label - The label to search for
1475
+ * @param valueContents - The value contents to search for
1476
+ * @param options - Search options, including whether to include nested properties
1477
+ * @returns The matching Property object, or null if not found or all values do not match
1478
+ */
1479
+ declare function getPropertyByLabelAndValueContents<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, valueContents: Array<PropertyValueContent<T>["content"]>, options?: PropertyOptions): Property<T> | null;
1451
1480
  /**
1452
1481
  * Finds a property by its label and value in an array of properties
1453
1482
  *
@@ -1457,7 +1486,17 @@ declare function getPropertyByLabelAndValues(properties: Array<Property>, label:
1457
1486
  * @param options - Search options, including whether to include nested properties
1458
1487
  * @returns The matching Property object, or null if not found or value does not match
1459
1488
  */
1460
- declare function getPropertyByLabelAndValue(properties: Array<Property>, label: string, value: string | number | boolean | Date | null, options?: PropertyOptions): Property | null;
1489
+ declare function getPropertyByLabelAndValue<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
1490
+ /**
1491
+ * Finds a property by its label and value content in an array of properties
1492
+ *
1493
+ * @param properties - Array of properties to search through
1494
+ * @param label - The label to search for
1495
+ * @param valueContent - The value content to search for
1496
+ * @param options - Search options, including whether to include nested properties
1497
+ * @returns The matching Property object, or null if not found or value content does not match
1498
+ */
1499
+ declare function getPropertyByLabelAndValueContent<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, valueContent: PropertyValueContent<T>["content"], options?: PropertyOptions): Property<T> | null;
1461
1500
  /**
1462
1501
  * Retrieves all values for a property with the given label
1463
1502
  *
@@ -1466,7 +1505,7 @@ declare function getPropertyByLabelAndValue(properties: Array<Property>, label:
1466
1505
  * @param options - Search options, including whether to include nested properties
1467
1506
  * @returns Array of property values as strings, or null if property not found
1468
1507
  */
1469
- declare function getPropertyValuesByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
1508
+ declare function getPropertyValuesByLabel<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1470
1509
  /**
1471
1510
  * Gets the first value of a property with the given label
1472
1511
  *
@@ -1475,7 +1514,16 @@ declare function getPropertyValuesByLabel(properties: Array<Property>, label: st
1475
1514
  * @param options - Search options, including whether to include nested properties
1476
1515
  * @returns The first property value as string, or null if property not found
1477
1516
  */
1478
- declare function getPropertyValueByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): string | number | boolean | Date | null;
1517
+ declare function getPropertyValueByLabel<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1518
+ /**
1519
+ * Gets the first value content of a property with the given label
1520
+ *
1521
+ * @param properties - Array of properties to search through
1522
+ * @param label - The label to search for
1523
+ * @param options - Search options, including whether to include nested properties
1524
+ * @returns The first property value content as string, or null if property not found
1525
+ */
1526
+ declare function getPropertyValueContentByLabel<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, options?: PropertyOptions): PropertyValueContent<T>["content"] | null;
1479
1527
  /**
1480
1528
  * Gets all unique properties from an array of properties
1481
1529
  *
@@ -1483,7 +1531,7 @@ declare function getPropertyValueByLabel(properties: Array<Property>, label: str
1483
1531
  * @param options - Search options, including whether to include nested properties
1484
1532
  * @returns Array of unique properties
1485
1533
  */
1486
- declare function getUniqueProperties(properties: Array<Property>, options?: PropertyOptions): Array<Property>;
1534
+ declare function getUniqueProperties<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
1487
1535
  /**
1488
1536
  * Gets all unique property labels from an array of properties
1489
1537
  *
@@ -1491,7 +1539,7 @@ declare function getUniqueProperties(properties: Array<Property>, options?: Prop
1491
1539
  * @param options - Search options, including whether to include nested properties
1492
1540
  * @returns Array of unique property labels
1493
1541
  */
1494
- declare function getUniquePropertyLabels(properties: Array<Property>, options?: PropertyOptions): Array<string>;
1542
+ declare function getUniquePropertyLabels<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, options?: PropertyOptions): Array<string>;
1495
1543
  /**
1496
1544
  * Get the leaf property values from an array of property values
1497
1545
  * @param propertyValues - The array of property values to get the leaf property values from
@@ -1508,9 +1556,9 @@ declare function getLeafPropertyValues<T extends PropertyValueContentType = Prop
1508
1556
  * @param options - Search options, including whether to include nested properties
1509
1557
  * @returns True if the property matches the filter criteria, false otherwise
1510
1558
  */
1511
- declare function filterProperties(property: Property, filter: {
1559
+ declare function filterProperties<T extends PropertyValueContentType = PropertyValueContentType>(property: Property<T>, filter: {
1512
1560
  label: string;
1513
- value: string | number | boolean | Date;
1561
+ value: PropertyValueContent<T>;
1514
1562
  }, options?: PropertyOptions): boolean;
1515
1563
  //#endregion
1516
1564
  //#region src/utils/helpers.d.ts
@@ -1536,4 +1584,4 @@ declare const DEFAULT_PAGE_SIZE = 48;
1536
1584
  */
1537
1585
  declare function flattenItemProperties<T extends DataCategory = DataCategory, U extends DataCategory | Array<DataCategory> = (T extends "tree" ? Exclude<DataCategory, "tree"> : T extends "set" ? Array<DataCategory> : never)>(item: Item<T, U>): Item<T, U>;
1538
1586
  //#endregion
1539
- export { ApiVersion, Bibliography, Concept, Context, ContextItem, ContextNode, Coordinate, DEFAULT_API_VERSION, DEFAULT_PAGE_SIZE, Data, DataCategory, Event, FileFormat, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyContexts, PropertyValue, PropertyValueContent, PropertyValueContentType, PropertyValueQueryItem, PropertyVariable, Query, QueryGroup, QueryLeaf, Resource, Scope, Section, Set, SetAttributeValueQueryItem, SetItemsSort, SetItemsSortDirection, SpatialUnit, Style, StylesheetCategory, StylesheetItem, Text, Tree, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebSegment, WebSegmentItem, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteType, fetchGallery, fetchItem, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByLabel, getPropertyByLabelAndValue, getPropertyByLabelAndValues, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
1587
+ export { ApiVersion, Bibliography, Concept, Context, ContextItem, ContextNode, Coordinate, DEFAULT_API_VERSION, DEFAULT_PAGE_SIZE, Data, DataCategory, Event, FileFormat, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyContexts, PropertyValue, PropertyValueContent, PropertyValueContentType, PropertyValueQueryItem, PropertyVariable, Query, QueryGroup, QueryLeaf, Resource, Scope, Section, Set, SetAttributeValueQueryItem, SetItemsSort, SetItemsSortDirection, SpatialUnit, Style, StylesheetCategory, StylesheetItem, Text, Tree, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebSegment, WebSegmentItem, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteType, fetchGallery, fetchItem, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByLabel, getPropertyByLabelAndValue, getPropertyByLabelAndValueContent, getPropertyByLabelAndValueContents, getPropertyByLabelAndValues, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValueContentByLabel, getPropertyValueContentByUuid, getPropertyValueContentsByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };