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

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
@@ -1680,6 +1680,7 @@ type PropertyOptions = {
1680
1680
  limitToLeafPropertyValues?: boolean;
1681
1681
  };
1682
1682
  type PropertyContent<T extends ReadonlyArray<string>> = PropertyValueContent<T>["content"];
1683
+ type SearchableProperty<T extends ReadonlyArray<string>> = Property<T> | SingleHierarchyProperty<T>;
1683
1684
  /**
1684
1685
  * Finds a property by its label UUID in an array of properties.
1685
1686
  *
@@ -1689,6 +1690,7 @@ type PropertyContent<T extends ReadonlyArray<string>> = PropertyValueContent<T>[
1689
1690
  * @returns The matching Property object, or null if not found
1690
1691
  */
1691
1692
  declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Property<T> | null;
1693
+ declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelUuid: string, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1692
1694
  /**
1693
1695
  * Retrieves all values for a property with the given label UUID.
1694
1696
  *
@@ -1697,7 +1699,7 @@ declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = Readon
1697
1699
  * @param options - Search options, including whether to include nested properties
1698
1700
  * @returns Array of property values, or null if property not found
1699
1701
  */
1700
- declare function getPropertyValuesByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1702
+ declare function getPropertyValuesByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1701
1703
  /**
1702
1704
  * Retrieves all value contents for a property with the given label UUID.
1703
1705
  *
@@ -1706,7 +1708,7 @@ declare function getPropertyValuesByLabelUuid<T extends ReadonlyArray<string> =
1706
1708
  * @param options - Search options, including whether to include nested properties
1707
1709
  * @returns Array of property value contents, or null if property not found
1708
1710
  */
1709
- declare function getPropertyValueContentsByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
1711
+ declare function getPropertyValueContentsByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
1710
1712
  /**
1711
1713
  * Gets the first value of a property with the given label UUID.
1712
1714
  *
@@ -1715,7 +1717,7 @@ declare function getPropertyValueContentsByLabelUuid<T extends ReadonlyArray<str
1715
1717
  * @param options - Search options, including whether to include nested properties
1716
1718
  * @returns The first property value, or null if property not found
1717
1719
  */
1718
- declare function getPropertyValueByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1720
+ declare function getPropertyValueByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1719
1721
  /**
1720
1722
  * Gets the first value content of a property with the given label UUID.
1721
1723
  *
@@ -1724,7 +1726,7 @@ declare function getPropertyValueByLabelUuid<T extends ReadonlyArray<string> = R
1724
1726
  * @param options - Search options, including whether to include nested properties
1725
1727
  * @returns The first property value content, or null if property not found
1726
1728
  */
1727
- declare function getPropertyValueContentByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
1729
+ declare function getPropertyValueContentByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
1728
1730
  /**
1729
1731
  * Finds a property by its label name in an array of properties.
1730
1732
  *
@@ -1734,6 +1736,7 @@ declare function getPropertyValueContentByLabelUuid<T extends ReadonlyArray<stri
1734
1736
  * @returns The matching Property object, or null if not found
1735
1737
  */
1736
1738
  declare function getPropertyByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): Property<T> | null;
1739
+ declare function getPropertyByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1737
1740
  /**
1738
1741
  * Finds a property by its label name and all values.
1739
1742
  *
@@ -1744,6 +1747,7 @@ declare function getPropertyByLabelName<T extends ReadonlyArray<string> = Readon
1744
1747
  * @returns The matching Property object, or null if not found or all values do not match
1745
1748
  */
1746
1749
  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
+ declare function getPropertyByLabelNameAndValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1747
1751
  /**
1748
1752
  * Finds a property by its label name and all value contents.
1749
1753
  *
@@ -1754,6 +1758,7 @@ declare function getPropertyByLabelNameAndValues<T extends ReadonlyArray<string>
1754
1758
  * @returns The matching Property object, or null if not found or all value contents do not match
1755
1759
  */
1756
1760
  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
+ declare function getPropertyByLabelNameAndValueContents<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1757
1762
  /**
1758
1763
  * Finds a property by its label name and one value.
1759
1764
  *
@@ -1764,6 +1769,7 @@ declare function getPropertyByLabelNameAndValueContents<T extends ReadonlyArray<
1764
1769
  * @returns The matching Property object, or null if not found or value does not match
1765
1770
  */
1766
1771
  declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
