ochre-sdk 0.19.10 → 0.19.11

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
@@ -1,4 +1,4 @@
1
- //#region src/types/main.d.ts
1
+ //#region src/types/index.d.ts
2
2
  /**
3
3
  * Represents the OCHRE API version
4
4
  */
@@ -975,6 +975,17 @@ type WebElementComponent = {
975
975
  startIcon: string | null;
976
976
  endIcon: string | null;
977
977
  }>;
978
+ options: {
979
+ attributeFilters: {
980
+ bibliographies: boolean;
981
+ periods: boolean;
982
+ };
983
+ scopes: Array<Scope> | null;
984
+ contexts: PropertyContexts | null;
985
+ labels: {
986
+ title: string | null;
987
+ };
988
+ };
978
989
  displayedProperties: Array<{
979
990
  uuid: string;
980
991
  label: string;
package/dist/index.mjs CHANGED
@@ -3076,6 +3076,26 @@ function parseWebElementProperties(componentProperty, elementResource) {
3076
3076
  });
3077
3077
  }
3078
3078
  if (queries.length === 0) throw new Error(`No queries found for the following component: “${componentName}”`);
3079
+ const options = {
3080
+ attributeFilters: {
3081
+ bibliographies: elementResource.options?.filterBibliography ?? false,
3082
+ periods: elementResource.options?.filterPeriods ?? false
3083
+ },
3084
+ scopes: elementResource.options?.scopes != null ? ensureArray(elementResource.options.scopes.scope).map((scope) => ({
3085
+ uuid: scope.uuid.content,
3086
+ type: scope.uuid.type,
3087
+ identification: parseIdentification(scope.identification)
3088
+ })) : null,
3089
+ contexts: null,
3090
+ labels: { title: null }
3091
+ };
3092
+ if ("options" in elementResource && elementResource.options) {
3093
+ options.contexts = parseAllOptionContexts(elementResource.options);
3094
+ if ("notes" in elementResource.options && elementResource.options.notes) {
3095
+ const labelNotes = parseNotes(ensureArray(elementResource.options.notes.note));
3096
+ options.labels.title = labelNotes.find((note) => note.title === "Title label")?.content ?? null;
3097
+ }
3098
+ }
3079
3099
  const displayedProperties = getPropertyByLabel(componentProperty.properties, "use-property");
3080
3100
  let itemVariant = getPropertyValueByLabel(componentProperty.properties, "item-variant");
3081
3101
  itemVariant ??= "detailed";
@@ -3087,6 +3107,7 @@ function parseWebElementProperties(componentProperty, elementResource) {
3087
3107
  component: "query",
3088
3108
  linkUuids: setLinks.map((link) => link.uuid).filter((uuid) => uuid !== null),
3089
3109
  queries,
3110
+ options,
3090
3111
  displayedProperties: displayedProperties?.values.filter((value) => value.uuid !== null).map((value) => ({
3091
3112
  uuid: value.uuid,
3092
3113
  label: value.content?.toString() ?? ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "0.19.10",
3
+ "version": "0.19.11",
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",