@digitalculture/ochre-sdk 0.5.14 → 0.5.16

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
@@ -570,6 +570,7 @@ var componentSchema = import_zod3.z.enum(
570
570
  "button",
571
571
  "collection",
572
572
  "empty-space",
573
+ "filter-categories",
573
574
  "iframe",
574
575
  "iiif-viewer",
575
576
  "image",
@@ -1572,14 +1573,34 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1572
1573
  properties.width = width;
1573
1574
  break;
1574
1575
  }
1576
+ case "filter-categories": {
1577
+ const filterLink = links.find((link) => link.category === "set");
1578
+ if (!filterLink) {
1579
+ throw new Error(
1580
+ `Filter link not found for the following component: \u201C${componentName}\u201D`
1581
+ );
1582
+ }
1583
+ properties.filterId = filterLink.uuid;
1584
+ break;
1585
+ }
1575
1586
  case "iframe": {
1576
- const url = links.find((link) => link.type === "webpage")?.href;
1577
- if (!url) {
1587
+ const href = links.find((link) => link.type === "webpage")?.href;
1588
+ if (!href) {
1578
1589
  throw new Error(
1579
1590
  `URL not found for the following component: \u201C${componentName}\u201D`
1580
1591
  );
1581
1592
  }
1582
- properties.url = url;
1593
+ const height = getPropertyValueByLabel(
1594
+ componentProperty.properties,
1595
+ "height"
1596
+ );
1597
+ const width = getPropertyValueByLabel(
1598
+ componentProperty.properties,
1599
+ "width"
1600
+ );
1601
+ properties.href = href;
1602
+ properties.height = height;
1603
+ properties.width = width;
1583
1604
  break;
1584
1605
  }
1585
1606
  case "iiif-viewer": {
@@ -2312,7 +2333,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2312
2333
  Array.isArray(resource.properties.property) ? resource.properties.property : [resource.properties.property]
2313
2334
  ) : [];
2314
2335
  return resourceProperties.some(
2315
- (property) => property.label === "presentation" && property.values[0]?.content === "element" && property.properties[0]?.label === "component" && property.properties[0]?.values[0]?.content === "sidebar"
2336
+ (property) => property.label === "presentation" && property.values[0]?.content === "element" && property.properties[0]?.label === "component" && property.properties[0].values[0]?.content === "sidebar"
2316
2337
  );
2317
2338
  });
2318
2339
  if (sidebarResource) {
package/dist/index.d.cts CHANGED
@@ -527,9 +527,14 @@ type WebElementComponent = {
527
527
  component: "empty-space";
528
528
  height: string | null;
529
529
  width: string | null;
530
+ } | {
531
+ component: "filter-categories";
532
+ filterId: string;
530
533
  } | {
531
534
  component: "iframe";
532
- url: string;
535
+ href: string;
536
+ height: string | null;
537
+ width: string | null;
533
538
  } | {
534
539
  component: "iiif-viewer";
535
540
  IIIFId: string;
package/dist/index.d.ts CHANGED
@@ -527,9 +527,14 @@ type WebElementComponent = {
527
527
  component: "empty-space";
528
528
  height: string | null;
529
529
  width: string | null;
530
+ } | {
531
+ component: "filter-categories";
532
+ filterId: string;
530
533
  } | {
531
534
  component: "iframe";
532
- url: string;
535
+ href: string;
536
+ height: string | null;
537
+ width: string | null;
533
538
  } | {
534
539
  component: "iiif-viewer";
535
540
  IIIFId: string;
package/dist/index.js CHANGED
@@ -490,6 +490,7 @@ var componentSchema = z3.enum(
490
490
  "button",
491
491
  "collection",
492
492
  "empty-space",
493
+ "filter-categories",
493
494
  "iframe",
494
495
  "iiif-viewer",
495
496
  "image",
@@ -1492,14 +1493,34 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1492
1493
  properties.width = width;
1493
1494
  break;
1494
1495
  }
1496
+ case "filter-categories": {
1497
+ const filterLink = links.find((link) => link.category === "set");
1498
+ if (!filterLink) {
1499
+ throw new Error(
1500
+ `Filter link not found for the following component: \u201C${componentName}\u201D`
1501
+ );
1502
+ }
1503
+ properties.filterId = filterLink.uuid;
1504
+ break;
1505
+ }
1495
1506
  case "iframe": {
1496
- const url = links.find((link) => link.type === "webpage")?.href;
1497
- if (!url) {
1507
+ const href = links.find((link) => link.type === "webpage")?.href;
1508
+ if (!href) {
1498
1509
  throw new Error(
1499
1510
  `URL not found for the following component: \u201C${componentName}\u201D`
1500
1511
  );
1501
1512
  }
1502
- properties.url = url;
1513
+ const height = getPropertyValueByLabel(
1514
+ componentProperty.properties,
1515
+ "height"
1516
+ );
1517
+ const width = getPropertyValueByLabel(
1518
+ componentProperty.properties,
1519
+ "width"
1520
+ );
1521
+ properties.href = href;
1522
+ properties.height = height;
1523
+ properties.width = width;
1503
1524
  break;
1504
1525
  }
1505
1526
  case "iiif-viewer": {
@@ -2232,7 +2253,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2232
2253
  Array.isArray(resource.properties.property) ? resource.properties.property : [resource.properties.property]
2233
2254
  ) : [];
2234
2255
  return resourceProperties.some(
2235
- (property) => property.label === "presentation" && property.values[0]?.content === "element" && property.properties[0]?.label === "component" && property.properties[0]?.values[0]?.content === "sidebar"
2256
+ (property) => property.label === "presentation" && property.values[0]?.content === "element" && property.properties[0]?.label === "component" && property.properties[0].values[0]?.content === "sidebar"
2236
2257
  );
2237
2258
  });
2238
2259
  if (sidebarResource) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.5.14",
3
+ "version": "0.5.16",
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",
@@ -44,11 +44,11 @@
44
44
  "zod": "^3.24.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@antfu/eslint-config": "^4.11.0",
47
+ "@antfu/eslint-config": "^4.12.0",
48
48
  "@arethetypeswrong/cli": "^0.17.4",
49
- "@changesets/cli": "^2.28.1",
49
+ "@changesets/cli": "^2.29.1",
50
50
  "@total-typescript/ts-reset": "^0.6.1",
51
- "@types/node": "^22.14.0",
51
+ "@types/node": "^22.14.1",
52
52
  "eslint": "^9.24.0",
53
53
  "eslint-plugin-unused-imports": "^4.1.4",
54
54
  "prettier": "^3.5.3",