@digitalculture/ochre-sdk 0.12.4 → 0.12.6

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
@@ -617,6 +617,9 @@ type WebElement = {
617
617
  * Union type of all possible web element components
618
618
  */
619
619
  type WebElementComponent = {
620
+ component: "advanced-search";
621
+ boundComponentUuid: string;
622
+ } | {
620
623
  component: "annotated-document";
621
624
  documentId: string;
622
625
  } | {
@@ -742,6 +745,11 @@ type WebElementComponent = {
742
745
  startIcon: string | null;
743
746
  endIcon: string | null;
744
747
  }>;
748
+ scopes: Array<{
749
+ uuid: string;
750
+ type: string;
751
+ identification: Identification;
752
+ }>;
745
753
  } | {
746
754
  component: "search-bar";
747
755
  variant: "default" | "full";
package/dist/index.mjs CHANGED
@@ -37,6 +37,7 @@ const websiteSchema = z.object({
37
37
  * @internal
38
38
  */
39
39
  const componentSchema = z.enum([
40
+ "advanced-search",
40
41
  "annotated-document",
41
42
  "annotated-image",
42
43
  "audio-player",
@@ -1692,6 +1693,12 @@ function parseWebElementProperties(componentProperty, elementResource) {
1692
1693
  const properties = { component: componentName };
1693
1694
  const links = elementResource.links ? parseLinks(Array.isArray(elementResource.links) ? elementResource.links : [elementResource.links]) : [];
1694
1695
  switch (componentName) {
1696
+ case "advanced-search": {
1697
+ const boundComponentPropertyUuid = getPropertyByLabel(componentProperty.properties, "bound-component")?.values[0]?.uuid;
1698
+ if (!boundComponentPropertyUuid) throw new Error(`Bound component not found for the following component: “${componentName}”`);
1699
+ properties.boundComponentUuid = boundComponentPropertyUuid;
1700
+ break;
1701
+ }
1695
1702
  case "annotated-document": {
1696
1703
  const documentLink = links.find((link) => link.type === "internalDocument");
1697
1704
  if (!documentLink) throw new Error(`Document link not found for the following component: “${componentName}”`);
@@ -2038,7 +2045,13 @@ function parseWebElementProperties(componentProperty, elementResource) {
2038
2045
  endIcon: endIcon !== null ? String(endIcon) : null
2039
2046
  });
2040
2047
  }
2048
+ const scopes = elementResource.options?.scopes != null ? (Array.isArray(elementResource.options.scopes.scope) ? elementResource.options.scopes.scope : [elementResource.options.scopes.scope]).map((scope) => ({
2049
+ uuid: scope.uuid.content,
2050
+ type: scope.uuid.type,
2051
+ identification: parseIdentification(scope.identification)
2052
+ })) : [];
2041
2053
  properties.queries = queries;
2054
+ properties.scopes = scopes;
2042
2055
  break;
2043
2056
  }
2044
2057
  case "table": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.12.4",
3
+ "version": "0.12.6",
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",
@@ -49,7 +49,7 @@
49
49
  "eslint": "^9.39.1",
50
50
  "prettier": "^3.6.2",
51
51
  "terser": "^5.44.1",
52
- "tsdown": "^0.16.1",
52
+ "tsdown": "^0.16.2",
53
53
  "typescript": "^5.9.3",
54
54
  "vitest": "^4.0.8"
55
55
  },