ochre-sdk 1.0.0-beta.6 → 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,127 +1695,146 @@ type PropertyOptions = {
1680
1695
  limitToLeafPropertyValues?: boolean;
1681
1696
  };
1682
1697
  type PropertyContent<T extends ReadonlyArray<string>> = PropertyValueContent<T>["content"];
1698
+ type SearchableProperty<T extends ReadonlyArray<string>> = Property<T> | SingleHierarchyProperty<T> | SimplifiedProperty<T> | SingleHierarchySimplifiedProperty<T>;
1683
1699
  /**
1684
- * 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.
1685
1701
  *
1686
1702
  * @param properties - Array of properties to search through
1687
- * @param labelUuid - The property label UUID to search for
1703
+ * @param labelUuid - The property variable UUID to search for
1688
1704
  * @param options - Search options, including whether to include nested properties
1689
1705
  * @returns The matching Property object, or null if not found
1690
1706
  */
1691
1707
  declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Property<T> | null;
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;
1692
1711
  /**
1693
- * Retrieves all values for a property with the given label UUID.
1712
+ * Retrieves all values for a property with the given variable UUID.
1694
1713
  *
1695
1714
  * @param properties - Array of properties to search through
1696
- * @param labelUuid - The property label UUID to search for
1715
+ * @param labelUuid - The property variable UUID to search for
1697
1716
  * @param options - Search options, including whether to include nested properties
1698
1717
  * @returns Array of property values, or null if property not found
1699
1718
  */
1700
- declare function getPropertyValuesByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1719
+ declare function getPropertyValuesByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1701
1720
  /**
1702
- * 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.
1703
1722
  *
1704
1723
  * @param properties - Array of properties to search through
1705
- * @param labelUuid - The property label UUID to search for
1724
+ * @param labelUuid - The property variable UUID to search for
1706
1725
  * @param options - Search options, including whether to include nested properties
1707
1726
  * @returns Array of property value contents, or null if property not found
1708
1727
  */
1709
- declare function getPropertyValueContentsByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
1728
+ declare function getPropertyValueContentsByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
1710
1729
  /**
1711
- * 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.
1712
1731
  *
1713
1732
  * @param properties - Array of properties to search through
1714
- * @param labelUuid - The property label UUID to search for
1733
+ * @param labelUuid - The property variable UUID to search for
1715
1734
  * @param options - Search options, including whether to include nested properties
1716
1735
  * @returns The first property value, or null if property not found
1717
1736
  */
1718
- declare function getPropertyValueByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1737
+ declare function getPropertyValueByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1719
1738
  /**
1720
- * 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.
1721
1740
  *
1722
1741
  * @param properties - Array of properties to search through
1723
- * @param labelUuid - The property label UUID to search for
1742
+ * @param labelUuid - The property variable UUID to search for
1724
1743
  * @param options - Search options, including whether to include nested properties
1725
1744
  * @returns The first property value content, or null if property not found
1726
1745
  */
1727
- declare function getPropertyValueContentByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
1746
+ declare function getPropertyValueContentByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
1728
1747
  /**
1729
- * 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.
1730
1749
  *
1731
1750
  * @param properties - Array of properties to search through
1732
- * @param labelName - The property label name to search for
1751
+ * @param labelName - The property variable label name to search for
1733
1752
  * @param options - Search options, including whether to include nested properties
1734
1753
  * @returns The matching Property object, or null if not found
1735
1754
  */
1736
1755
  declare function getPropertyByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): Property<T> | null;
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;
1737
1759
  /**
1738
- * Finds a property by its label name and all values.
1760
+ * Finds a property by its variable label name and all values.
1739
1761
  *
1740
1762
  * @param properties - Array of properties to search through
1741
- * @param labelName - The property label name to search for
1763
+ * @param labelName - The property variable label name to search for
1742
1764
  * @param values - The property values to search for
1743
1765
  * @param options - Search options, including whether to include nested properties
1744
1766
  * @returns The matching Property object, or null if not found or all values do not match
1745
1767
  */
1746
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;
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;
1747
1772
  /**
1748
- * Finds a property by its label name and all value contents.
1773
+ * Finds a property by its variable label name and all value contents.
1749
1774
  *
1750
1775
  * @param properties - Array of properties to search through
1751
- * @param labelName - The property label name to search for
1776
+ * @param labelName - The property variable label name to search for
1752
1777
  * @param valueContents - The value contents to search for
1753
1778
  * @param options - Search options, including whether to include nested properties
1754
1779
  * @returns The matching Property object, or null if not found or all value contents do not match
1755
1780
  */
