@digitalculture/ochre-sdk 0.5.8 → 0.5.10

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.cjs CHANGED
@@ -571,13 +571,11 @@ var componentSchema = import_zod3.z.enum(
571
571
  "iiif-viewer",
572
572
  "image",
573
573
  "image-gallery",
574
- "item-gallery",
575
574
  "n-columns",
576
575
  "n-rows",
577
576
  "network-graph",
578
577
  "table",
579
578
  "text",
580
- "text-image",
581
579
  "timeline",
582
580
  "video"
583
581
  ],
@@ -1669,7 +1667,9 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1669
1667
  break;
1670
1668
  }
1671
1669
  case "image-gallery": {
1672
- const galleryLink = links.find((link) => link.category === "tree");
1670
+ const galleryLink = links.find(
1671
+ (link) => link.category === "tree" || link.category === "set"
1672
+ );
1673
1673
  if (!galleryLink) {
1674
1674
  throw new Error(
1675
1675
  `Image gallery link not found for the following component: \u201C${componentName}\u201D`
@@ -1683,21 +1683,6 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1683
1683
  properties.isSearchable = isSearchable;
1684
1684
  break;
1685
1685
  }
1686
- case "item-gallery": {
1687
- const galleryLink = links.find((link) => link.category === "tree");
1688
- if (!galleryLink) {
1689
- throw new Error(
1690
- `Item gallery link not found for the following component: \u201C${componentName}\u201D`
1691
- );
1692
- }
1693
- const isSearchable = getPropertyValueByLabel(
1694
- componentProperty.properties,
1695
- "is-searchable"
1696
- ) === "Yes";
1697
- properties.galleryId = galleryLink.uuid;
1698
- properties.isSearchable = isSearchable;
1699
- break;
1700
- }
1701
1686
  case "n-columns": {
1702
1687
  const subElements = elementResource.resource ? await parseWebpageResources(
1703
1688
  Array.isArray(elementResource.resource) ? elementResource.resource : [elementResource.resource],
@@ -1747,67 +1732,6 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1747
1732
  properties.content = document.content;
1748
1733
  break;
1749
1734
  }
1750
- case "text-image": {
1751
- if (!document) {
1752
- throw new Error(
1753
- `Document not found for the following component: \u201C${componentName}\u201D`
1754
- );
1755
- }
1756
- let variant = getPropertyValueByLabel(
1757
- componentProperty.properties,
1758
- "variant"
1759
- );
1760
- variant ??= "block";
1761
- let layout = getPropertyValueByLabel(
1762
- componentProperty.properties,
1763
- "layout"
1764
- );
1765
- layout ??= "image-start";
1766
- let captionLayout = getPropertyValueByLabel(
1767
- componentProperty.properties,
1768
- "layout-caption"
1769
- );
1770
- captionLayout ??= "bottom";
1771
- const imageLink = links.find(
1772
- (link) => link.type === "image" || link.type === "IIIF"
1773
- );
1774
- if (!imageLink) {
1775
- throw new Error(
1776
- `Image link not found for the following component: \u201C${componentName}\u201D: ${JSON.stringify(
1777
- links
1778
- )}`
1779
- );
1780
- }
1781
- let imageQuality = getPropertyValueByLabel(
1782
- componentProperty.properties,
1783
- "image-quality"
1784
- );
1785
- imageQuality ??= "high";
1786
- let captionSource = getPropertyValueByLabel(
1787
- componentProperty.properties,
1788
- "caption-source"
1789
- );
1790
- captionSource ??= "name";
1791
- let altTextSource = getPropertyValueByLabel(
1792
- componentProperty.properties,
1793
- "alt-text-source"
1794
- );
1795
- altTextSource ??= "name";
1796
- properties.variant = variant;
1797
- properties.image = {
1798
- url: `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&preview`,
1799
- label: imageLink.identification?.label ?? null,
1800
- width: imageLink.image?.width ?? 0,
1801
- height: imageLink.image?.height ?? 0
1802
- };
1803
- properties.imageQuality = imageQuality;
1804
- properties.layout = layout;
1805
- properties.captionSource = captionSource;
1806
- properties.captionLayout = captionLayout;
1807
- properties.altTextSource = altTextSource;
1808
- properties.content = document.content;
1809
- break;
1810
- }
1811
1735
  case "timeline": {
1812
1736
  const timelineLink = links.find((link) => link.category === "tree");
1813
1737
  if (!timelineLink) {
package/dist/index.d.cts CHANGED
@@ -539,10 +539,6 @@ type WebElementComponent = {
539
539
  component: "image-gallery";
540
540
  galleryId: string;
541
541
  isSearchable: boolean;
542
- } | {
543
- component: "item-gallery";
544
- galleryId: string;
545
- isSearchable: boolean;
546
542
  } | {
547
543
  component: "n-columns";
548
544
  columns: Array<WebElement>;
@@ -559,16 +555,6 @@ type WebElementComponent = {
559
555
  variant: "title" | "block" | "banner";
560
556
  heading: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
561
557
  content: string;
562
- } | {
563
- component: "text-image";
564
- variant: "title" | "block" | "banner";
565
- image: WebImage;
566
- imageQuality: "high" | "low";
567
- layout: "image-top" | "image-bottom" | "image-start" | "image-end" | "image-background";
568
- captionSource: "name" | "abbreviation" | "description";
569
- captionLayout: "top" | "bottom" | "suppress";
570
- altTextSource: "name" | "abbreviation" | "description";
571
- content: string;
572
558
  } | {
573
559
  component: "timeline";
574
560
  timelineId: string;
package/dist/index.d.ts CHANGED
@@ -539,10 +539,6 @@ type WebElementComponent = {
539
539
  component: "image-gallery";
540
540
  galleryId: string;
541
541
  isSearchable: boolean;
542
- } | {
543
- component: "item-gallery";
544
- galleryId: string;
545
- isSearchable: boolean;
546
542
  } | {
547
543
  component: "n-columns";
548
544
  columns: Array<WebElement>;
@@ -559,16 +555,6 @@ type WebElementComponent = {
559
555
  variant: "title" | "block" | "banner";
560
556
  heading: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
561
557
  content: string;
562
- } | {
563
- component: "text-image";
564
- variant: "title" | "block" | "banner";
565
- image: WebImage;
566
- imageQuality: "high" | "low";
567
- layout: "image-top" | "image-bottom" | "image-start" | "image-end" | "image-background";
568
- captionSource: "name" | "abbreviation" | "description";
569
- captionLayout: "top" | "bottom" | "suppress";
570
- altTextSource: "name" | "abbreviation" | "description";
571
- content: string;
572
558
  } | {
573
559
  component: "timeline";
574
560
  timelineId: string;
package/dist/index.js CHANGED
@@ -494,13 +494,11 @@ var componentSchema = z3.enum(
494
494
  "iiif-viewer",
495
495
  "image",
496
496
  "image-gallery",
497
- "item-gallery",
498
497
  "n-columns",
499
498
  "n-rows",
500
499
  "network-graph",
501
500
  "table",
502
501
  "text",
503
- "text-image",
504
502
  "timeline",
505
503
  "video"
506
504
  ],
@@ -1592,7 +1590,9 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1592
1590
  break;
1593
1591
  }
1594
1592
  case "image-gallery": {
1595
- const galleryLink = links.find((link) => link.category === "tree");
1593
+ const galleryLink = links.find(
1594
+ (link) => link.category === "tree" || link.category === "set"
1595
+ );
1596
1596
  if (!galleryLink) {
1597
1597
  throw new Error(
1598
1598
  `Image gallery link not found for the following component: \u201C${componentName}\u201D`
@@ -1606,21 +1606,6 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1606
1606
  properties.isSearchable = isSearchable;
1607
1607
  break;
1608
1608
  }
1609
- case "item-gallery": {
1610
- const galleryLink = links.find((link) => link.category === "tree");
1611
- if (!galleryLink) {
1612
- throw new Error(
1613
- `Item gallery link not found for the following component: \u201C${componentName}\u201D`
1614
- );
1615
- }
1616
- const isSearchable = getPropertyValueByLabel(
1617
- componentProperty.properties,
1618
- "is-searchable"
1619
- ) === "Yes";
1620
- properties.galleryId = galleryLink.uuid;
1621
- properties.isSearchable = isSearchable;
1622
- break;
1623
- }
1624
1609
  case "n-columns": {
1625
1610
  const subElements = elementResource.resource ? await parseWebpageResources(
1626
1611
  Array.isArray(elementResource.resource) ? elementResource.resource : [elementResource.resource],
@@ -1670,67 +1655,6 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1670
1655
  properties.content = document.content;
1671
1656
  break;
1672
1657
  }
1673
- case "text-image": {
1674
- if (!document) {
1675
- throw new Error(
1676
- `Document not found for the following component: \u201C${componentName}\u201D`
1677
- );
1678
- }
1679
- let variant = getPropertyValueByLabel(
1680
- componentProperty.properties,
1681
- "variant"
1682
- );
1683
- variant ??= "block";
1684
- let layout = getPropertyValueByLabel(
1685
- componentProperty.properties,
1686
- "layout"
1687
- );
1688
- layout ??= "image-start";
1689
- let captionLayout = getPropertyValueByLabel(
1690
- componentProperty.properties,
1691
- "layout-caption"
1692
- );
1693
- captionLayout ??= "bottom";
1694
- const imageLink = links.find(
1695
- (link) => link.type === "image" || link.type === "IIIF"
1696
- );
1697
- if (!imageLink) {
1698
- throw new Error(
1699
- `Image link not found for the following component: \u201C${componentName}\u201D: ${JSON.stringify(
1700
- links
1701
- )}`
1702
- );
1703
- }
1704
- let imageQuality = getPropertyValueByLabel(
1705
- componentProperty.properties,
1706
- "image-quality"
1707
- );
1708
- imageQuality ??= "high";
1709
- let captionSource = getPropertyValueByLabel(
1710
- componentProperty.properties,
1711
- "caption-source"
1712
- );
1713
- captionSource ??= "name";
1714
- let altTextSource = getPropertyValueByLabel(
1715
- componentProperty.properties,
1716
- "alt-text-source"
1717
- );
1718
- altTextSource ??= "name";
1719
- properties.variant = variant;
1720
- properties.image = {
1721
- url: `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&preview`,
1722
- label: imageLink.identification?.label ?? null,
1723
- width: imageLink.image?.width ?? 0,
1724
- height: imageLink.image?.height ?? 0
1725
- };
1726
- properties.imageQuality = imageQuality;
1727
- properties.layout = layout;
1728
- properties.captionSource = captionSource;
1729
- properties.captionLayout = captionLayout;
1730
- properties.altTextSource = altTextSource;
1731
- properties.content = document.content;
1732
- break;
1733
- }
1734
1658
  case "timeline": {
1735
1659
  const timelineLink = links.find((link) => link.category === "tree");
1736
1660
  if (!timelineLink) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
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",