@digitalculture/ochre-sdk 0.15.13 → 0.15.15

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
@@ -612,6 +612,14 @@ type PropertyContexts = {
612
612
  label: Array<LevelContext>;
613
613
  prominent: Array<LevelContext>;
614
614
  };
615
+ /**
616
+ * Represents a scope with its UUID, type and identification
617
+ */
618
+ type Scope = {
619
+ uuid: string;
620
+ type: string;
621
+ identification: Identification;
622
+ };
615
623
  /**
616
624
  * Represents a website with its properties and elements
617
625
  */
@@ -661,6 +669,7 @@ type Website = {
661
669
  isPropertyValuesGrouped: boolean;
662
670
  options: {
663
671
  contexts: PropertyContexts | null;
672
+ scopes: Array<Scope> | null;
664
673
  };
665
674
  };
666
675
  };
@@ -792,11 +801,7 @@ type WebElementComponent = {
792
801
  bibliographies: boolean;
793
802
  periods: boolean;
794
803
  };
795
- scopes: Array<{
796
- uuid: string;
797
- type: string;
798
- identification: Identification;
799
- }>;
804
+ scopes: Array<Scope> | null;
800
805
  contexts: PropertyContexts | null;
801
806
  };
802
807
  } | {
@@ -858,11 +863,6 @@ type WebElementComponent = {
858
863
  startIcon: string | null;
859
864
  endIcon: string | null;
860
865
  }>;
861
- scopes: Array<{
862
- uuid: string;
863
- type: string;
864
- identification: Identification;
865
- }>;
866
866
  } | {
867
867
  component: "search-bar";
868
868
  queryVariant: "submit" | "change";
@@ -1312,4 +1312,4 @@ declare function filterProperties(property: Property, filter: {
1312
1312
  value: string | number | boolean | Date;
1313
1313
  }, options?: PropertyOptions): boolean;
1314
1314
  //#endregion
1315
- export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinate, Data, DataCategory, Event, FileFormat, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyContexts, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Section, Set, SpatialUnit, Style, Text, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, Website, fetchByUuidMetadata, fetchGallery, fetchItem, fetchPropertyQuery, fetchWebsite, filterProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
1315
+ export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinate, Data, DataCategory, Event, FileFormat, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyContexts, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Scope, Section, Set, SpatialUnit, Style, Text, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, Website, fetchByUuidMetadata, fetchGallery, fetchItem, fetchPropertyQuery, fetchWebsite, filterProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
package/dist/index.mjs CHANGED
@@ -2072,7 +2072,7 @@ function parseWebElementProperties(componentProperty, elementResource) {
2072
2072
  uuid: scope.uuid.content,
2073
2073
  type: scope.uuid.type,
2074
2074
  identification: parseIdentification(scope.identification)
2075
- })) : [],
2075
+ })) : null,
2076
2076
  contexts: null
2077
2077
  };
2078
2078
  if ("options" in elementResource && elementResource.options) {
@@ -2306,13 +2306,7 @@ function parseWebElementProperties(componentProperty, elementResource) {
2306
2306
  endIcon: endIcon !== null ? String(endIcon) : null
2307
2307
  });
2308
2308
  }
2309
- const scopes = elementResource.options?.scopes != null ? (Array.isArray(elementResource.options.scopes.scope) ? elementResource.options.scopes.scope : [elementResource.options.scopes.scope]).map((scope) => ({
2310
- uuid: scope.uuid.content,
2311
- type: scope.uuid.type,
2312
- identification: parseIdentification(scope.identification)
2313
- })) : [];
2314
2309
  properties.queries = queries;
2315
- properties.scopes = scopes;
2316
2310
  break;
2317
2311
  }
2318
2312
  case "table": {
@@ -2912,7 +2906,13 @@ function parseWebsiteProperties(properties, websiteTree) {
2912
2906
  if (defaultThemeProperty) defaultTheme = defaultThemeProperty.content;
2913
2907
  const { type: validatedType, status: validatedStatus, privacy: validatedPrivacy } = result.data;
2914
2908
  let contexts = null;
2909
+ let scopes = null;
2915
2910
  if ("options" in websiteTree && websiteTree.options) {
2911
+ scopes = websiteTree.options.scopes != null ? (Array.isArray(websiteTree.options.scopes.scope) ? websiteTree.options.scopes.scope : [websiteTree.options.scopes.scope]).map((scope) => ({
2912
+ uuid: scope.uuid.content,
2913
+ type: scope.uuid.type,
2914
+ identification: parseIdentification(scope.identification)
2915
+ })) : null;
2916
2916
  const flattenContextsRaw = websiteTree.options.flattenContexts != null ? Array.isArray(websiteTree.options.flattenContexts) ? websiteTree.options.flattenContexts : [websiteTree.options.flattenContexts] : [];
2917
2917
  const suppressContextsRaw = websiteTree.options.suppressContexts != null ? Array.isArray(websiteTree.options.suppressContexts) ? websiteTree.options.suppressContexts : [websiteTree.options.suppressContexts] : [];
2918
2918
  const filterContextsRaw = websiteTree.options.filterContexts != null ? Array.isArray(websiteTree.options.filterContexts) ? websiteTree.options.filterContexts : [websiteTree.options.filterContexts] : [];
@@ -2950,7 +2950,10 @@ function parseWebsiteProperties(properties, websiteTree) {
2950
2950
  itemPage: {
2951
2951
  iiifViewer,
2952
2952
  isPropertyValuesGrouped,
2953
- options: { contexts }
2953
+ options: {
2954
+ contexts,
2955
+ scopes
2956
+ }
2954
2957
  }
2955
2958
  };
2956
2959
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.15.13",
3
+ "version": "0.15.15",
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",