1756
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;
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;
1757
1785
  /**
1758
- * Finds a property by its label name and one value.
1786
+ * Finds a property by its variable label name and one value.
1759
1787
  *
1760
1788
  * @param properties - Array of properties to search through
1761
- * @param labelName - The property label name to search for
1789
+ * @param labelName - The property variable label name to search for
1762
1790
  * @param value - The property value to search for
1763
1791
  * @param options - Search options, including whether to include nested properties
1764
1792
  * @returns The matching Property object, or null if not found or value does not match
1765
1793
  */
1766
1794
  declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
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;
1767
1798
  /**
1768
- * Finds a property by its label name and one value content.
1799
+ * Finds a property by its variable label name and one value content.
1769
1800
  *
1770
1801
  * @param properties - Array of properties to search through
1771
- * @param labelName - The property label name to search for
1802
+ * @param labelName - The property variable label name to search for
1772
1803
  * @param valueContent - The value content to search for
1773
1804
  * @param options - Search options, including whether to include nested properties
1774
1805
  * @returns The matching Property object, or null if not found or value content does not match
1775
1806
  */
1776
1807
  declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, valueContent: PropertyContent<T>, options?: PropertyOptions): Property<T> | null;
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;
1777
1811
  /**
1778
- * Retrieves all values for a property with the given label name.
1812
+ * Retrieves all values for a property with the given variable label name.
1779
1813
  *
1780
1814
  * @param properties - Array of properties to search through
1781
- * @param labelName - The property label name to search for
1815
+ * @param labelName - The property variable label name to search for
1782
1816
  * @param options - Search options, including whether to include nested properties
1783
1817
  * @returns Array of property values, or null if property not found
1784
1818
  */
1785
- declare function getPropertyValuesByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1819
+ declare function getPropertyValuesByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelName: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1786
1820
  /**
1787
- * 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.
1788
1822
  *
1789
1823
  * @param properties - Array of properties to search through
1790
- * @param labelName - The property label name to search for
1824
+ * @param labelName - The property variable label name to search for
1791
1825
  * @param options - Search options, including whether to include nested properties
1792
1826
  * @returns The first property value, or null if property not found
1793
1827
  */
1794
- declare function getPropertyValueByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1828
+ declare function getPropertyValueByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelName: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1795
1829
  /**
1796
- * 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.
1797
1831
  *
1798
1832
  * @param properties - Array of properties to search through
1799
- * @param labelName - The property label name to search for
1833
+ * @param labelName - The property variable label name to search for
1800
1834
  * @param options - Search options, including whether to include nested properties
1801
1835
  * @returns The first property value content, or null if property not found
1802
1836
  */
1803
- declare function getPropertyValueContentByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): PropertyContent<T> | null;
1837
+ declare function getPropertyValueContentByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelName: string, options?: PropertyOptions): PropertyContent<T> | null;
1804
1838
  /**
1805
1839
  * Gets all unique properties from an array of properties.
1806
1840
  *
@@ -1809,14 +1843,17 @@ declare function getPropertyValueContentByLabelName<T extends ReadonlyArray<stri
1809
1843
  * @returns Array of unique properties
1810
1844
  */
1811
1845
  declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
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>>;
1812
1849
  /**
1813
- * Gets all unique property label names from an array of properties.
1850
+ * Gets all unique property variable label names from an array of properties.
1814
1851
  *
1815
- * @param properties - Array of properties to get unique property labels from
1852
+ * @param properties - Array of properties to get unique property variable labels from
1816
1853
  * @param options - Search options, including whether to include nested properties
1817
- * @returns Array of unique property label names
1854
+ * @returns Array of unique property variable label names
1818
1855
  */
1819
- declare function getUniquePropertyLabelNames<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<string>;
1856
+ declare function getUniquePropertyLabelNames<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, options?: PropertyOptions): Array<string>;
1820
1857
  /**
1821
1858
  * Get the leaf property values from an array of property values.
1822
1859
  *
@@ -1825,16 +1862,16 @@ declare function getUniquePropertyLabelNames<T extends ReadonlyArray<string> = R
1825
1862
  */
1826
1863
  declare function getLeafPropertyValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(propertyValues: ReadonlyArray<PropertyValueContent<T>>): Array<PropertyValueContent<T>>;
1827
1864
  /**
1828
- * Filters a property based on a label and value criterion.
1865
+ * Filters a property based on a variable label and value criterion.
1829
1866
  *
1830
1867
  * @param property - The property to filter
1831
- * @param filter - Filter criteria containing label and value to match
1832
- * @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
1833
1870
  * @param filter.value - The value to filter by
1834
1871
  * @param options - Search options, including whether to include nested properties
1835
1872
  * @returns True if the property matches the filter criteria, false otherwise
1836
1873
  */
