@digitalculture/ochre-sdk 0.5.7 → 0.5.9

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
@@ -577,7 +577,6 @@ var componentSchema = import_zod3.z.enum(
577
577
  "network-graph",
578
578
  "table",
579
579
  "text",
580
- "text-image",
581
580
  "timeline",
582
581
  "video"
583
582
  ],
@@ -1467,6 +1466,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1467
1466
  break;
1468
1467
  }
1469
1468
  case "collection": {
1469
+ const collectionLink = links.find((link) => link.category === "set");
1470
+ if (!collectionLink) {
1471
+ throw new Error(
1472
+ `Collection link not found for the following component: \u201C${componentName}\u201D`
1473
+ );
1474
+ }
1470
1475
  let variant = getPropertyValueByLabel(
1471
1476
  componentProperty.properties,
1472
1477
  "variant"
@@ -1477,21 +1482,33 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1477
1482
  "item-variant"
1478
1483
  );
1479
1484
  itemVariant ??= "default";
1485
+ let showCount = false;
1486
+ const showCountProperty = getPropertyValueByLabel(
1487
+ componentProperty.properties,
1488
+ "show-count"
1489
+ );
1490
+ if (showCountProperty !== null) {
1491
+ showCount = showCountProperty === "Yes";
1492
+ }
1493
+ let isSearchable = false;
1494
+ const isSearchableProperty = getPropertyValueByLabel(
1495
+ componentProperty.properties,
1496
+ "is-searchable"
1497
+ );
1498
+ if (isSearchableProperty !== null) {
1499
+ isSearchable = isSearchableProperty === "Yes";
1500
+ }
1480
1501
  let layout = getPropertyValueByLabel(
1481
1502
  componentProperty.properties,
1482
1503
  "layout"
1483
1504
  );
1484
1505
  layout ??= "image-start";
1485
- const collectionLink = links.find((link) => link.category === "set");
1486
- if (!collectionLink) {
1487
- throw new Error(
1488
- `Collection link not found for the following component: \u201C${componentName}\u201D`
1489
- );
1490
- }
1506
+ properties.collectionId = collectionLink.uuid;
1491
1507
  properties.variant = variant;
1492
1508
  properties.itemVariant = itemVariant;
1509
+ properties.isSearchable = isSearchable;
1510
+ properties.showCount = showCount;
1493
1511
  properties.layout = layout;
1494
- properties.collectionId = collectionLink.uuid;
1495
1512
  break;
1496
1513
  }
1497
1514
  case "empty-space": {
@@ -1729,67 +1746,6 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1729
1746
  properties.content = document.content;
1730
1747
  break;
1731
1748
  }
