ochre-sdk 1.0.0-beta.7 → 1.0.0-beta.8

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
@@ -294,7 +294,7 @@ type Event<T extends ReadonlyArray<string>> = {
294
294
  end: Date;
295
295
  } | null;
296
296
  label: MultilingualString<T>;
297
- comment: string | null;
297
+ comment: MultilingualString<T> | null;
298
298
  agent: {
299
299
  uuid: string;
300
300
  label: MultilingualString<T>;
@@ -402,7 +402,7 @@ type ImageMap = {
402
402
  */
403
403
  type Note<T extends ReadonlyArray<string>> = {
404
404
  number: number;
405
- title: string | null;
405
+ title: MultilingualString<T> | null;
406
406
  content: MultilingualString<T>;
407
407
  authors: Array<Person<T, "nested">>;
408
408
  };
@@ -440,19 +440,34 @@ type PropertyValueContent<T extends ReadonlyArray<string>> = Prettify<{
440
440
  * Property in OCHRE
441
441
  */
442
442
  type Property<T extends ReadonlyArray<string>> = {
443
- label: {
443
+ variable: {
444
444
  uuid: string;
445
+ label: MultilingualString<T>;
445
446
  publicationDateTime: Date | null;
446
- name: string;
447
447
  };
448
448
  values: Array<PropertyValueContent<T>>;
449
449
  comment: MultilingualString<T> | null;
450
450
  properties: Array<Property<T>>;
451
451
  };
452
+ /**
453
+ * Simplified property in OCHRE website payloads. Simplified property variables
454
+ * expose scalar labels rather than multilingual labels.
455
+ */
456
+ type SimplifiedProperty<T extends ReadonlyArray<string>> = {
457
+ variable: {
458
+ uuid: string;
459
+ label: string;
460
+ publicationDateTime: Date | null;
461
+ };
462
+ values: Array<PropertyValueContent<T>>;
463
+ comment: MultilingualString<T> | null;
464
+ properties: Array<SimplifiedProperty<T>>;
465
+ };
452
466
  /**
453
467
  * Property in a Set item. OCHRE exposes Set item properties as a flat list.
454
468
  */
455
469
  type SingleHierarchyProperty<T extends ReadonlyArray<string>> = Omit<Property<T>, "properties">;
470
+ type SingleHierarchySimplifiedProperty<T extends ReadonlyArray<string>> = Omit<SimplifiedProperty<T>, "properties">;
456
471
  type WithSingleHierarchyProperties<U extends {
457
472
  properties: Array<Property<T>>;
458
473
  }, T extends ReadonlyArray<string>> = U extends {
@@ -828,7 +843,7 @@ type PropertyValueQueryItem = {
828
843
  count: number;
829
844
  dataType: Exclude<PropertyValueContent<ReadonlyArray<string>>["dataType"], "coordinate">;
830
845
  content: string | number | boolean | null;
831
- label: string | null;
846
+ label: MultilingualString | null;
832
847
  };
833
848
  /**
834
849
  * Represents a grouped Set attribute value query item
@@ -1529,7 +1544,7 @@ type WebElementComponent<T extends ReadonlyArray<string> = ReadonlyArray<string>
1529
1544
  component: "query";
1530
1545
  linkUuids: Array<string>;
1531
1546
  items: Array<{
1532
- label: string;
1547
+ label: MultilingualString<T>;
1533
1548
  queries: Array<WebsitePropertyQuery<T>>;
1534
1549
  startIcon: string | null;
1535
1550
  endIcon: string | null;
@@ -1561,7 +1576,7 @@ type WebElementComponent<T extends ReadonlyArray<string> = ReadonlyArray<string>
1561
1576
  } | {
1562
1577
  component: "search-bar";
1563
1578
  queryVariant: "submit" | "change";
1564
- placeholder: string | null;
1579
+ placeholder: MultilingualString<T> | null;
1565
1580
  baseFilterQueries: string | null;
1566
1581
  boundElementUuid: string | null;
1567
1582
  href: string | null;
@@ -1680,130 +1695,142 @@ type PropertyOptions = {
1680
1695
  limitToLeafPropertyValues?: boolean;
1681
1696
  };
1682
1697
  type PropertyContent<T extends ReadonlyArray<string>> = PropertyValueContent<T>["content"];
1683
- type SearchableProperty<T extends ReadonlyArray<string>> = Property<T> | SingleHierarchyProperty<T>;
1698
+ type SearchableProperty<T extends ReadonlyArray<string>> = Property<T> | SingleHierarchyProperty<T> | SimplifiedProperty<T> | SingleHierarchySimplifiedProperty<T>;
1684
1699
  /**
1685
- * Finds a property by its label UUID in an array of properties.
1700
+ * Finds a property by its variable UUID in an array of properties.
1686
1701
  *
1687
1702
  * @param properties - Array of properties to search through
1688
- * @param labelUuid - The property label UUID to search for
1703
+ * @param labelUuid - The property variable UUID to search for
1689
1704
  * @param options - Search options, including whether to include nested properties
1690
1705
  * @returns The matching Property object, or null if not found
1691
1706
  */
1692
1707
  declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Property<T> | null;
1693
1708
  declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelUuid: string, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1709
+ declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SimplifiedProperty<T>>, labelUuid: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
1710
+ declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, labelUuid: string, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
1694
1711
  /**
1695
- * Retrieves all values for a property with the given label UUID.
1712
+ * Retrieves all values for a property with the given variable UUID.
1696
1713
  *
1697
1714
  * @param properties - Array of properties to search through
1698
- * @param labelUuid - The property label UUID to search for
1715
+ * @param labelUuid - The property variable UUID to search for
1699
1716
  * @param options - Search options, including whether to include nested properties
1700
1717
  * @returns Array of property values, or null if property not found
1701
1718
  */
1702
1719
  declare function getPropertyValuesByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1703
1720
  /**
1704
- * Retrieves all value contents for a property with the given label UUID.
1721
+ * Retrieves all value contents for a property with the given variable UUID.
1705
1722
  *
1706
1723
  * @param properties - Array of properties to search through
1707
- * @param labelUuid - The property label UUID to search for
1724
+ * @param labelUuid - The property variable UUID to search for
1708
1725
  * @param options - Search options, including whether to include nested properties
1709
1726
  * @returns Array of property value contents, or null if property not found
1710
1727
  */
1711
1728
  declare function getPropertyValueContentsByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
1712
1729
  /**
1713
- * Gets the first value of a property with the given label UUID.
1730
+ * Gets the first value of a property with the given variable UUID.
1714
1731
  *
1715
1732
  * @param properties - Array of properties to search through
1716
- * @param labelUuid - The property label UUID to search for
1733
+ * @param labelUuid - The property variable UUID to search for
1717
1734
  * @param options - Search options, including whether to include nested properties
1718
1735
  * @returns The first property value, or null if property not found
1719
1736
  */
1720
1737
  declare function getPropertyValueByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1721
1738
  /**
1722
- * Gets the first value content of a property with the given label UUID.
1739
+ * Gets the first value content of a property with the given variable UUID.
1723
1740
  *
1724
1741
  * @param properties - Array of properties to search through
1725
- * @param labelUuid - The property label UUID to search for
1742
+ * @param labelUuid - The property variable UUID to search for
1726
1743
  * @param options - Search options, including whether to include nested properties
1727
1744
  * @returns The first property value content, or null if property not found
1728
1745
  */
1729
1746
  declare function getPropertyValueContentByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
1730
1747
  /**
1731
- * Finds a property by its label name in an array of properties.
1748
+ * Finds a property by its variable label name in an array of properties.
1732
1749
  *
1733
1750
  * @param properties - Array of properties to search through
1734
- * @param labelName - The property label name to search for
1751
+ * @param labelName - The property variable label name to search for
1735
1752
  * @param options - Search options, including whether to include nested properties
1736
1753
  * @returns The matching Property object, or null if not found
1737
1754
  */
1738
1755
  declare function getPropertyByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): Property<T> | null;
1739
1756
  declare function getPropertyByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1757
+ declare function getPropertyByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SimplifiedProperty<T>>, labelName: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
1758
+ declare function getPropertyByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, labelName: string, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
1740
1759
  /**
1741
- * Finds a property by its label name and all values.
1760
+ * Finds a property by its variable label name and all values.
1742
1761
  *
1743
1762
  * @param properties - Array of properties to search through
1744
- * @param labelName - The property label name to search for
1763
+ * @param labelName - The property variable label name to search for
1745
1764
  * @param values - The property values to search for
1746
1765
  * @param options - Search options, including whether to include nested properties
1747
1766
  * @returns The matching Property object, or null if not found or all values do not match
1748
1767
  */
1749
1768
  declare function getPropertyByLabelNameAndValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): Property<T> | null;
1750
1769
  declare function getPropertyByLabelNameAndValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1770
+ declare function getPropertyByLabelNameAndValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SimplifiedProperty<T>>, labelName: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
1771
+ declare function getPropertyByLabelNameAndValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, labelName: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
1751
1772
  /**
1752
- * Finds a property by its label name and all value contents.
1773
+ * Finds a property by its variable label name and all value contents.
1753
1774
  *
1754
1775
  * @param properties - Array of properties to search through
1755
- * @param labelName - The property label name to search for
1776
+ * @param labelName - The property variable label name to search for
1756
1777
  * @param valueContents - The value contents to search for
1757
1778
  * @param options - Search options, including whether to include nested properties
1758
1779
  * @returns The matching Property object, or null if not found or all value contents do not match
1759
1780
  */
1760
1781
  declare function getPropertyByLabelNameAndValueContents<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): Property<T> | null;
1761
1782
  declare function getPropertyByLabelNameAndValueContents<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1783
+ declare function getPropertyByLabelNameAndValueContents<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SimplifiedProperty<T>>, labelName: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
1784
+ declare function getPropertyByLabelNameAndValueContents<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, labelName: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
1762
1785
  /**
1763
- * Finds a property by its label name and one value.
1786
+ * Finds a property by its variable label name and one value.
1764
1787
  *
1765
1788
  * @param properties - Array of properties to search through
1766
- * @param labelName - The property label name to search for
1789
+ * @param labelName - The property variable label name to search for
1767
1790
  * @param value - The property value to search for
1768
1791
  * @param options - Search options, including whether to include nested properties
1769
1792
  * @returns The matching Property object, or null if not found or value does not match
1770
1793
  */
1771
1794
  declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
1772
1795
  declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, value: PropertyValueContent<T>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1796
+ declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SimplifiedProperty<T>>, labelName: string, value: PropertyValueContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
1797
+ declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, labelName: string, value: PropertyValueContent<T>, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
1773
1798
  /**
1774
- * Finds a property by its label name and one value content.
1799
+ * Finds a property by its variable label name and one value content.
1775
1800
  *
1776
1801
  * @param properties - Array of properties to search through
1777
- * @param labelName - The property label name to search for
1802
+ * @param labelName - The property variable label name to search for
1778
1803
  * @param valueContent - The value content to search for
1779
1804
  * @param options - Search options, including whether to include nested properties
1780
1805
  * @returns The matching Property object, or null if not found or value content does not match
1781
1806
  */
1782
1807
  declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, valueContent: PropertyContent<T>, options?: PropertyOptions): Property<T> | null;
1783
1808
  declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1809
+ declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SimplifiedProperty<T>>, labelName: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
1810
+ declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, labelName: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
1784
1811
  /**
1785
- * Retrieves all values for a property with the given label name.
1812
+ * Retrieves all values for a property with the given variable label name.
1786
1813
  *
1787
1814
  * @param properties - Array of properties to search through
1788
- * @param labelName - The property label name to search for
1815
+ * @param labelName - The property variable label name to search for
1789
1816
  * @param options - Search options, including whether to include nested properties
1790
1817
  * @returns Array of property values, or null if property not found
1791
1818
  */
1792
1819
  declare function getPropertyValuesByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelName: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1793
1820
  /**
1794
- * Gets the first value of a property with the given label name.
1821
+ * Gets the first value of a property with the given variable label name.
1795
1822
  *
1796
1823
  * @param properties - Array of properties to search through
1797
- * @param labelName - The property label name to search for
1824
+ * @param labelName - The property variable label name to search for
1798
1825
  * @param options - Search options, including whether to include nested properties
1799
1826
  * @returns The first property value, or null if property not found
1800
1827
  */
1801
1828
  declare function getPropertyValueByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelName: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1802
1829
  /**
1803
- * Gets the first value content of a property with the given label name.
1830
+ * Gets the first value content of a property with the given variable label name.
1804
1831
  *
1805
1832
  * @param properties - Array of properties to search through
1806
- * @param labelName - The property label name to search for
1833
+ * @param labelName - The property variable label name to search for
1807
1834
  * @param options - Search options, including whether to include nested properties
1808
1835
  * @returns The first property value content, or null if property not found
1809
1836
  */
@@ -1817,12 +1844,14 @@ declare function getPropertyValueContentByLabelName<T extends ReadonlyArray<stri
1817
1844
  */
1818
1845
  declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
1819
1846
  declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, options?: PropertyOptions): Array<SingleHierarchyProperty<T>>;