1837
- declare function filterProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(property: Property<T>, filter: {
1874
+ declare function filterProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(property: SearchableProperty<T>, filter: {
1838
1875
  labelName: string;
1839
1876
  value: PropertyValueContent<T>;
1840
1877
  }, options?: PropertyOptions): boolean;
@@ -1854,4 +1891,4 @@ declare const DEFAULT_PAGE_SIZE = 48;
1854
1891
  */
1855
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>;
1856
1893
  //#endregion
1857
- 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;
@@ -5201,6 +5261,7 @@ function searchPropertyResult(properties, options, findDirectResult, transformNe
5201
5261
  const directResult = findDirectResult(properties);
5202
5262
  if (directResult !== null) return directResult;
5203
5263
  if (options.includeNestedProperties) for (const property of properties) {
5264
+ if (!("properties" in property)) continue;
5204
5265
  const nestedResult = searchPropertyResult(property.properties, options, findDirectResult, transformNestedResult);
5205
5266
  if (nestedResult !== null) {
5206
5267
  const transformedResult = transformNestedResult != null ? transformNestedResult(nestedResult) : nestedResult;
@@ -5263,49 +5324,41 @@ function getFirstPropertyValueContentResult(values, limitToLeafPropertyValues) {
5263
5324
  function visitProperties(properties, includeNestedProperties, visit) {
5264
5325
  for (const property of properties) {
5265
5326
  visit(property);
5266
- if (includeNestedProperties) visitProperties(property.properties, includeNestedProperties, visit);
5327
+ if (includeNestedProperties && "properties" in property) visitProperties(property.properties, includeNestedProperties, visit);
5267
5328
  }
5268
5329
  }
5269
- /**
5270
- * Finds a property by its label UUID in an array of properties.
5271
- *
5272
- * @param properties - Array of properties to search through
5273
- * @param labelUuid - The property label UUID to search for
5274
- * @param options - Search options, including whether to include nested properties
5275
- * @returns The matching Property object, or null if not found
5276
- */
5277
5330
  function getPropertyByLabelUuid(properties, labelUuid, options = DEFAULT_OPTIONS) {
5278
5331
  const { includeNestedProperties } = withDefaultOptions(options);
5279
- return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByLabelUuid(currentProperties, labelUuid));
5332
+ return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByVariableUuid(currentProperties, labelUuid));
5280
5333
  }
5281
5334
  /**
5282
- * Retrieves all values for a property with the given label UUID.
5335
+ * Retrieves all values for a property with the given variable UUID.
5283
5336
  *
5284
5337
  * @param properties - Array of properties to search through
5285
- * @param labelUuid - The property label UUID to search for
5338
+ * @param labelUuid - The property variable UUID to search for
5286
5339
  * @param options - Search options, including whether to include nested properties
5287
5340
  * @returns Array of property values, or null if property not found
5288
5341
  */
5289
5342
  function getPropertyValuesByLabelUuid(properties, labelUuid, options = DEFAULT_OPTIONS) {
5290
5343
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5291
5344
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5292
- const property = findPropertyByLabelUuid(currentProperties, labelUuid);
5345
+ const property = findPropertyByVariableUuid(currentProperties, labelUuid);
5293
5346
  if (property == null) return null;
5294
5347
  return getPropertyValuesResult(property.values, limitToLeafPropertyValues, true);
5295
5348
  }, (nestedResult) => getPropertyValuesResult(nestedResult, limitToLeafPropertyValues, true));
5296
5349
  }
5297
5350
  /**
5298
- * 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.
5299
5352
  *
5300
5353
  * @param properties - Array of properties to search through
5301
- * @param labelUuid - The property label UUID to search for
5354
+ * @param labelUuid - The property variable UUID to search for
5302
5355
  * @param options - Search options, including whether to include nested properties
5303
5356
  * @returns Array of property value contents, or null if property not found
5304
5357
  */
5305
5358
  function getPropertyValueContentsByLabelUuid(properties, labelUuid, options = DEFAULT_OPTIONS) {
5306
5359
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5307
5360
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5308
- const property = findPropertyByLabelUuid(currentProperties, labelUuid);
5361
+ const property = findPropertyByVariableUuid(currentProperties, labelUuid);
5309
5362
  if (property == null) return null;
5310
5363
  const valueContents = [];
5311
5364
  for (const value of getPropertyValuesResult(property.values, limitToLeafPropertyValues, false)) valueContents.push(value.content);
@@ -5313,10 +5366,10 @@ function getPropertyValueContentsByLabelUuid(properties, labelUuid, options = DE
5313
5366
  });
5314
5367
  }
5315
5368
  /**
5316
- * 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.
5317
5370
  *
5318
5371
  * @param properties - Array of properties to search through
5319
- * @param labelUuid - The property label UUID to search for
5372
+ * @param labelUuid - The property variable UUID to search for
5320
5373
  * @param options - Search options, including whether to include nested properties
5321
5374
  * @returns The first property value, or null if property not found
5322
5375
  */
@@ -5332,10 +5385,10 @@ function getPropertyValueByLabelUuid(properties, labelUuid, options = DEFAULT_OP
5332
5385
  }, (nestedResult) => getFirstPropertyValueResult([nestedResult], limitToLeafPropertyValues));