1772
+ declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, value: PropertyValueContent<T>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1767
1773
  /**
1768
1774
  * Finds a property by its label name and one value content.
1769
1775
  *
@@ -1774,6 +1780,7 @@ declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string>
1774
1780
  * @returns The matching Property object, or null if not found or value content does not match
1775
1781
  */
1776
1782
  declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, valueContent: PropertyContent<T>, options?: PropertyOptions): Property<T> | null;
1783
+ declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, labelName: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
1777
1784
  /**
1778
1785
  * Retrieves all values for a property with the given label name.
1779
1786
  *
@@ -1782,7 +1789,7 @@ declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<s
1782
1789
  * @param options - Search options, including whether to include nested properties
1783
1790
  * @returns Array of property values, or null if property not found
1784
1791
  */
1785
- declare function getPropertyValuesByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1792
+ declare function getPropertyValuesByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelName: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
1786
1793
  /**
1787
1794
  * Gets the first value of a property with the given label name.
1788
1795
  *
@@ -1791,7 +1798,7 @@ declare function getPropertyValuesByLabelName<T extends ReadonlyArray<string> =
1791
1798
  * @param options - Search options, including whether to include nested properties
1792
1799
  * @returns The first property value, or null if property not found
1793
1800
  */
1794
- declare function getPropertyValueByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1801
+ declare function getPropertyValueByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelName: string, options?: PropertyOptions): PropertyValueContent<T> | null;
1795
1802
  /**
1796
1803
  * Gets the first value content of a property with the given label name.
1797
1804
  *
@@ -1800,7 +1807,7 @@ declare function getPropertyValueByLabelName<T extends ReadonlyArray<string> = R
1800
1807
  * @param options - Search options, including whether to include nested properties
1801
1808
  * @returns The first property value content, or null if property not found
1802
1809
  */
1803
- declare function getPropertyValueContentByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): PropertyContent<T> | null;
1810
+ declare function getPropertyValueContentByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, labelName: string, options?: PropertyOptions): PropertyContent<T> | null;
1804
1811
  /**
1805
1812
  * Gets all unique properties from an array of properties.
1806
1813
  *
@@ -1809,6 +1816,7 @@ declare function getPropertyValueContentByLabelName<T extends ReadonlyArray<stri
1809
1816
  * @returns Array of unique properties
1810
1817
  */
1811
1818
  declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
1819
+ declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, options?: PropertyOptions): Array<SingleHierarchyProperty<T>>;
1812
1820
  /**
1813
1821
  * Gets all unique property label names from an array of properties.
1814
1822
  *
@@ -1816,7 +1824,7 @@ declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyA
1816
1824
  * @param options - Search options, including whether to include nested properties
1817
1825
  * @returns Array of unique property label names
1818
1826
  */
1819
- declare function getUniquePropertyLabelNames<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<string>;
1827
+ declare function getUniquePropertyLabelNames<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<SearchableProperty<T>>, options?: PropertyOptions): Array<string>;
1820
1828
  /**
1821
1829
  * Get the leaf property values from an array of property values.
1822
1830
  *
@@ -1834,7 +1842,7 @@ declare function getLeafPropertyValues<T extends ReadonlyArray<string> = Readonl
1834
1842
  * @param options - Search options, including whether to include nested properties
1835
1843
  * @returns True if the property matches the filter criteria, false otherwise
1836
1844
  */
