ochre-sdk 0.21.7 → 0.22.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.d.mts CHANGED
@@ -734,7 +734,7 @@ type QueryLeaf = {
734
734
  language: string;
735
735
  isNegated?: boolean;
736
736
  } | {
737
- target: "title" | "description" | "image" | "periods" | "bibliography";
737
+ target: "title" | "description" | "image" | "periods" | "bibliography" | "notes";
738
738
  value: string;
739
739
  matchMode: "includes" | "exact";
740
740
  isCaseSensitive: boolean;
@@ -1043,8 +1043,7 @@ 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";
1049
1048
  layout: "image-top" | "image-bottom" | "image-start" | "image-end";
1050
1049
  imageQuality: "high" | "low";
@@ -1143,9 +1142,9 @@ type WebElementComponent = {
1143
1142
  uuid: string;
1144
1143
  label: string;
1145
1144
  }> | null;
1146
- itemVariant: Extract<WebElementComponent, {
1145
+ variant: Extract<WebElementComponent, {
1147
1146
  component: "collection";
1148
- }>["itemVariant"];
1147
+ }>["variant"];
1149
1148
  paginationVariant: Extract<WebElementComponent, {
1150
1149
  component: "collection";
1151
1150
  }>["paginationVariant"];
@@ -1400,7 +1399,8 @@ declare function fetchWebsite(abbreviation: string, options?: {
1400
1399
  * Options for property search operations
1401
1400
  */
1402
1401
  type PropertyOptions = {
1403
- /** Whether to recursively search through nested properties */includeNestedProperties: boolean;
1402
+ /** Whether to recursively search through nested properties */includeNestedProperties?: boolean; /** Whether to limit the search to leaf properties */
1403
+ limitToLeafPropertyValues?: boolean;
1404
1404
  };
1405
1405
  /**
1406
1406
  * Finds a property by its UUID in an array of properties
@@ -1410,7 +1410,7 @@ type PropertyOptions = {
1410
1410
  * @param options - Search options, including whether to include nested properties
1411
1411
  * @returns The matching Property object, or null if not found
1412
1412
  */
1413
- declare function getPropertyByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Property | null;
1413
+ declare function getPropertyByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): Property<T> | null;
1414
1414
  /**
1415
1415
  * Retrieves all values for a property with the given UUID
1416
1416
  *
@@ -1419,7 +1419,16 @@ declare function getPropertyByUuid(properties: Array<Property>, uuid: string, op
1419
1419
  * @param options - Search options, including whether to include nested properties
1420
1420
  * @returns Array of property values as strings, or null if property not found
1421
1421
  */
1422
- declare function getPropertyValuesByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
1422
+ declare function getPropertyValuesByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1423
+ /**
1424
+ * Retrieves all value contents for a property with the given UUID
1425
+ *
1426
+ * @param properties - Array of properties to search through
1427
+ * @param uuid - The UUID to search for
1428
+ * @param options - Search options, including whether to include nested properties
1429
+ * @returns Array of property value contents as strings, or null if property not found
1430
+ */
1431
+ declare function getPropertyValueContentsByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>["content"]> | null;
1423
1432
  /**
1424
1433
  * Gets the first value of a property with the given UUID
1425
1434
  *
@@ -1428,7 +1437,16 @@ declare function getPropertyValuesByUuid(properties: Array<Property>, uuid: stri
1428
1437
  * @param options - Search options, including whether to include nested properties
1429
1438
  * @returns The first property value as string, or null if property not found
1430
1439
  */
1431
- declare function getPropertyValueByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): string | number | boolean | Date | null;
1440
+ declare function getPropertyValueByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1441
+ /**
1442
+ * Gets the first value content of a property with the given UUID
1443
+ *
1444
+ * @param properties - Array of properties to search through
1445
+ * @param uuid - The UUID to search for
1446
+ * @param options - Search options, including whether to include nested properties
1447
+ * @returns The first property value content as string, or null if property not found
1448
+ */
1449
+ declare function getPropertyValueContentByUuid<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, uuid: string, options?: PropertyOptions): PropertyValueContent<T>["content"] | null;
1432
1450
  /**
1433
1451
  * Finds a property by its label in an array of properties
1434
1452
  *
@@ -1437,7 +1455,7 @@ declare function getPropertyValueByUuid(properties: Array<Property>, uuid: strin
1437
1455
  * @param options - Search options, including whether to include nested properties
1438
1456
  * @returns The matching Property object, or null if not found
1439
1457
  */
1440
- declare function getPropertyByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Property | null;
1458
+ declare function getPropertyByLabel<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, options?: PropertyOptions): Property<T> | null;
1441
1459
  /**
1442
1460
  * Finds a property by its label and all values in an array of properties
1443
1461
  *
@@ -1447,7 +1465,17 @@ declare function getPropertyByLabel(properties: Array<Property>, label: string,
1447
1465
  * @param options - Search options, including whether to include nested properties
1448
1466
  * @returns The matching Property object, or null if not found or all values do not match
1449
1467
  */