5333
5386
  }
5334
5387
  /**
5335
- * 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.
5336
5389
  *
5337
5390
  * @param properties - Array of properties to search through
5338
- * @param labelUuid - The property label UUID to search for
5391
+ * @param labelUuid - The property variable UUID to search for
5339
5392
  * @param options - Search options, including whether to include nested properties
5340
5393
  * @returns The first property value content, or null if property not found
5341
5394
  */
@@ -5350,103 +5403,59 @@ function getPropertyValueContentByLabelUuid(properties, labelUuid, options = DEF
5350
5403
  return getFirstPropertyValueContentResult(values, limitToLeafPropertyValues);
5351
5404
  });
5352
5405
  }
5353
- /**
5354
- * Finds a property by its label name in an array of properties.
5355
- *
5356
- * @param properties - Array of properties to search through
5357
- * @param labelName - The property label name to search for
5358
- * @param options - Search options, including whether to include nested properties
5359
- * @returns The matching Property object, or null if not found
5360
- */
5361
5406
  function getPropertyByLabelName(properties, labelName, options = DEFAULT_OPTIONS) {
5362
5407
  const { includeNestedProperties } = withDefaultOptions(options);
5363
- return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByLabelName(currentProperties, labelName));
5408
+ return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByVariableLabelName(currentProperties, labelName));
5364
5409
  }
5365
- /**
5366
- * Finds a property by its label name and all values.
5367
- *
5368
- * @param properties - Array of properties to search through
5369
- * @param labelName - The property label name to search for
5370
- * @param values - The property values to search for
5371
- * @param options - Search options, including whether to include nested properties
5372
- * @returns The matching Property object, or null if not found or all values do not match
5373
- */
5374
5410
  function getPropertyByLabelNameAndValues(properties, labelName, values, options = DEFAULT_OPTIONS) {
5375
5411
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5376
5412
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5377
- 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);
5378
5414
  return null;
5379
5415
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5380
5416
  }
5381
- /**
5382
- * Finds a property by its label name and all value contents.
5383
- *
5384
- * @param properties - Array of properties to search through
5385
- * @param labelName - The property label name to search for
5386
- * @param valueContents - The value contents to search for
5387
- * @param options - Search options, including whether to include nested properties
5388
- * @returns The matching Property object, or null if not found or all value contents do not match
5389
- */
5390
5417
  function getPropertyByLabelNameAndValueContents(properties, labelName, valueContents, options = DEFAULT_OPTIONS) {
5391
5418
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5392
5419
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5393
- 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);
5394
5421
  return null;
5395
5422
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5396
5423
  }
5397
- /**
5398
- * Finds a property by its label name and one value.
5399
- *
5400
- * @param properties - Array of properties to search through
5401
- * @param labelName - The property label name to search for
5402
- * @param value - The property value to search for
5403
- * @param options - Search options, including whether to include nested properties
5404
- * @returns The matching Property object, or null if not found or value does not match
5405
- */
5406
5424
  function getPropertyByLabelNameAndValue(properties, labelName, value, options = DEFAULT_OPTIONS) {
5407
5425
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5408
5426
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5409
- 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);
5410
5428
  return null;
5411
5429
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5412
5430
  }
5413
- /**
5414
- * Finds a property by its label name and one value content.
5415
- *
5416
- * @param properties - Array of properties to search through
5417
- * @param labelName - The property label name to search for
5418
- * @param valueContent - The value content to search for
5419
- * @param options - Search options, including whether to include nested properties
5420
- * @returns The matching Property object, or null if not found or value content does not match
5421
- */
5422
5431
  function getPropertyByLabelNameAndValueContent(properties, labelName, valueContent, options = DEFAULT_OPTIONS) {
5423
5432
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5424
5433
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5425
- 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);
5426
5435
  return null;
5427
5436
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5428
5437
  }
5429
5438
  /**
5430
- * Retrieves all values for a property with the given label name.
5439
+ * Retrieves all values for a property with the given variable label name.
5431
5440
  *
5432
5441
  * @param properties - Array of properties to search through
5433
- * @param labelName - The property label name to search for
5442
+ * @param labelName - The property variable label name to search for
5434
5443
  * @param options - Search options, including whether to include nested properties
5435
5444
  * @returns Array of property values, or null if property not found
5436
5445
  */