1837
- declare function filterProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(property: Property<T>, filter: {
1845
+ declare function filterProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(property: SearchableProperty<T>, filter: {
1838
1846
  labelName: string;
1839
1847
  value: PropertyValueContent<T>;
1840
1848
  }, options?: PropertyOptions): boolean;
package/dist/index.mjs CHANGED
@@ -879,9 +879,13 @@ function parseWhitespace(contentString, whitespace, rendering) {
879
879
  * @internal
880
880
  */
881
881
  function parseXMLStringVariant(string, options) {
882
- let returnString = (string.payload ?? "").replaceAll("<", options.rendering === "rich" ? String.raw`\<` : "<").replaceAll("{", String.raw`\{`).replaceAll("}", String.raw`\}`);
882
+ let returnString = parseXMLStringPayload(string, options);
883
883
  if (string.whitespace != null) returnString = parseWhitespace(returnString, string.whitespace, options.rendering);
884
884
  if (string.rend != null) returnString = parseRenderOptions(returnString, string.rend, options.rendering);
885
+ return returnString;
886
+ }
887
+ function parseXMLStringPayload(string, options) {
888
+ const returnString = (string.payload ?? "").replaceAll("<", options.rendering === "rich" ? String.raw`\<` : "<").replaceAll("{", String.raw`\{`).replaceAll("}", String.raw`\}`);
885
889
  return options.parseEmail ? parseEmail(returnString) : returnString;
886
890
  }
887
891
  function parseXMLString(string, options) {
@@ -1035,14 +1039,13 @@ function hasRichTextEnvelope(item) {
1035
1039
  return item.properties?.property[0] != null || getXMLRichTextLinks(item).length > 0;
1036
1040
  }
1037
1041
  function parseXMLStringItem(item, contentItem, options) {
1038
- if (item.payload != null) return parseXMLStringVariant(item, {
1039
- rendering: options.rendering,
1040
- parseEmail: options.parseEmail
1041
- });
1042
- if (item.string == null && item.whitespace != null) return parseWhitespace("", item.whitespace, options.rendering);
1043
- if (item.string == null) return "";
1042
+ if (item.payload == null && item.string == null && item.whitespace != null) return parseWhitespace("", item.whitespace, options.rendering);
1043
+ if (item.payload == null && item.string == null) return "";
1044
1044
  if (hasRichTextEnvelope(item)) {
1045
- let linkString = parseNestedStringItems(item.string, contentItem, {
1045
+ let linkString = item.payload != null ? parseXMLStringPayload(item, {
1046
+ rendering: options.rendering,
1047
+ parseEmail: false
1048
+ }) : parseNestedStringItems(item.string ?? [], contentItem, {
1046
1049
  ...options,
1047
1050
  parseEmail: false
1048
1051
  });
@@ -1050,7 +1053,11 @@ function parseXMLStringItem(item, contentItem, options) {
1050
1053
  if (options.rendering === "plain") return applyWhitespaceToResult(linkString, item.whitespace, options.rendering);
1051
1054
  return renderRichTextItem(item, linkString, contentItem, options);
1052
1055
  }
1053
- let result = parseNestedStringItems(item.string, contentItem, options);
1056
+ if (item.payload != null) return parseXMLStringVariant(item, {
1057
+ rendering: options.rendering,
1058
+ parseEmail: options.parseEmail
1059
+ });
1060
+ let result = parseNestedStringItems(item.string ?? [], contentItem, options);
1054
1061
  if (item.rend != null) result = parseRenderOptions(result, item.rend, options.rendering);
1055
1062
  return applyWhitespaceToResult(result, item.whitespace, options.rendering);
1056
1063
  }
@@ -5194,6 +5201,7 @@ function searchPropertyResult(properties, options, findDirectResult, transformNe
5194
5201
  const directResult = findDirectResult(properties);
5195
5202
  if (directResult !== null) return directResult;
5196
5203
  if (options.includeNestedProperties) for (const property of properties) {
5204
+ if (!("properties" in property)) continue;
5197
5205
  const nestedResult = searchPropertyResult(property.properties, options, findDirectResult, transformNestedResult);
5198
5206
  if (nestedResult !== null) {
5199
5207
  const transformedResult = transformNestedResult != null ? transformNestedResult(nestedResult) : nestedResult;
@@ -5256,17 +5264,9 @@ function getFirstPropertyValueContentResult(values, limitToLeafPropertyValues) {
5256
5264
  function visitProperties(properties, includeNestedProperties, visit) {
5257
5265
  for (const property of properties) {
5258
5266
  visit(property);
5259
- if (includeNestedProperties) visitProperties(property.properties, includeNestedProperties, visit);
5267
+ if (includeNestedProperties && "properties" in property) visitProperties(property.properties, includeNestedProperties, visit);
5260
5268
  }
5261
5269
  }
5262
- /**
5263
- * Finds a property by its label UUID in an array of properties.
5264
- *
5265
- * @param properties - Array of properties to search through
5266
- * @param labelUuid - The property label UUID to search for
5267
- * @param options - Search options, including whether to include nested properties
5268
- * @returns The matching Property object, or null if not found
5269
- */
5270
5270
  function getPropertyByLabelUuid(properties, labelUuid, options = DEFAULT_OPTIONS) {
5271
5271
  const { includeNestedProperties } = withDefaultOptions(options);
5272
5272
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByLabelUuid(currentProperties, labelUuid));
@@ -5343,27 +5343,10 @@ function getPropertyValueContentByLabelUuid(properties, labelUuid, options = DEF
5343
5343
  return getFirstPropertyValueContentResult(values, limitToLeafPropertyValues);
5344
5344
  });
5345
5345
  }
5346
- /**
5347
- * Finds a property by its label name in an array of properties.
5348
- *
5349
- * @param properties - Array of properties to search through
5350
- * @param labelName - The property label name to search for
5351
- * @param options - Search options, including whether to include nested properties
5352
- * @returns The matching Property object, or null if not found
5353
- */
5354
5346
  function getPropertyByLabelName(properties, labelName, options = DEFAULT_OPTIONS) {
5355
5347
  const { includeNestedProperties } = withDefaultOptions(options);
5356
5348
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByLabelName(currentProperties, labelName));
5357
5349
  }
5358
- /**
5359
- * Finds a property by its label name and all values.
5360
- *
5361
- * @param properties - Array of properties to search through
5362
- * @param labelName - The property label name to search for
5363
- * @param values - The property values to search for
5364
- * @param options - Search options, including whether to include nested properties
5365
- * @returns The matching Property object, or null if not found or all values do not match
5366
- */
5367
5350
  function getPropertyByLabelNameAndValues(properties, labelName, values, options = DEFAULT_OPTIONS) {
5368
5351
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5369
5352
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
@@ -5371,15 +5354,6 @@ function getPropertyByLabelNameAndValues(properties, labelName, values, options
5371
5354
  return null;
5372
5355
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5373
5356
  }
5374
- /**
5375
- * Finds a property by its label name and all value contents.
5376
- *
5377
- * @param properties - Array of properties to search through
5378
- * @param labelName - The property label name to search for
5379
- * @param valueContents - The value contents to search for
5380
- * @param options - Search options, including whether to include nested properties
5381
- * @returns The matching Property object, or null if not found or all value contents do not match
5382
- */
5383
5357
  function getPropertyByLabelNameAndValueContents(properties, labelName, valueContents, options = DEFAULT_OPTIONS) {
5384
5358
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5385
5359
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
@@ -5387,15 +5361,6 @@ function getPropertyByLabelNameAndValueContents(properties, labelName, valueCont
5387
5361
  return null;
5388
5362
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5389
5363
  }
5390
- /**
5391
- * Finds a property by its label name and one value.
5392
- *
5393
- * @param properties - Array of properties to search through
5394
- * @param labelName - The property label name to search for
5395
- * @param value - The property value to search for
5396
- * @param options - Search options, including whether to include nested properties
5397
- * @returns The matching Property object, or null if not found or value does not match
5398
- */
5399
5364
  function getPropertyByLabelNameAndValue(properties, labelName, value, options = DEFAULT_OPTIONS) {
5400
5365
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5401
5366
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
@@ -5403,15 +5368,6 @@ function getPropertyByLabelNameAndValue(properties, labelName, value, options =
5403
5368
  return null;
5404
5369
  }, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
5405
5370
  }
5406
- /**
5407
- * Finds a property by its label name and one value content.
5408
- *
5409
- * @param properties - Array of properties to search through
5410
- * @param labelName - The property label name to search for
5411
- * @param valueContent - The value content to search for
5412
- * @param options - Search options, including whether to include nested properties
5413
- * @returns The matching Property object, or null if not found or value content does not match
5414
- */
5415
5371
  function getPropertyByLabelNameAndValueContent(properties, labelName, valueContent, options = DEFAULT_OPTIONS) {
5416
5372
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5417
5373
  return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
@@ -5473,13 +5429,6 @@ function getPropertyValueContentByLabelName(properties, labelName, options = DEF
5473
5429
  return getFirstPropertyValueContentResult(values, limitToLeafPropertyValues);
5474
5430
  });
5475
5431
  }
5476
- /**
5477
- * Gets all unique properties from an array of properties.
5478
- *
5479
- * @param properties - Array of properties to get unique properties from
5480
- * @param options - Search options, including whether to include nested properties
5481
- * @returns Array of unique properties
5482
- */
5483
5432
  function getUniqueProperties(properties, options = DEFAULT_OPTIONS) {
5484
5433
  const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
5485
5434
  const uniqueProperties = [];
@@ -5542,7 +5491,7 @@ function filterProperties(property, filter, options = DEFAULT_OPTIONS) {
5542
5491
  const values = getPropertyValuesResult(property.values, limitToLeafPropertyValues, false);
5543
5492
  for (const value of values) if (contentMatchesFilter(value.content, filter.value.content)) return true;
5544
5493
  }
5545
- if (includeNestedProperties) {
5494
+ if (includeNestedProperties && "properties" in property) {
5546
5495
  for (const nestedProperty of property.properties) if (filterProperties(nestedProperty, filter, {
5547
5496
  includeNestedProperties: true,
5548
5497
  limitToLeafPropertyValues
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.7",
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",