1450
- declare function getPropertyByLabelAndValues(properties: Array<Property>, label: string, values: Array<string | number | boolean | Date | null>, options?: PropertyOptions): Property | null;
1468
+ declare function getPropertyByLabelAndValues<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, values: Array<PropertyValueContent<T>>, options?: PropertyOptions): Property<T> | null;
1469
+ /**
1470
+ * Finds a property by its label and all values in an array of properties
1471
+ *
1472
+ * @param properties - Array of properties to search through
1473
+ * @param label - The label to search for
1474
+ * @param valueContents - The value contents to search for
1475
+ * @param options - Search options, including whether to include nested properties
1476
+ * @returns The matching Property object, or null if not found or all values do not match
1477
+ */
1478
+ declare function getPropertyByLabelAndValueContents<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, valueContents: Array<PropertyValueContent<T>["content"]>, options?: PropertyOptions): Property<T> | null;
1451
1479
  /**
1452
1480
  * Finds a property by its label and value in an array of properties
1453
1481
  *
@@ -1457,7 +1485,17 @@ declare function getPropertyByLabelAndValues(properties: Array<Property>, label:
1457
1485
  * @param options - Search options, including whether to include nested properties
1458
1486
  * @returns The matching Property object, or null if not found or value does not match
1459
1487
  */
1460
- declare function getPropertyByLabelAndValue(properties: Array<Property>, label: string, value: string | number | boolean | Date | null, options?: PropertyOptions): Property | null;
1488
+ declare function getPropertyByLabelAndValue<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
1489
+ /**
1490
+ * Finds a property by its label and value content in an array of properties
1491
+ *
1492
+ * @param properties - Array of properties to search through
1493
+ * @param label - The label to search for
1494
+ * @param valueContent - The value content to search for
1495
+ * @param options - Search options, including whether to include nested properties
1496
+ * @returns The matching Property object, or null if not found or value content does not match
1497
+ */
1498
+ declare function getPropertyByLabelAndValueContent<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, valueContent: PropertyValueContent<T>["content"], options?: PropertyOptions): Property<T> | null;
1461
1499
  /**
1462
1500
  * Retrieves all values for a property with the given label
1463
1501
  *
@@ -1466,7 +1504,7 @@ declare function getPropertyByLabelAndValue(properties: Array<Property>, label:
1466
1504
  * @param options - Search options, including whether to include nested properties
1467
1505
  * @returns Array of property values as strings, or null if property not found
1468
1506
  */
1469
- declare function getPropertyValuesByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
1507
+ declare function getPropertyValuesByLabel<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1470
1508
  /**
1471
1509
  * Gets the first value of a property with the given label
1472
1510
  *
@@ -1475,7 +1513,16 @@ declare function getPropertyValuesByLabel(properties: Array<Property>, label: st
1475
1513
  * @param options - Search options, including whether to include nested properties
1476
1514
  * @returns The first property value as string, or null if property not found
1477
1515
  */
1478
- declare function getPropertyValueByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): string | number | boolean | Date | null;
1516
+ declare function getPropertyValueByLabel<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1517
+ /**
1518
+ * Gets the first value content of a property with the given label
1519
+ *
1520
+ * @param properties - Array of properties to search through
1521
+ * @param label - The label to search for
1522
+ * @param options - Search options, including whether to include nested properties
1523
+ * @returns The first property value content as string, or null if property not found
1524
+ */
1525
+ declare function getPropertyValueContentByLabel<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, label: string, options?: PropertyOptions): PropertyValueContent<T>["content"] | null;
1479
1526
  /**
1480
1527
  * Gets all unique properties from an array of properties
1481
1528
  *
@@ -1483,7 +1530,7 @@ declare function getPropertyValueByLabel(properties: Array<Property>, label: str
1483
1530
  * @param options - Search options, including whether to include nested properties
1484
1531
  * @returns Array of unique properties
1485
1532
  */
1486
- declare function getUniqueProperties(properties: Array<Property>, options?: PropertyOptions): Array<Property>;
1533
+ declare function getUniqueProperties<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
1487
1534
  /**
1488
1535
  * Gets all unique property labels from an array of properties
1489
1536
  *
@@ -1491,7 +1538,7 @@ declare function getUniqueProperties(properties: Array<Property>, options?: Prop
1491
1538
  * @param options - Search options, including whether to include nested properties
1492
1539
  * @returns Array of unique property labels
1493
1540
  */
1494
- declare function getUniquePropertyLabels(properties: Array<Property>, options?: PropertyOptions): Array<string>;
1541
+ declare function getUniquePropertyLabels<T extends PropertyValueContentType = PropertyValueContentType>(properties: Array<Property<T>>, options?: PropertyOptions): Array<string>;
1495
1542
  /**
1496
1543
  * Get the leaf property values from an array of property values
1497
1544
  * @param propertyValues - The array of property values to get the leaf property values from
@@ -1508,9 +1555,9 @@ declare function getLeafPropertyValues<T extends PropertyValueContentType = Prop
1508
1555
  * @param options - Search options, including whether to include nested properties
1509
1556
  * @returns True if the property matches the filter criteria, false otherwise
1510
1557
  */
1511
- declare function filterProperties(property: Property, filter: {
1558
+ declare function filterProperties<T extends PropertyValueContentType = PropertyValueContentType>(property: Property<T>, filter: {
1512
1559
  label: string;
1513
- value: string | number | boolean | Date;
1560
+ value: PropertyValueContent<T>;
1514
1561
  }, options?: PropertyOptions): boolean;
1515
1562
  //#endregion
1516
1563
  //#region src/utils/helpers.d.ts
@@ -1536,4 +1583,4 @@ declare const DEFAULT_PAGE_SIZE = 48;
1536
1583
  */
1537
1584
  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
1585
  //#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 };
1586
+ 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 };