5437
5446
  function getPropertyValuesByLabelName(properties, labelName, options = DEFAULT_OPTIONS) {
5438
5447
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5439
5448
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
5440
- const property = findPropertyByLabelName(currentProperties, labelName);
5449
+ const property = findPropertyByVariableLabelName(currentProperties, labelName);
5441
5450
  if (property == null) return null;
5442
5451
  return getPropertyValuesResult(property.values, limitToLeafPropertyValues, false);
5443
5452
  }, (nestedResult) => getPropertyValuesResult(nestedResult, limitToLeafPropertyValues, false));
5444
5453
  }
5445
5454
  /**
5446
- * 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.
5447
5456
  *
5448
5457
  * @param properties - Array of properties to search through
5449
- * @param labelName - The property label name to search for
5458
+ * @param labelName - The property variable label name to search for
5450
5459
  * @param options - Search options, including whether to include nested properties
5451
5460
  * @returns The first property value, or null if property not found
5452
5461
  */
@@ -5462,10 +5471,10 @@ function getPropertyValueByLabelName(properties, labelName, options = DEFAULT_OP
5462
5471
  }, (nestedResult) => getFirstPropertyValueResult([nestedResult], limitToLeafPropertyValues));
5463
5472
  }
5464
5473
  /**
5465
- * 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.
5466
5475
  *
5467
5476
  * @param properties - Array of properties to search through
5468
- * @param labelName - The property label name to search for
5477
+ * @param labelName - The property variable label name to search for
5469
5478
  * @param options - Search options, including whether to include nested properties
5470
5479
  * @returns The first property value content, or null if property not found
5471
5480
  */
@@ -5480,18 +5489,11 @@ function getPropertyValueContentByLabelName(properties, labelName, options = DEF
5480
5489
  return getFirstPropertyValueContentResult(values, limitToLeafPropertyValues);
5481
5490
  });
5482
5491
  }