1847
+ declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SimplifiedProperty<T>>, options?: PropertyOptions): Array<SimplifiedProperty<T>>;
1848
+ declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, options?: PropertyOptions): Array<SingleHierarchySimplifiedProperty<T>>;
1820
1849
  /**
1821
- * Gets all unique property label names from an array of properties.
1850
+ * Gets all unique property variable label names from an array of properties.
1822
1851
  *
1823
- * @param properties - Array of properties to get unique property labels from
1852
+ * @param properties - Array of properties to get unique property variable labels from
1824
1853
  * @param options - Search options, including whether to include nested properties
1825
- * @returns Array of unique property label names
1854
+ * @returns Array of unique property variable label names
1826
1855
  */
1827
1856
  declare function getUniquePropertyLabelNames<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, options?: PropertyOptions): Array<string>;
1828
1857
  /**
@@ -1833,11 +1862,11 @@ declare function getUniquePropertyLabelNames<T extends ReadonlyArray<string> = R
1833
1862
  */
1834
1863
  declare function getLeafPropertyValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(propertyValues: ReadonlyArray<PropertyValueContent<T>>): Array<PropertyValueContent<T>>;
1835
1864
  /**
1836
- * Filters a property based on a label and value criterion.
1865
+ * Filters a property based on a variable label and value criterion.
1837
1866
  *
1838
1867
  * @param property - The property to filter
1839
- * @param filter - Filter criteria containing label and value to match
1840
- * @param filter.labelName - The label name to filter by
1868
+ * @param filter - Filter criteria containing variable label and value to match
1869
+ * @param filter.labelName - The variable label name to filter by
1841
1870
  * @param filter.value - The value to filter by
1842
1871
  * @param options - Search options, including whether to include nested properties
1843
1872
  * @returns True if the property matches the filter criteria, false otherwise
@@ -1862,4 +1891,4 @@ declare const DEFAULT_PAGE_SIZE = 48;
1862
1891
  */
1863
1892
  declare function flattenItemProperties<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends ReadonlyArray<string> = ReadonlyArray<string>, W extends ItemLocation = "topLevel">(item: Item<U, V, T, W>): FlattenedItem<Item<U, V, T, W>, T>;