1732
- case "text-image": {
1733
- if (!document) {
1734
- throw new Error(
1735
- `Document not found for the following component: \u201C${componentName}\u201D`
1736
- );
1737
- }
1738
- let variant = getPropertyValueByLabel(
1739
- componentProperty.properties,
1740
- "variant"
1741
- );
1742
- variant ??= "block";
1743
- let layout = getPropertyValueByLabel(
1744
- componentProperty.properties,
1745
- "layout"
1746
- );
1747
- layout ??= "image-start";
1748
- let captionLayout = getPropertyValueByLabel(
1749
- componentProperty.properties,
1750
- "layout-caption"
1751
- );
1752
- captionLayout ??= "bottom";
1753
- const imageLink = links.find(
1754
- (link) => link.type === "image" || link.type === "IIIF"
1755
- );
1756
- if (!imageLink) {
1757
- throw new Error(
1758
- `Image link not found for the following component: \u201C${componentName}\u201D: ${JSON.stringify(
1759
- links
1760
- )}`
1761
- );
1762
- }
1763
- let imageQuality = getPropertyValueByLabel(
1764
- componentProperty.properties,
1765
- "image-quality"
1766
- );
1767
- imageQuality ??= "high";
1768
- let captionSource = getPropertyValueByLabel(
1769
- componentProperty.properties,
1770
- "caption-source"
1771
- );
1772
- captionSource ??= "name";
1773
- let altTextSource = getPropertyValueByLabel(
1774
- componentProperty.properties,
1775
- "alt-text-source"
1776
- );
1777
- altTextSource ??= "name";
1778
- properties.variant = variant;
1779
- properties.image = {
1780
- url: `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&preview`,
1781
- label: imageLink.identification?.label ?? null,
1782
- width: imageLink.image?.width ?? 0,
1783
- height: imageLink.image?.height ?? 0
1784
- };
1785
- properties.imageQuality = imageQuality;
1786
- properties.layout = layout;
1787
- properties.captionSource = captionSource;
1788
- properties.captionLayout = captionLayout;
1789
- properties.altTextSource = altTextSource;
1790
- properties.content = document.content;
1791
- break;
1792
- }
1793
1749
  case "timeline": {
1794
1750
  const timelineLink = links.find((link) => link.category === "tree");
1795
1751
  if (!timelineLink) {
package/dist/index.d.cts CHANGED
@@ -505,8 +505,9 @@ type WebElementComponent = {
505
505
  collectionId: string;
506
506
  variant: "full" | "highlights";
507
507
  itemVariant: "default" | "card";
508
- layout: "image-top" | "image-bottom" | "image-start" | "image-end";
509
508
  isSearchable: boolean;
509
+ showCount: boolean;
510
+ layout: "image-top" | "image-bottom" | "image-start" | "image-end";
510
511
  } | {
511
512
  component: "empty-space";
512
513
  height: string | null;
@@ -558,16 +559,6 @@ type WebElementComponent = {
558
559
  variant: "title" | "block" | "banner";
559
560
  heading: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
560
561
  content: string;
561
- } | {
562
- component: "text-image";
563
- variant: "title" | "block" | "banner";
564
- image: WebImage;
565
- imageQuality: "high" | "low";
566
- layout: "image-top" | "image-bottom" | "image-start" | "image-end" | "image-background";
567
- captionSource: "name" | "abbreviation" | "description";
568
- captionLayout: "top" | "bottom" | "suppress";
569
- altTextSource: "name" | "abbreviation" | "description";
570
- content: string;
571
562
  } | {
572
563
  component: "timeline";
573
564
  timelineId: string;
package/dist/index.d.ts CHANGED
@@ -505,8 +505,9 @@ type WebElementComponent = {
505
505
  collectionId: string;
506
506
  variant: "full" | "highlights";
507
507
  itemVariant: "default" | "card";
508
- layout: "image-top" | "image-bottom" | "image-start" | "image-end";
509
508
  isSearchable: boolean;
509
+ showCount: boolean;
510
+ layout: "image-top" | "image-bottom" | "image-start" | "image-end";
510
511
  } | {
511
512
  component: "empty-space";
512
513
  height: string | null;
@@ -558,16 +559,6 @@ type WebElementComponent = {
558
559
  variant: "title" | "block" | "banner";
559
560
  heading: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
560
561
  content: string;
561
- } | {
562
- component: "text-image";
563
- variant: "title" | "block" | "banner";
564
- image: WebImage;
565
- imageQuality: "high" | "low";
566
- layout: "image-top" | "image-bottom" | "image-start" | "image-end" | "image-background";
567
- captionSource: "name" | "abbreviation" | "description";
568
- captionLayout: "top" | "bottom" | "suppress";
569
- altTextSource: "name" | "abbreviation" | "description";
570
- content: string;
571
562
  } | {
572
563
  component: "timeline";
573
564
  timelineId: string;
package/dist/index.js CHANGED
@@ -500,7 +500,6 @@ var componentSchema = z3.enum(
500
500
  "network-graph",
501
501
  "table",
502
502
  "text",
503
- "text-image",
504
503
  "timeline",
505
504
  "video"
506
505
  ],
@@ -1390,6 +1389,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1390
1389
  break;
1391
1390
  }
1392
1391
  case "collection": {
1392
+ const collectionLink = links.find((link) => link.category === "set");
1393
+ if (!collectionLink) {
1394
+ throw new Error(
1395
+ `Collection link not found for the following component: \u201C${componentName}\u201D`
1396
+ );
1397
+ }
1393
1398
  let variant = getPropertyValueByLabel(
1394
1399
  componentProperty.properties,
1395
1400
  "variant"
@@ -1400,21 +1405,33 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1400
1405
  "item-variant"
1401
1406
  );
1402
1407
  itemVariant ??= "default";
1408
+ let showCount = false;
1409
+ const showCountProperty = getPropertyValueByLabel(
1410
+ componentProperty.properties,
1411
+ "show-count"
1412
+ );
1413
+ if (showCountProperty !== null) {
1414
+ showCount = showCountProperty === "Yes";
1415
+ }
1416
+ let isSearchable = false;
1417
+ const isSearchableProperty = getPropertyValueByLabel(
1418
+ componentProperty.properties,
1419
+ "is-searchable"
1420
+ );
1421
+ if (isSearchableProperty !== null) {
1422
+ isSearchable = isSearchableProperty === "Yes";
1423
+ }
1403
1424
  let layout = getPropertyValueByLabel(
1404
1425
  componentProperty.properties,
1405
1426
  "layout"
1406
1427
  );
1407
1428
  layout ??= "image-start";
1408
- const collectionLink = links.find((link) => link.category === "set");
1409
- if (!collectionLink) {
1410
- throw new Error(
1411
- `Collection link not found for the following component: \u201C${componentName}\u201D`
1412
- );
1413
- }
1429
+ properties.collectionId = collectionLink.uuid;
1414
1430
  properties.variant = variant;
1415
1431
  properties.itemVariant = itemVariant;
1432
+ properties.isSearchable = isSearchable;
1433
+ properties.showCount = showCount;
1416
1434
  properties.layout = layout;
1417
- properties.collectionId = collectionLink.uuid;
1418
1435
  break;
1419
1436
  }
1420
1437
  case "empty-space": {
@@ -1652,67 +1669,6 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1652
1669
  properties.content = document.content;
1653
1670
  break;
1654
1671
  }
1655
- case "text-image": {
1656
- if (!document) {
1657
- throw new Error(
1658
- `Document not found for the following component: \u201C${componentName}\u201D`
1659
- );
1660
- }
1661
- let variant = getPropertyValueByLabel(
1662
- componentProperty.properties,
1663
- "variant"
1664
- );
1665
- variant ??= "block";
1666
- let layout = getPropertyValueByLabel(
1667
- componentProperty.properties,
1668
- "layout"
1669
- );
1670
- layout ??= "image-start";
1671
- let captionLayout = getPropertyValueByLabel(
1672
- componentProperty.properties,
1673
- "layout-caption"
1674
- );
1675
- captionLayout ??= "bottom";
1676
- const imageLink = links.find(
1677
- (link) => link.type === "image" || link.type === "IIIF"
1678
- );
1679
- if (!imageLink) {
1680
- throw new Error(
1681
- `Image link not found for the following component: \u201C${componentName}\u201D: ${JSON.stringify(
1682
- links
1683
- )}`
1684
- );
1685
- }
1686
- let imageQuality = getPropertyValueByLabel(
1687
- componentProperty.properties,
1688
- "image-quality"
1689
- );
1690
- imageQuality ??= "high";
1691
- let captionSource = getPropertyValueByLabel(
1692
- componentProperty.properties,
1693
- "caption-source"
1694
- );
1695
- captionSource ??= "name";
1696
- let altTextSource = getPropertyValueByLabel(
1697
- componentProperty.properties,
1698
- "alt-text-source"
1699
- );
1700
- altTextSource ??= "name";
1701
- properties.variant = variant;
1702
- properties.image = {
1703
- url: `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&preview`,
1704
- label: imageLink.identification?.label ?? null,
1705
- width: imageLink.image?.width ?? 0,
1706
- height: imageLink.image?.height ?? 0
1707
- };
1708
- properties.imageQuality = imageQuality;
1709
- properties.layout = layout;
1710
- properties.captionSource = captionSource;
1711
- properties.captionLayout = captionLayout;
1712
- properties.altTextSource = altTextSource;
1713
- properties.content = document.content;
1714
- break;
1715
- }
1716
1672
  case "timeline": {
1717
1673
  const timelineLink = links.find((link) => link.category === "tree");
1718
1674
  if (!timelineLink) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
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",