5483
- /**
5484
- * Gets all unique properties from an array of properties.
5485
- *
5486
- * @param properties - Array of properties to get unique properties from
5487
- * @param options - Search options, including whether to include nested properties
5488
- * @returns Array of unique properties
5489
- */
5490
5492
  function getUniqueProperties(properties, options = DEFAULT_OPTIONS) {
5491
5493
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5492
5494
  const uniqueProperties = [];
5493
5495
  visitProperties(properties, includeNestedProperties, (property) => {
5494
- 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;
5495
5497
  uniqueProperties.push(property);
5496
5498
  });
5497
5499
  if (limitToLeafPropertyValues) {
@@ -5502,18 +5504,19 @@ function getUniqueProperties(properties, options = DEFAULT_OPTIONS) {
5502
5504
  return uniqueProperties;
5503
5505
  }
5504
5506
  /**
5505
- * Gets all unique property label names from an array of properties.
5507
+ * Gets all unique property variable label names from an array of properties.
5506
5508
  *
5507
- * @param properties - Array of properties to get unique property labels from
5509
+ * @param properties - Array of properties to get unique property variable labels from
5508
5510
  * @param options - Search options, including whether to include nested properties
5509
- * @returns Array of unique property label names
5511
+ * @returns Array of unique property variable label names
5510
5512
  */
5511
5513
  function getUniquePropertyLabelNames(properties, options = DEFAULT_OPTIONS) {
5512
5514
  const { includeNestedProperties } = withDefaultOptions(options);
5513
5515
  const uniquePropertyLabels = [];
5514
5516
  visitProperties(properties, includeNestedProperties, (property) => {
5515
- if (uniquePropertyLabels.includes(property.label.name)) return;
5516
- uniquePropertyLabels.push(property.label.name);
5517
+ const labelName = getPropertyVariableLabelName(property);
5518
+ if (uniquePropertyLabels.includes(labelName)) return;
5519
+ uniquePropertyLabels.push(labelName);
5517
5520
  });
5518
5521
  return uniquePropertyLabels;
5519
5522
  }
@@ -5534,22 +5537,22 @@ function contentMatchesFilter(content, filterContent) {
5534
5537
  return typeof filterContent === "boolean" && content === filterContent;
5535
5538
  }
5536
5539
  /**
5537
- * Filters a property based on a label and value criterion.
5540
+ * Filters a property based on a variable label and value criterion.
5538
5541
  *
5539
5542
  * @param property - The property to filter
5540
- * @param filter - Filter criteria containing label and value to match
5541
- * @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
5542
5545
  * @param filter.value - The value to filter by
5543
5546
  * @param options - Search options, including whether to include nested properties
5544
5547
  * @returns True if the property matches the filter criteria, false otherwise
5545
5548
  */
5546
5549
  function filterProperties(property, filter, options = DEFAULT_OPTIONS) {
5547
5550
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5548
- 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")) {
5549
5552
  const values = getPropertyValuesResult(property.values, limitToLeafPropertyValues, false);
5550
5553
  for (const value of values) if (contentMatchesFilter(value.content, filter.value.content)) return true;
5551
5554
  }
5552
- if (includeNestedProperties) {
5555
+ if (includeNestedProperties && "properties" in property) {
5553
5556
  for (const nestedProperty of property.properties) if (filterProperties(nestedProperty, filter, {
5554
5557
  includeNestedProperties: true,
5555
5558
  limitToLeafPropertyValues
@@ -5613,12 +5616,21 @@ function parseCssStylesFromProperties(properties, cssVariant) {
5613
5616
  for (const property of cssProperties) {
5614
5617
  const value = property.values[0]?.content.toString();
5615
5618
  if (value != null) styles.push({
5616
- label: property.label.name,
5619
+ label: property.variable.label,
5617
5620
  value
5618
5621
  });
5619
5622
  }
5620
5623
  return styles;
5621
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
+ }
5622
5634
  /**
5623
5635
  * Parses responsive CSS styles (default, tablet, mobile) from properties.
5624
5636
  *
@@ -5691,7 +5703,7 @@ function parseWebsiteOptions(rawOptions, options) {
5691
5703
  contextTree: rawOptions == null ? null : parseAllOptionContexts(rawOptions, options),
5692
5704
  labels: { title: null }
5693
5705
  };
5694
- 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") {
5695
5707
  parsedOptions.labels.title = note.content;
5696
5708
  break;
5697
5709
  }
@@ -6122,7 +6134,7 @@ function parseWebElementProperties(componentProperty, elementResource, options)
6122
6134
  if (componentProperty.properties.length === 0) throw new Error(formatComponentError("Query properties not found", componentName, elementResource));
6123
6135
  for (const queryItem of componentProperty.properties) {
6124
6136
  const querySubProperties = queryItem.properties;
6125
- const label = getPropertyValueContentByLabelName(querySubProperties, "query-prompt");
6137
+ const label = getPropertyMultilingualValueByLabelName(querySubProperties, "query-prompt", options);
6126
6138
  if (label === null) continue;
6127
6139
  const propertyVariables = getPropertyByLabelName(querySubProperties, "use-property")?.values.filter((value) => value.uuid !== null) ?? [];
6128
6140
  const queryLanguage = options.languages[0];
@@ -6198,7 +6210,7 @@ function parseWebElementProperties(componentProperty, elementResource, options)
6198
6210
  const linkToProperty = getPropertyByLabelName(componentProperty.properties, "link-to");
6199
6211
  const href = linkToProperty?.values[0]?.href != null ? transformPermanentIdentificationUrlToItemLink(linkToProperty.values[0].href) : linkToProperty?.values[0]?.slug ?? null;
6200
6212
  if (!boundElementUuid && !href) throw new Error(formatComponentError("Bound element or href not found", componentName, elementResource));
6201
- let placeholder = getPropertyValueContentByLabelName(componentProperty.properties, "placeholder-text");
6213
+ let placeholder = getPropertyMultilingualValueByLabelName(componentProperty.properties, "placeholder-text", options);
6202
6214
  placeholder ??= null;
6203
6215
  let baseFilterQueries = getPropertyValueContentByLabelName(componentProperty.properties, "base-filter-queries");
6204
6216
  baseFilterQueries ??= null;
@@ -6298,7 +6310,7 @@ function parseWebTitle(properties, identification, overrides) {
6298
6310
  */
6299
6311
  function parseWebElement(elementResource, options) {
6300
6312
  const identification = parseIdentification(elementResource.identification, options);
6301
- const elementProperties = elementResource.properties?.property ? parseProperties(elementResource.properties, options) : [];
6313
+ const elementProperties = elementResource.properties?.property ? parseSimplifiedProperties(elementResource.properties, options) : [];
6302
6314
  const presentationProperty = getPropertyByLabelName(elementProperties, "presentation");
6303
6315
  if (presentationProperty === null) throw new Error(`Presentation property not found for element (${formatXMLWebsiteResourceMetadata(elementResource)})`);
6304
6316
  const componentProperty = getPropertyByLabelName(presentationProperty.properties, "component");
@@ -6327,7 +6339,7 @@ function parseWebElement(elementResource, options) {
6327
6339
  const parseWebpageResources = (webpageResources, type, options) => {
6328
6340
  const returnElements = [];
6329
6341
  for (const resource of webpageResources) {
6330
- 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;
6331
6343
  switch (type) {
6332
6344
  case "element": {
6333
6345
  const element = parseWebElement(resource, options);
@@ -6355,7 +6367,7 @@ const parseWebpageResources = (webpageResources, type, options) => {
6355
6367
  * @returns Parsed Webpage object
6356
6368
  */
6357
6369
  function parseWebpage(webpageResource, options, slugPrefix) {
6358
- const webpageProperties = webpageResource.properties ? parseProperties(webpageResource.properties, options) : [];
6370
+ const webpageProperties = webpageResource.properties ? parseSimplifiedProperties(webpageResource.properties, options) : [];
6359
6371
  if (webpageProperties.length === 0 || getPropertyValueContentByLabelName(webpageProperties, "presentation") !== "page") return null;
6360
6372
  const identification = parseIdentification(webpageResource.identification, options);
6361
6373
  const slug = webpageResource.slug?.replace(SEGMENT_UNIQUE_SLUG_PREFIX_REGEX, "") ?? null;
@@ -6387,7 +6399,7 @@ function parseWebpage(webpageResource, options, slugPrefix) {
6387
6399
  const webpageResources = webpageResource.resource != null ? normalizeWebsiteResources(webpageResource.resource) : [];
6388
6400
  const items = [];
6389
6401
  for (const resource of webpageResources) {
6390
- const resourceType = getPropertyValueContentByLabelName(resource.properties != null ? parseProperties(resource.properties, options) : [], "presentation");
6402
+ const resourceType = getPropertyValueContentByLabelName(resource.properties != null ? parseSimplifiedProperties(resource.properties, options) : [], "presentation");
6391
6403
  if (resourceType === null) continue;
6392
6404
  switch (resourceType) {
6393
6405
  case "segment": {
@@ -6450,7 +6462,7 @@ function parseWebpages(webpageResources, options, slugPrefix) {
6450
6462
  * @returns Parsed WebSegment object
6451
6463
  */
6452
6464
  function parseWebSegment(segmentResource, options, slugPrefix) {
6453
- const webpageProperties = segmentResource.properties ? parseProperties(segmentResource.properties, options) : [];
6465
+ const webpageProperties = segmentResource.properties ? parseSimplifiedProperties(segmentResource.properties, options) : [];
6454
6466
  if (webpageProperties.length === 0 || getPropertyValueContentByLabelName(webpageProperties, "presentation") !== "segment") return null;
6455
6467
  const identification = parseIdentification(segmentResource.identification, options);
6456
6468
  const slug = segmentResource.identification.abbreviation != null ? parseStringContent(segmentResource.identification.abbreviation, options) : null;
@@ -6487,7 +6499,7 @@ function parseSegments(segmentResources, options, slugPrefix) {
6487
6499
  * @returns Parsed WebSegmentItem object
6488
6500
  */
6489
6501
  function parseWebSegmentItem(segmentItemResource, options, slugPrefix) {
6490
- const webpageProperties = segmentItemResource.properties ? parseProperties(segmentItemResource.properties, options) : [];
6502
+ const webpageProperties = segmentItemResource.properties ? parseSimplifiedProperties(segmentItemResource.properties, options) : [];
6491
6503
  if (webpageProperties.length === 0 || getPropertyValueContentByLabelName(webpageProperties, "presentation") !== "segment-item") return null;
6492
6504
  const identification = parseIdentification(segmentItemResource.identification, options);
6493
6505
  const slug = segmentItemResource.identification.abbreviation != null ? parseStringContent(segmentItemResource.identification.abbreviation, options) : null;
@@ -6536,16 +6548,16 @@ function parseSidebar(resources, options) {
6536
6548
  mobile: []
6537
6549
  };
6538
6550
  const sidebarResource = resources.find((resource) => {
6539
- const resourceProperties = resource.properties ? parseProperties(resource.properties, options) : [];
6551
+ const resourceProperties = resource.properties ? parseSimplifiedProperties(resource.properties, options) : [];
6540
6552
  return getPropertyValueContentByLabelName(resourceProperties, "presentation") === "element" && getPropertyValueContentByLabelName(resourceProperties[0]?.properties ?? [], "component") === "sidebar";
6541
6553
  });
6542
6554
  if (sidebarResource != null) {
6543
- const sidebarBaseProperties = sidebarResource.properties ? parseProperties(sidebarResource.properties, options) : [];
6555
+ const sidebarBaseProperties = sidebarResource.properties ? parseSimplifiedProperties(sidebarResource.properties, options) : [];
6544
6556
  title = parseWebTitle(sidebarBaseProperties, parseIdentification(sidebarResource.identification, options));
6545
- 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 ?? [];
6546
- 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");
6547
6559
  if (sidebarLayoutProperty) layout = sidebarLayoutProperty.values[0].content;
6548
- const sidebarMobileLayoutProperty = sidebarProperties.find((property) => property.label.name === "layout-mobile");
6560
+ const sidebarMobileLayoutProperty = sidebarProperties.find((property) => property.variable.label === "layout-mobile");
6549
6561
  if (sidebarMobileLayoutProperty) mobileLayout = sidebarMobileLayoutProperty.values[0].content;
6550
6562
  const parsedCssStyles = parseResponsiveCssStyles(sidebarBaseProperties);
6551
6563
  cssStyles.default = parsedCssStyles.default;
@@ -6553,7 +6565,7 @@ function parseSidebar(resources, options) {
6553
6565
  cssStyles.mobile = parsedCssStyles.mobile;
6554
6566
  const sidebarResources = sidebarResource.resource ? normalizeWebsiteResources(sidebarResource.resource) : [];
6555
6567
  for (const resource of sidebarResources) {
6556
- const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseProperties(resource.properties, options) : [], "presentation");
6568
+ const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseSimplifiedProperties(resource.properties, options) : [], "presentation");
6557
6569
  if (resourceType === null) continue;
6558
6570
  switch (resourceType) {
6559
6571
  case "element": {
@@ -6590,7 +6602,7 @@ function parseWebElementForAccordion(elementResource, options) {
6590
6602
  const childResources = elementResource.resource ? normalizeWebsiteResources(elementResource.resource) : [];
6591
6603
  const items = [];
6592
6604
  for (const resource of childResources) {
6593
- const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseProperties(resource.properties, options) : [], "presentation");
6605
+ const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseSimplifiedProperties(resource.properties, options) : [], "presentation");
6594
6606
  if (resourceType === null) continue;
6595
6607
  switch (resourceType) {
6596
6608
  case "element": {
@@ -6617,7 +6629,7 @@ function parseWebElementForAccordion(elementResource, options) {
6617
6629
  * @returns Parsed WebBlock object
6618
6630
  */
6619
6631
  function parseWebBlock(blockResource, options) {
6620
- const blockProperties = blockResource.properties ? parseProperties(blockResource.properties, options) : [];
6632
+ const blockProperties = blockResource.properties ? parseSimplifiedProperties(blockResource.properties, options) : [];
6621
6633
  const returnBlock = {
6622
6634
  uuid: blockResource.uuid,
6623
6635
  type: "block",
@@ -6695,7 +6707,7 @@ function parseWebBlock(blockResource, options) {
6695
6707
  if (returnBlock.properties.default.layout === "accordion") {
6696
6708
  const accordionItems = [];
6697
6709
  for (const resource of blockResources) {
6698
- const resourceProperties = resource.properties ? parseProperties(resource.properties, options) : [];
6710
+ const resourceProperties = resource.properties ? parseSimplifiedProperties(resource.properties, options) : [];
6699
6711
  const resourceType = getPropertyValueContentByLabelName(resourceProperties, "presentation");
6700
6712
  if (resourceType !== "element") throw new Error(`Accordion only accepts elements, but got “${resourceType}” (${formatXMLWebsiteResourceMetadata(resource)})`);
6701
6713
  const componentType = getPropertyValueContentByLabelName(getPropertyByLabelName(resourceProperties, "presentation")?.properties ?? [], "component");
@@ -6707,7 +6719,7 @@ function parseWebBlock(blockResource, options) {
6707
6719
  } else {
6708
6720
  const blockItems = [];
6709
6721
  for (const resource of blockResources) {
6710
- const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseProperties(resource.properties, options) : [], "presentation");
6722
+ const resourceType = getPropertyValueContentByLabelName(resource.properties ? parseSimplifiedProperties(resource.properties, options) : [], "presentation");
6711
6723
  if (resourceType === null) continue;
6712
6724
  switch (resourceType) {
6713
6725
  case "element": {
@@ -6734,7 +6746,7 @@ function parseWebBlock(blockResource, options) {
6734
6746
  * @returns Parsed WebsiteProperties object
6735
6747
  */
6736
6748
  function parseWebsiteProperties(properties, websiteTree, sidebar, options) {
6737
- const websiteProperties = getPropertyByLabelName(parseProperties({ property: properties }, options), "presentation")?.properties ?? [];
6749
+ const websiteProperties = getPropertyByLabelName(parseSimplifiedProperties({ property: properties }, options), "presentation")?.properties ?? [];
6738
6750
  let type = getPropertyValueContentByLabelName(websiteProperties, "webUI");
6739
6751
  type ??= "traditional";
6740
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.6",
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",