1864
1893
  //#endregion
1865
- export { BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, Context, ContextDataCategory, ContextItem, ContextNode, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Coordinates, CoordinatesSource, DEFAULT_PAGE_SIZE, DataCategory, DictionaryUnitItemLink, Event, Gallery, Heading, HeadingDataCategory, HierarchyDataCategory, HierarchyItemCategoryFromOption, HierarchyItemCategoryOption, HierarchyItemDataCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemLink, ItemLinkCategory, ItemLinks, ItemLocation, ItemsDataCategory, License, Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringText, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyOptions, PropertyValue, PropertyValueContent, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, RecursiveDataCategory, Resource, ResourceItemLink, Scope, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemDataCategory, SetItemLink, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SingleHierarchyProperty, SpatialUnit, SpatialUnitItemLink, Style, StylesheetCategory, StylesheetItem, Text, TextItemLink, Tree, TreeItemLink, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebSegment, WebSegmentItem, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByLabelName, getPropertyByLabelNameAndValue, getPropertyByLabelNameAndValueContent, getPropertyByLabelNameAndValueContents, getPropertyByLabelNameAndValues, getPropertyByLabelUuid, getPropertyValueByLabelName, getPropertyValueByLabelUuid, getPropertyValueContentByLabelName, getPropertyValueContentByLabelUuid, getPropertyValueContentsByLabelUuid, getPropertyValuesByLabelName, getPropertyValuesByLabelUuid, getUniqueProperties, getUniquePropertyLabelNames, withLanguages };
1894
+ export { BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, Context, ContextDataCategory, ContextItem, ContextNode, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Coordinates, CoordinatesSource, DEFAULT_PAGE_SIZE, DataCategory, DictionaryUnitItemLink, Event, Gallery, Heading, HeadingDataCategory, HierarchyDataCategory, HierarchyItemCategoryFromOption, HierarchyItemCategoryOption, HierarchyItemDataCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemLink, ItemLinkCategory, ItemLinks, ItemLocation, ItemsDataCategory, License, Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringText, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyOptions, PropertyValue, PropertyValueContent, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, RecursiveDataCategory, Resource, ResourceItemLink, Scope, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemDataCategory, SetItemLink, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SingleHierarchyProperty, SingleHierarchySimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Style, StylesheetCategory, StylesheetItem, Text, TextItemLink, Tree, TreeItemLink, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebSegment, WebSegmentItem, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByLabelName, getPropertyByLabelNameAndValue, getPropertyByLabelNameAndValueContent, getPropertyByLabelNameAndValueContents, getPropertyByLabelNameAndValues, getPropertyByLabelUuid, getPropertyValueByLabelName, getPropertyValueByLabelUuid, getPropertyValueContentByLabelName, getPropertyValueContentByLabelUuid, getPropertyValueContentsByLabelUuid, getPropertyValuesByLabelName, getPropertyValuesByLabelUuid, getUniqueProperties, getUniquePropertyLabelNames, withLanguages };
package/dist/index.mjs CHANGED
@@ -510,7 +510,7 @@ function flattenProperties(properties) {
510
510
  const result = [];
511
511
  for (const property of properties) {
512
512
  result.push({
513
- label: property.label,
513
+ variable: property.variable,
514
514
  values: property.values,
515
515
  comment: property.comment
516
516
  });
@@ -1448,7 +1448,7 @@ function parseEvent(rawEvent, options) {
1448
1448
  end: endDate
1449
1449
  },
1450
1450
  label: parseRequiredContentLike(rawEvent.label, options),
1451
- comment: parseContentLike(rawEvent.comment, options)?.getText() ?? null,
1451
+ comment: parseContentLike(rawEvent.comment, options),
1452
1452
  agent: parseEventReference(rawEvent.agent, options),
1453
1453
  location: parseEventReference(rawEvent.location, options),
1454
1454
  other: rawEvent.other == null ? null : {
@@ -1655,21 +1655,25 @@ function parseImageMap(rawImageMap) {
1655
1655
  function parseNote(rawNote, options) {
1656
1656
  const authors = [];
1657
1657
  for (const author of rawNote.authors?.author ?? []) authors.push(parsePerson(author, options));
1658
- let title = rawNote.title ?? null;
1659
- if (title == null) {
1660
- for (const content of rawNote.content ?? []) if (options.languages.includes(content.lang) && content.title != null) {
1661
- title = content.title;
1662
- break;
1663
- }
1664
- }
1665
1658
  const content = rawNote.content == null ? multilingualFromText(parseXMLString(rawNote, { parseEmail: true }), options) : parseRequiredContentLike(rawNote, options);
1666
1659
  return {
1667
1660
  number: rawNote.noteNo ?? 0,
1668
- title,
1661
+ title: parseNoteTitle(rawNote, options),
1669
1662
  content,
1670
1663
  authors
1671
1664
  };
1672
1665
  }
1666
+ function parseNoteTitle(rawNote, options) {
1667
+ if (rawNote.title != null) return multilingualFromText(rawNote.title, options);
1668
+ const titleContent = {};
1669
+ for (const content of rawNote.content ?? []) {
1670
+ if (!options.languages.includes(content.lang) || content.title == null) continue;
1671
+ titleContent[content.lang] = content.title;
1672
+ }
1673
+ if (Object.keys(titleContent).length > 0) return MultilingualString.fromObject(titleContent, options.languages);
1674
+ for (const content of rawNote.content ?? []) if (content.lang !== "zxx" && content.title != null) return multilingualFromText(content.title, options);
1675
+ return null;
1676
+ }
1673
1677
  function parseNotes(rawNotes, options) {
1674
1678
  const notes = [];
1675
1679
  for (const note of rawNotes?.note ?? []) notes.push(parseNote(note, options));
@@ -1736,10 +1740,10 @@ function parseProperty(rawProperty, options) {
1736
1740
  const properties = [];
1737
1741
  for (const property of rawProperty.property ?? []) properties.push(parseProperty(property, options));
1738
1742
  return {
1739
- label: {
1743
+ variable: {
1740
1744
  uuid: rawProperty.label.uuid,
1741
- publicationDateTime: rawProperty.label.publicationDateTime ?? null,
1742
- name: parseContentLikeText(rawProperty.label, options)
1745
+ label: parseRequiredContentLike(rawProperty.label, options),
1746
+ publicationDateTime: rawProperty.label.publicationDateTime ?? null
1743
1747
  },
1744
1748
  values,
1745
1749
  comment: parseContentLike(rawProperty.comment, options),
@@ -1751,10 +1755,31 @@ function parseProperties(rawProperties, options) {
1751
1755
  for (const property of rawProperties?.property ?? []) properties.push(parseProperty(property, options));
1752
1756
  return properties;
1753
1757
  }
1758
+ function parseSimplifiedProperty(rawProperty, options) {
1759
+ const values = [];
1760
+ for (const value of rawProperty.value ?? []) values.push(parsePropertyValueContent(value, options));
1761
+ const properties = [];
1762
+ for (const property of rawProperty.property ?? []) properties.push(parseSimplifiedProperty(property, options));
1763
+ return {
1764
+ variable: {
1765
+ uuid: rawProperty.label.uuid,
1766
+ label: parseContentLikeText(rawProperty.label, options),
1767
+ publicationDateTime: rawProperty.label.publicationDateTime ?? null
1768
+ },
1769
+ values,
1770
+ comment: parseContentLike(rawProperty.comment, options),
1771
+ properties
1772
+ };
1773
+ }
1774
+ function parseSimplifiedProperties(rawProperties, options) {
1775
+ const properties = [];
1776
+ for (const property of rawProperties?.property ?? []) properties.push(parseSimplifiedProperty(property, options));
1777
+ return properties;
1778
+ }
1754
1779
  function parseSingleHierarchyProperty(rawProperty, options) {
1755
1780
  const property = parseProperty(rawProperty, options);
1756
1781
  return {
1757
- label: property.label,
1782
+ variable: property.variable,
1758
1783
  values: property.values,
1759
1784
  comment: property.comment
1760
1785
  };
@@ -4698,9 +4723,20 @@ async function fetchSetItems(params, itemCategories, options) {
4698
4723
  }
4699
4724
  //#endregion
4700
4725
  //#region src/fetchers/set/property-values.ts
4701
- function parsePropertyValueLabel(content) {
4702
- if (content == null || content === "") return null;
4703
- return content === "<unassigned>" ? null : content;
4726
+ function getLabelContentLanguages(content) {
4727
+ const languages = [];
4728
+ for (const contentItem of content) if (contentItem.lang !== "zxx" && !languages.includes(contentItem.lang)) languages.push(contentItem.lang);
4729
+ return languages.length > 0 ? languages : [...DEFAULT_LANGUAGES];
4730
+ }
4731
+ function parsePropertyValueLabelText(text) {
4732
+ if (text == null || text === "") return null;
4733
+ return text === "<unassigned>" ? null : text;
4734
+ }
4735
+ function parsePropertyValueLabel(content, text) {
4736
+ if (content != null && content.length > 0) return parseXMLContent({ content }, { languages: getLabelContentLanguages(content) });
4737
+ const parsedText = parsePropertyValueLabelText(text);
4738
+ if (parsedText == null) return null;
4739
+ return MultilingualString.fromObject({ [DEFAULT_LANGUAGES[0]]: parsedText });
4704
4740
  }
4705
4741
  function parsePropertyValueBooleanContent(rawValue) {
4706
4742
  if (rawValue == null || rawValue === "") return null;
@@ -4723,7 +4759,9 @@ function normalizePropertyValueDataType(dataType) {
4723
4759
  function sortPropertyValues(values) {
4724
4760
  return values.toSorted((a, b) => {
4725
4761
  if (a.count !== b.count) return b.count - a.count;
4726
- if (a.label !== b.label) return a.label?.localeCompare(b.label ?? "") ?? 0;
4762
+ const label = a.label?.getText() ?? null;
4763
+ const otherLabel = b.label?.getText() ?? null;
4764
+ if (label !== otherLabel) return label?.localeCompare(otherLabel ?? "") ?? 0;
4727
4765
  return a.content?.toString().localeCompare(b.content?.toString() ?? "") ?? 0;
4728
4766
  });
4729
4767
  }
@@ -4741,6 +4779,11 @@ const countSchema = v.pipe(v.optional(v.union([v.number(), v.string()]), 1), v.t
4741
4779
  const count = Number(val);
4742
4780
  return Number.isFinite(count) ? count : 1;
4743
4781
  }));
4782
+ const propertyValueLabelStringSchema = v.object({ payload: v.optional(v.string(), "") });
4783
+ const propertyValueLabelContentSchema = v.object({
4784
+ lang: v.string(),
4785
+ string: v.array(propertyValueLabelStringSchema)
4786
+ });
4744
4787
  function getPropertyVariableUuidsFromQueries(queries) {
4745
4788
  const propertyVariableUuids = /* @__PURE__ */ new Set();
4746
4789
  if (queries == null) return [];
@@ -4783,10 +4826,11 @@ const propertyValueQueryItemSchema = v.pipe(v.object({
4783
4826
  globalCount: v.nullish(countSchema),
4784
4827
  dataType: v.optional(v.string(), "string"),
4785
4828
  rawValue: v.optional(v.string()),
4786
- payload: v.optional(v.string())
4829
+ payload: v.optional(v.string()),
4830
+ content: v.optional(v.array(propertyValueLabelContentSchema))
4787
4831
  }), v.transform((val) => {
4788
4832
  const dataType = normalizePropertyValueDataType(val.dataType);
4789
- const label = parsePropertyValueLabel(val.payload);
4833
+ const label = parsePropertyValueLabel(val.content, val.payload);
4790
4834
  const returnValue = {
4791
4835
  scope: val.scope,
4792
4836
  variableUuid: val.variableUuid != null && val.variableUuid !== "" ? val.variableUuid : null,
@@ -4811,9 +4855,11 @@ const propertyValueQueryItemSchema = v.pipe(v.object({
4811
4855
  case "boolean":
4812
4856
  returnValue.content = parsePropertyValueBooleanContent(val.rawValue);
4813
4857
  break;
4814
- default:
4815
- returnValue.content = val.rawValue != null && val.rawValue !== "" ? val.rawValue.toString() : label ?? null;
4858
+ default: {
4859
+ const labelText = label?.getText() ?? null;
4860
+ returnValue.content = val.rawValue != null && val.rawValue !== "" ? val.rawValue.toString() : labelText;
4816
4861
  break;
4862
+ }
4817
4863
  }
4818
4864
  return returnValue;
4819
4865
  }));
@@ -4874,12 +4920,20 @@ function buildXQuery(params) {
4874
4920
  )
4875
4921
  };
4876
4922
 
4877
- declare function local:value-display($v) {
4923
+ declare function local:value-display-text($v) {
4878
4924
  if ($v/content)
4879
4925
  then string-join($v/content[@xml:lang="eng"]//text(), "")
4880
4926
  else string($v)
4881
4927
  };
4882
4928
 
4929
+ declare function local:value-label-content($v) {
4930
+ if ($v/content) then
4931
+ for $content in $v/content
4932
+ let $lang := string($content/@xml:lang)
4933
+ return <content lang="{$lang}"><string>{string-join($content//text(), "")}</string></content>
4934
+ else ()
4935
+ };
4936
+
4883
4937
  declare function local:value-content($data-type, $raw-value, $value-uuid, $display) {
4884
4938
  if ($data-type = "IDREF") then $value-uuid
4885
4939
  else if ($data-type = ("integer", "decimal", "time")) then
@@ -4914,7 +4968,8 @@ declare function local:put-property-detail(
4914
4968
  $value-uuid,
4915
4969
  $raw-value,
4916
4970
  $data-type,
4917
- $display
4971
+ $display,
4972
+ $label-content
4918
4973
  ) {
4919
4974
  let $existing := map:get($details, $key)
4920
4975
  return
@@ -4925,7 +4980,7 @@ declare function local:put-property-detail(
4925
4980
  map:put(
4926
4981
  $details,
4927
4982
  $key,
4928
- <propertyValue scope="{$scope}" variableUuid="{$variable-uuid}" uuid="{$value-uuid}" rawValue="{$raw-value}" dataType="{$data-type}">{$display}</propertyValue>
4983
+ <propertyValue scope="{$scope}" variableUuid="{$variable-uuid}" uuid="{$value-uuid}" rawValue="{$raw-value}" dataType="{$data-type}">{$label-content}{$display}</propertyValue>
4929
4984
  )
4930
4985
  else ()
4931
4986
  };
@@ -4940,13 +4995,14 @@ declare function local:add-property-facet(
4940
4995
  $value-uuid,
4941
4996
  $raw-value,
4942
4997
  $data-type,
4943
- $display
4998
+ $display,
4999
+ $label-content
4944
5000
  ) {
4945
5001
  if (exists(map:get($seen, $key))) then ()
4946
5002
  else (
4947
5003
  map:put($seen, $key, true()),
4948
5004
  local:increment-count($counts, $key),
4949
- local:put-property-detail($details, $key, $scope, $variable-uuid, $value-uuid, $raw-value, $data-type, $display)
5005
+ local:put-property-detail($details, $key, $scope, $variable-uuid, $value-uuid, $raw-value, $data-type, $display, $label-content)
4950
5006
  )
4951
5007
  };
4952
5008
 
@@ -4977,7 +5033,8 @@ let $_property-aggregation := xdmp:eager(
4977
5033
  let $value-uuid := string($v/@uuid)
4978
5034
  let $raw-value := string($v/@rawValue)
4979
5035
  let $data-type := string($v/@dataType)
4980
- let $display := local:value-display($v)
5036
+ let $display := local:value-display-text($v)
5037
+ let $label-content := local:value-label-content($v)
4981
5038
  let $content := local:value-content($data-type, $raw-value, $value-uuid, $display)
4982
5039
  let $value-kind := local:value-kind($data-type)
4983
5040
  let $output-raw-value := local:property-output-raw-value($data-type, $raw-value, $content)
@@ -4986,7 +5043,7 @@ let $_property-aggregation := xdmp:eager(
4986
5043
  where $content != ""
4987
5044
  return (
4988
5045
  local:add-attribute-facet($global-property-counts, $global-seen, $global-key),
4989
- local:add-property-facet($variable-property-counts, $variable-property-details, $variable-seen, $variable-key, "variable", $variable-uuid, $value-uuid, $output-raw-value, $data-type, $display),
5046
+ local:add-property-facet($variable-property-counts, $variable-property-details, $variable-seen, $variable-key, "variable", $variable-uuid, $value-uuid, $output-raw-value, $data-type, $display, $label-content),
4990
5047
  map:put($variable-property-global-keys, $variable-key, $global-key)
4991
5048
  )
4992
5049
  )
@@ -5176,14 +5233,17 @@ function withDefaultOptions(options) {
5176
5233
  limitToLeafPropertyValues: options.limitToLeafPropertyValues ?? true
5177
5234
  };
5178
5235
  }
5179
- function findPropertyByLabelUuid(properties, labelUuid) {
5180
- for (const property of properties) if (property.label.uuid === labelUuid) return property;
5236
+ function findPropertyByVariableUuid(properties, labelUuid) {
5237
+ for (const property of properties) if (property.variable.uuid === labelUuid) return property;
5181
5238
  return null;
5182
5239
  }
5183
- function findPropertyByLabelName(properties, labelName) {
5184
- for (const property of properties) if (property.label.name === labelName) return property;
5240
+ function findPropertyByVariableLabelName(properties, labelName) {
5241
+ for (const property of properties) if (getPropertyVariableLabelName(property) === labelName) return property;
5185
5242
  return null;
5186
5243
  }
5244
+ function getPropertyVariableLabelName(property) {
5245
+ return typeof property.variable.label === "string" ? property.variable.label : property.variable.label.getText();
5246
+ }
5187
5247
  function propertyHasValue(property, value) {
5188
5248
  for (const candidateValue of property.values) if (deepEqual(candidateValue, value)) return true;
5189
5249
  return false;
@@ -5269,36 +5329,36 @@ function visitProperties(properties, includeNestedProperties, visit) {
5269
5329
  }
5270
5330
  function getPropertyByLabelUuid(properties, labelUuid, options = DEFAULT_OPTIONS) {
5271
5331
  const { includeNestedProperties } = withDefaultOptions(options);
5272
- return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByLabelUuid(currentProperties, labelUuid));
5332
+ return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByVariableUuid(currentProperties, labelUuid));
5273
5333
  }
5274
5334
  /**
5275
- * Retrieves all values for a property with the given label UUID.
5335
+ * Retrieves all values for a property with the given variable UUID.
5276
5336
  *
5277
5337
  * @param properties - Array of properties to search through
5278
- * @param labelUuid - The property label UUID to search for
5338
+ * @param labelUuid - The property variable UUID to search for
5279
5339
  * @param options - Search options, including whether to include nested properties
5280
5340
  * @returns Array of property values, or null if property not found
5281
5341
  */
5282
5342
  function getPropertyValuesByLabelUuid(properties, labelUuid, options = DEFAULT_OPTIONS) {
5283
5343
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5284
5344
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5285
- const property = findPropertyByLabelUuid(currentProperties, labelUuid);
5345
+ const property = findPropertyByVariableUuid(currentProperties, labelUuid);
5286
5346
  if (property == null) return null;
5287
5347
  return getPropertyValuesResult(property.values, limitToLeafPropertyValues, true);
5288
5348
  }, (nestedResult) => getPropertyValuesResult(nestedResult, limitToLeafPropertyValues, true));
5289
5349
  }
5290
5350
  /**
5291
- * Retrieves all value contents for a property with the given label UUID.
5351
+ * Retrieves all value contents for a property with the given variable UUID.
5292
5352
  *
5293
5353
  * @param properties - Array of properties to search through
5294
- * @param labelUuid - The property label UUID to search for
5354
+ * @param labelUuid - The property variable UUID to search for
5295
5355
  * @param options - Search options, including whether to include nested properties
5296
5356
  * @returns Array of property value contents, or null if property not found
5297
5357
  */
5298
5358
  function getPropertyValueContentsByLabelUuid(properties, labelUuid, options = DEFAULT_OPTIONS) {
5299
5359
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5300
5360
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5301
- const property = findPropertyByLabelUuid(currentProperties, labelUuid);
5361
+ const property = findPropertyByVariableUuid(currentProperties, labelUuid);
5302
5362
  if (property == null) return null;
5303
5363
  const valueContents = [];
5304
5364
  for (const value of getPropertyValuesResult(property.values, limitToLeafPropertyValues, false)) valueContents.push(value.content);
@@ -5306,10 +5366,10 @@ function getPropertyValueContentsByLabelUuid(properties, labelUuid, options = DE
5306
5366
  });
5307
5367
  }
5308
5368
  /**
5309
- * Gets the first value of a property with the given label UUID.
5369
+ * Gets the first value of a property with the given variable UUID.
5310
5370
  *
5311
5371
  * @param properties - Array of properties to search through
5312
- * @param labelUuid - The property label UUID to search for
5372
+ * @param labelUuid - The property variable UUID to search for
5313
5373
  * @param options - Search options, including whether to include nested properties
5314
5374
  * @returns The first property value, or null if property not found
5315
5375
  */
@@ -5325,10 +5385,10 @@ function getPropertyValueByLabelUuid(properties, labelUuid, options = DEFAULT_OP
5325
5385
  }, (nestedResult) => getFirstPropertyValueResult([nestedResult], limitToLeafPropertyValues));
5326
5386
  }
5327
5387
  /**
5328
- * Gets the first value content of a property with the given label UUID.
5388
+ * Gets the first value content of a property with the given variable UUID.
5329
5389
  *
5330
5390
  * @param properties - Array of properties to search through
5331
- * @param labelUuid - The property label UUID to search for
5391
+ * @param labelUuid - The property variable UUID to search for
5332
5392
  * @param options - Search options, including whether to include nested properties
5333
5393
  * @returns The first property value content, or null if property not found
5334
5394
  */
@@ -5345,57 +5405,57 @@ function getPropertyValueContentByLabelUuid(properties, labelUuid, options = DEF
5345
5405
  }
5346
5406
  function getPropertyByLabelName(properties, labelName, options = DEFAULT_OPTIONS) {
5347
5407
  const { includeNestedProperties } = withDefaultOptions(options);
5348
- return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByLabelName(currentProperties, labelName));
5408
+ return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByVariableLabelName(currentProperties, labelName));
5349
5409
  }
5350
5410
  function getPropertyByLabelNameAndValues(properties, labelName, values, options = DEFAULT_OPTIONS) {
5351
5411
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5352
5412
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5353
- for (const property of currentProperties) if (property.label.name === labelName && deepEqual(property.values, values)) return getNormalizedProperty(property, limitToLeafPropertyValues);
5413
+ for (const property of currentProperties) if (getPropertyVariableLabelName(property) === labelName && deepEqual(property.values, values)) return getNormalizedProperty(property, limitToLeafPropertyValues);
5354
5414
  return null;
5355
5415
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5356
5416
  }
5357
5417
  function getPropertyByLabelNameAndValueContents(properties, labelName, valueContents, options = DEFAULT_OPTIONS) {
5358
5418
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5359
5419
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5360
- for (const property of currentProperties) if (property.label.name === labelName && propertyValueContentsEqual(property, valueContents)) return getNormalizedProperty(property, limitToLeafPropertyValues, clonePropertyValues);
5420
+ for (const property of currentProperties) if (getPropertyVariableLabelName(property) === labelName && propertyValueContentsEqual(property, valueContents)) return getNormalizedProperty(property, limitToLeafPropertyValues, clonePropertyValues);
5361
5421
  return null;
5362
5422
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5363
5423
  }
5364
5424
  function getPropertyByLabelNameAndValue(properties, labelName, value, options = DEFAULT_OPTIONS) {
5365
5425
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5366
5426
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5367
- for (const property of currentProperties) if (property.label.name === labelName && propertyHasValue(property, value)) return getNormalizedProperty(property, limitToLeafPropertyValues);
5427
+ for (const property of currentProperties) if (getPropertyVariableLabelName(property) === labelName && propertyHasValue(property, value)) return getNormalizedProperty(property, limitToLeafPropertyValues);
5368
5428
  return null;
5369
5429
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5370
5430
  }
5371
5431
  function getPropertyByLabelNameAndValueContent(properties, labelName, valueContent, options = DEFAULT_OPTIONS) {
5372
5432
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5373
5433
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5374
- for (const property of currentProperties) if (property.label.name === labelName && propertyHasValueContent(property, valueContent)) return getNormalizedProperty(property, limitToLeafPropertyValues);
5434
+ for (const property of currentProperties) if (getPropertyVariableLabelName(property) === labelName && propertyHasValueContent(property, valueContent)) return getNormalizedProperty(property, limitToLeafPropertyValues);
5375
5435
  return null;
5376
5436
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5377
5437
  }
5378
5438
  /**
5379
- * Retrieves all values for a property with the given label name.
5439
+ * Retrieves all values for a property with the given variable label name.
5380
5440
  *
5381
5441
  * @param properties - Array of properties to search through
5382
- * @param labelName - The property label name to search for
5442
+ * @param labelName - The property variable label name to search for
5383
5443
  * @param options - Search options, including whether to include nested properties
5384
5444
  * @returns Array of property values, or null if property not found
5385
5445
  */
5386
5446
  function getPropertyValuesByLabelName(properties, labelName, options = DEFAULT_OPTIONS) {
5387
5447
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5388
5448
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5389
- const property = findPropertyByLabelName(currentProperties, labelName);
5449
+ const property = findPropertyByVariableLabelName(currentProperties, labelName);
5390
5450
  if (property == null) return null;
5391
5451
  return getPropertyValuesResult(property.values, limitToLeafPropertyValues, false);
5392
5452
  }, (nestedResult) => getPropertyValuesResult(nestedResult, limitToLeafPropertyValues, false));
5393
5453
  }
5394
5454
  /**
5395
- * Gets the first value of a property with the given label name.
5455
+ * Gets the first value of a property with the given variable label name.
5396
5456
  *
5397
5457
  * @param properties - Array of properties to search through
5398
- * @param labelName - The property label name to search for
5458
+ * @param labelName - The property variable label name to search for
5399
5459
  * @param options - Search options, including whether to include nested properties
5400
5460
  * @returns The first property value, or null if property not found
5401
5461
  */
@@ -5411,10 +5471,10 @@ function getPropertyValueByLabelName(properties, labelName, options = DEFAULT_OP
5411
5471
  }, (nestedResult) => getFirstPropertyValueResult([nestedResult], limitToLeafPropertyValues));
5412
5472
  }
5413
5473
  /**
5414
- * Gets the first value content of a property with the given label name.
5474
+ * Gets the first value content of a property with the given variable label name.
5415
5475
  *
5416
5476
  * @param properties - Array of properties to search through
5417
- * @param labelName - The property label name to search for
5477
+ * @param labelName - The property variable label name to search for
5418
5478
  * @param options - Search options, including whether to include nested properties
5419
5479
  * @returns The first property value content, or null if property not found
5420
5480
  */
@@ -5433,7 +5493,7 @@ function getUniqueProperties(properties, options = DEFAULT_OPTIONS) {
5433
5493
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5434
5494
  const uniqueProperties = [];
5435
5495
  visitProperties(properties, includeNestedProperties, (property) => {
5436
- for (const uniqueProperty of uniqueProperties) if (uniqueProperty.label.uuid === property.label.uuid) return;
5496
+ for (const uniqueProperty of uniqueProperties) if (uniqueProperty.variable.uuid === property.variable.uuid) return;
5437
5497
  uniqueProperties.push(property);
5438
5498
  });
5439
5499
  if (limitToLeafPropertyValues) {
@@ -5444,18 +5504,19 @@ function getUniqueProperties(properties, options = DEFAULT_OPTIONS) {
5444
5504
  return uniqueProperties;
5445
5505
  }
5446
5506
  /**
5447
- * Gets all unique property label names from an array of properties.
5507
+ * Gets all unique property variable label names from an array of properties.
5448
5508
  *
5449
- * @param properties - Array of properties to get unique property labels from
5509
+ * @param properties - Array of properties to get unique property variable labels from
5450
5510
  * @param options - Search options, including whether to include nested properties
5451
- * @returns Array of unique property label names
5511
+ * @returns Array of unique property variable label names
5452
5512
  */
5453
5513
  function getUniquePropertyLabelNames(properties, options = DEFAULT_OPTIONS) {
5454
5514
  const { includeNestedProperties } = withDefaultOptions(options);
5455
5515
  const uniquePropertyLabels = [];
5456
5516
  visitProperties(properties, includeNestedProperties, (property) => {
5457
- if (uniquePropertyLabels.includes(property.label.name)) return;
5458
- uniquePropertyLabels.push(property.label.name);
5517
+ const labelName = getPropertyVariableLabelName(property);
5518
+ if (uniquePropertyLabels.includes(labelName)) return;
5519
+ uniquePropertyLabels.push(labelName);
5459
5520
  });
5460
5521
  return uniquePropertyLabels;
5461
5522
  }
@@ -5476,18 +5537,18 @@ function contentMatchesFilter(content, filterContent) {
5476
5537
  return typeof filterContent === "boolean" && content === filterContent;
5477
5538
  }
5478
5539
  /**
5479
- * Filters a property based on a label and value criterion.
5540
+ * Filters a property based on a variable label and value criterion.
5480
5541
  *
5481
5542
  * @param property - The property to filter
5482
- * @param filter - Filter criteria containing label and value to match
5483
- * @param filter.labelName - The label name to filter by
5543
+ * @param filter - Filter criteria containing variable label and value to match
5544
+ * @param filter.labelName - The variable label name to filter by
5484
5545
  * @param filter.value - The value to filter by
5485
5546
  * @param options - Search options, including whether to include nested properties
5486
5547
  * @returns True if the property matches the filter criteria, false otherwise
5487
5548
  */
5488
5549
  function filterProperties(property, filter, options = DEFAULT_OPTIONS) {
5489
5550
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5490
- if (filter.labelName.toLocaleLowerCase("en-US") === "all fields" || property.label.name.toLocaleLowerCase("en-US") === filter.labelName.toLocaleLowerCase("en-US")) {
5551
+ if (filter.labelName.toLocaleLowerCase("en-US") === "all fields" || getPropertyVariableLabelName(property).toLocaleLowerCase("en-US") === filter.labelName.toLocaleLowerCase("en-US")) {
5491
5552
  const values = getPropertyValuesResult(property.values, limitToLeafPropertyValues, false);
5492
5553
  for (const value of values) if (contentMatchesFilter(value.content, filter.value.content)) return true;
5493
5554
  }
@@ -5555,12 +5616,21 @@ function parseCssStylesFromProperties(properties, cssVariant) {
5555
5616
  for (const property of cssProperties) {
5556
5617
  const value = property.values[0]?.content.toString();
5557
5618
  if (value != null) styles.push({
5558
- label: property.label.name,
5619
+ label: property.variable.label,
5559
5620
  value
5560
5621
  });
5561
5622
  }
5562
5623
  return styles;
5563
5624
  }
5625
+ function getPropertyValueMultilingualContent(propertyValue, options) {
5626
+ if (propertyValue == null) return null;
5627
+ if (propertyValue.label != null) return propertyValue.label;
5628
+ if (typeof propertyValue.content === "string") return multilingualFromText(propertyValue.content, options);
5629
+ return null;
5630
+ }
5631
+ function getPropertyMultilingualValueByLabelName(properties, labelName, options) {
5632
+ return getPropertyValueMultilingualContent(getPropertyValueByLabelName(properties, labelName), options);
5633
+ }
5564
5634
  /**
5565
5635
  * Parses responsive CSS styles (default, tablet, mobile) from properties.
5566
5636
  *
@@ -5633,7 +5703,7 @@ function parseWebsiteOptions(rawOptions, options) {
5633
5703
  contextTree: rawOptions == null ? null : parseAllOptionContexts(rawOptions, options),
5634
5704
  labels: { title: null }
5635
5705
  };
5636
- for (const note of parseNotes(rawOptions?.notes, options)) if (note.title === "Title label") {
5706
+ for (const note of parseNotes(rawOptions?.notes, options)) if (note.title?.getText() === "Title label") {
5637
5707
  parsedOptions.labels.title = note.content;
5638
5708
  break;
5639
5709
  }
@@ -6064,7 +6134,7 @@ function parseWebElementProperties(componentProperty, elementResource, options)
6064
6134
  if (componentProperty.properties.length === 0) throw new Error(formatComponentError("Query properties not found", componentName, elementResource));
6065
6135
  for (const queryItem of componentProperty.properties) {
6066
6136
  const querySubProperties = queryItem.properties;
6067
- const label = getPropertyValueContentByLabelName(querySubProperties, "query-prompt");
6137
+ const label = getPropertyMultilingualValueByLabelName(querySubProperties, "query-prompt", options);
6068
6138
  if (label === null) continue;
6069
6139
  const propertyVariables = getPropertyByLabelName(querySubProperties, "use-property")?.values.filter((value) => value.uuid !== null) ?? [];
6070
6140
  const queryLanguage = options.languages[0];
@@ -6140,7 +6210,7 @@ function parseWebElementProperties(componentProperty, elementResource, options)
6140
6210
  const linkToProperty = getPropertyByLabelName(componentProperty.properties, "link-to");
6141
6211
  const href = linkToProperty?.values[0]?.href != null ? transformPermanentIdentificationUrlToItemLink(linkToProperty.values[0].href) : linkToProperty?.values[0]?.slug ?? null;
6142
6212
  if (!boundElementUuid && !href) throw new Error(formatComponentError("Bound element or href not found", componentName, elementResource));
6143
- let placeholder = getPropertyValueContentByLabelName(componentProperty.properties, "placeholder-text");
6213
+ let placeholder = getPropertyMultilingualValueByLabelName(componentProperty.properties, "placeholder-text", options);
6144
6214
  placeholder ??= null;
6145
6215
  let baseFilterQueries = getPropertyValueContentByLabelName(componentProperty.properties, "base-filter-queries");
6146
6216
  baseFilterQueries ??= null;
@@ -6240,7 +6310,7 @@ function parseWebTitle(properties, identification, overrides) {
6240
6310
  */
6241
6311
  function parseWebElement(elementResource, options) {
6242
6312
  const identification = parseIdentification(elementResource.identification, options);
6243
- const elementProperties = elementResource.properties?.property ? parseProperties(elementResource.properties, options) : [];
6313
+ const elementProperties = elementResource.properties?.property ? parseSimplifiedProperties(elementResource.properties, options) : [];
6244
6314
  const presentationProperty = getPropertyByLabelName(elementProperties, "presentation");
6245
6315
  if (presentationProperty === null) throw new Error(`Presentation property not found for element (${formatXMLWebsiteResourceMetadata(elementResource)})`);
6246
6316
  const componentProperty = getPropertyByLabelName(presentationProperty.properties, "component");
@@ -6269,7 +6339,7 @@ function parseWebElement(elementResource, options) {
6269
6339
  const parseWebpageResources = (webpageResources, type, options) => {
6270
6340
  const returnElements = [];
6271
6341
  for (const resource of webpageResources) {
6272
- if (getPropertyByLabelNameAndValueContent(resource.properties ? parseProperties(resource.properties, options) : [], "presentation", type) === null) continue;
6342
+ if (getPropertyByLabelNameAndValueContent(resource.properties ? parseSimplifiedProperties(resource.properties, options) : [], "presentation", type) === null) continue;
6273
6343
  switch (type) {
6274
6344
  case "element": {
6275
6345
  const element = parseWebElement(resource, options);
@@ -6297,7 +6367,7 @@ const parseWebpageResources = (webpageResources, type, options) => {
6297
6367
  * @returns Parsed Webpage object
6298
6368
  */
6299
6369
  function parseWebpage(webpageResource, options, slugPrefix) {
6300
- const webpageProperties = webpageResource.properties ? parseProperties(webpageResource.properties, options) : [];
6370
+ const webpageProperties = webpageResource.properties ? parseSimplifiedProperties(webpageResource.properties, options) : [];
6301
6371
  if (webpageProperties.length === 0 || getPropertyValueContentByLabelName(webpageProperties, "presentation") !== "page") return null;
6302
6372
  const identification = parseIdentification(webpageResource.identification, options);
6303
6373
  const slug = webpageResource.slug?.replace(SEGMENT_UNIQUE_SLUG_PREFIX_REGEX, "") ?? null;
@@ -6329,7 +6399,7 @@ function parseWebpage(webpageResource, options, slugPrefix) {
6329
6399
  const webpageResources = webpageResource.resource != null ? normalizeWebsiteResources(webpageResource.resource) : [];
6330
6400
  const items = [];
6331
6401
  for (const resource of webpageResources) {
6332
- const resourceType = getPropertyValueContentByLabelName(resource.properties != null ? parseProperties(resource.properties, options) : [], "presentation");
6402
+ const resourceType = getPropertyValueContentByLabelName(resource.properties != null ? parseSimplifiedProperties(resource.properties, options) : [], "presentation");
6333
6403
  if (resourceType === null) continue;
6334
6404
  switch (resourceType) {
6335
6405
  case "segment": {
@@ -6392,7 +6462,7 @@ function parseWebpages(webpageResources, options, slugPrefix) {
6392
6462
  * @returns Parsed WebSegment object
6393
6463
  */
6394
6464
  function parseWebSegment(segmentResource, options, slugPrefix) {
6395
- const webpageProperties = segmentResource.properties ? parseProperties(segmentResource.properties, options) : [];
6465
+ const webpageProperties = segmentResource.properties ? parseSimplifiedProperties(segmentResource.properties, options) : [];
6396
6466
  if (webpageProperties.length === 0 || getPropertyValueContentByLabelName(webpageProperties, "presentation") !== "segment") return null;
6397
6467
  const identification = parseIdentification(segmentResource.identification, options);
6398
6468
  const slug = segmentResource.identification.abbreviation != null ? parseStringContent(segmentResource.identification.abbreviation, options) : null;
@@ -6429,7 +6499,7 @@ function parseSegments(segmentResources, options, slugPrefix) {
6429
6499
  * @returns Parsed WebSegmentItem object
6430
6500
  */
6431
6501
  function parseWebSegmentItem(segmentItemResource, options, slugPrefix) {
6432
- const webpageProperties = segmentItemResource.properties ? parseProperties(segmentItemResource.properties, options) : [];
6502
+ const webpageProperties = segmentItemResource.properties ? parseSimplifiedProperties(segmentItemResource.properties, options) : [];
6433
6503
  if (webpageProperties.length === 0 || getPropertyValueContentByLabelName(webpageProperties, "presentation") !== "segment-item") return null;
6434
6504
  const identification = parseIdentification(segmentItemResource.identification, options);
6435
6505
  const slug = segmentItemResource.identification.abbreviation != null ? parseStringContent(segmentItemResource.identification.abbreviation, options) : null;
@@ -6478,16 +6548,16 @@ function parseSidebar(resources, options) {
6478
6548
  mobile: []
6479
6549
  };
6480
6550
  const sidebarResource = resources.find((resource) => {
6481
- const resourceProperties = resource.properties ? parseProperties(resource.properties, options) : [];
6551
+ const resourceProperties = resource.properties ? parseSimplifiedProperties(resource.properties, options) : [];
6482
6552
  return getPropertyValueContentByLabelName(resourceProperties, "presentation") === "element" && getPropertyValueContentByLabelName(resourceProperties[0]?.properties ?? [], "component") === "sidebar";
6483
6553
  });
6484
6554
  if (sidebarResource != null) {
6485
- const sidebarBaseProperties = sidebarResource.properties ? parseProperties(sidebarResource.properties, options) : [];
6555
+ const sidebarBaseProperties = sidebarResource.properties ? parseSimplifiedProperties(sidebarResource.properties, options) : [];
6486
6556
  title = parseWebTitle(sidebarBaseProperties, parseIdentification(sidebarResource.identification, options));
6487
- const sidebarProperties = sidebarBaseProperties.find((property) => property.label.name === "presentation" && property.values[0]?.content === "element")?.properties.find((property) => property.label.name === "component" && property.values[0]?.content === "sidebar")?.properties ?? [];
6488
- const sidebarLayoutProperty = sidebarProperties.find((property) => property.label.name === "layout");
6557
+ const sidebarProperties = sidebarBaseProperties.find((property) => property.variable.label === "presentation" && property.values[0]?.content === "element")?.properties.find((property) => property.variable.label === "component" && property.values[0]?.content === "sidebar")?.properties ?? [];
6558
+ const sidebarLayoutProperty = sidebarProperties.find((property) => property.variable.label === "layout");
6489
6559
  if (sidebarLayoutProperty) layout = sidebarLayoutProperty.values[0].content;
6490
- const sidebarMobileLayoutProperty = sidebarProperties.find((property) => property.label.name === "layout-mobile");
6560
+ const sidebarMobileLayoutProperty = sidebarProperties.find((property) => property.variable.label === "layout-mobile");
6491
6561
  if (sidebarMobileLayoutProperty) mobileLayout = sidebarMobileLayoutProperty.values[0].content;
6492
6562
  const parsedCssStyles = parseResponsiveCssStyles(sidebarBaseProperties);
6493
6563
  cssStyles.default = parsedCssStyles.default;
@@ -6495,7 +6565,7 @@ function parseSidebar(resources, options) {
6495
6565
  cssStyles.mobile = parsedCssStyles.mobile;
6496
6566
  const sidebarResources = sidebarResource.resource ? normalizeWebsiteResources(sidebarResource.resource) : [];
6497
6567
  for (const resource of sidebarResources) {
6498
- const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseProperties(resource.properties, options) : [], "presentation");
6568
+ const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseSimplifiedProperties(resource.properties, options) : [], "presentation");
6499
6569
  if (resourceType === null) continue;
6500
6570
  switch (resourceType) {
6501
6571
  case "element": {
@@ -6532,7 +6602,7 @@ function parseWebElementForAccordion(elementResource, options) {
6532
6602
  const childResources = elementResource.resource ? normalizeWebsiteResources(elementResource.resource) : [];
6533
6603
  const items = [];
6534
6604
  for (const resource of childResources) {
6535
- const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseProperties(resource.properties, options) : [], "presentation");
6605
+ const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseSimplifiedProperties(resource.properties, options) : [], "presentation");
6536
6606
  if (resourceType === null) continue;
6537
6607
  switch (resourceType) {
6538
6608
  case "element": {
@@ -6559,7 +6629,7 @@ function parseWebElementForAccordion(elementResource, options) {
6559
6629
  * @returns Parsed WebBlock object
6560
6630
  */
6561
6631
  function parseWebBlock(blockResource, options) {
6562
- const blockProperties = blockResource.properties ? parseProperties(blockResource.properties, options) : [];
6632
+ const blockProperties = blockResource.properties ? parseSimplifiedProperties(blockResource.properties, options) : [];
6563
6633
  const returnBlock = {
6564
6634
  uuid: blockResource.uuid,
6565
6635
  type: "block",
@@ -6637,7 +6707,7 @@ function parseWebBlock(blockResource, options) {
6637
6707
  if (returnBlock.properties.default.layout === "accordion") {
6638
6708
  const accordionItems = [];
6639
6709
  for (const resource of blockResources) {
6640
- const resourceProperties = resource.properties ? parseProperties(resource.properties, options) : [];
6710
+ const resourceProperties = resource.properties ? parseSimplifiedProperties(resource.properties, options) : [];
6641
6711
  const resourceType = getPropertyValueContentByLabelName(resourceProperties, "presentation");
6642
6712
  if (resourceType !== "element") throw new Error(`Accordion only accepts elements, but got “${resourceType}” (${formatXMLWebsiteResourceMetadata(resource)})`);
6643
6713
  const componentType = getPropertyValueContentByLabelName(getPropertyByLabelName(resourceProperties, "presentation")?.properties ?? [], "component");
@@ -6649,7 +6719,7 @@ function parseWebBlock(blockResource, options) {
6649
6719
  } else {
6650
6720
  const blockItems = [];
6651
6721
  for (const resource of blockResources) {
6652
- const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseProperties(resource.properties, options) : [], "presentation");
6722
+ const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseSimplifiedProperties(resource.properties, options) : [], "presentation");
6653
6723
  if (resourceType === null) continue;
6654
6724
  switch (resourceType) {
6655
6725
  case "element": {
@@ -6676,7 +6746,7 @@ function parseWebBlock(blockResource, options) {
6676
6746
  * @returns Parsed WebsiteProperties object
6677
6747
  */
6678
6748
  function parseWebsiteProperties(properties, websiteTree, sidebar, options) {
6679
- const websiteProperties = getPropertyByLabelName(parseProperties({ property: properties }, options), "presentation")?.properties ?? [];
6749
+ const websiteProperties = getPropertyByLabelName(parseSimplifiedProperties({ property: properties }, options), "presentation")?.properties ?? [];
6680
6750
  let type = getPropertyValueContentByLabelName(websiteProperties, "webUI");
6681
6751
  type ??= "traditional";
6682
6752
  let status = getPropertyValueContentByLabelName(websiteProperties, "status");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",