ochre-sdk 1.2.0 → 1.2.1

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.
@@ -2,6 +2,7 @@ import { normalizeItemCategory } from "../../categories.mjs";
2
2
  import { getErrorOutput } from "../../errors.mjs";
3
3
  import { requestOchre } from "../request.mjs";
4
4
  import { setItemLocationsParametersSchema } from "../../schemas.mjs";
5
+ import { parseRequiredContentLike } from "../../parsers/helpers.mjs";
5
6
  import { parseRequestedLanguages, resolveContentLanguages } from "../../parsers/languages.mjs";
6
7
  import { parseCoordinates, parseIdentification } from "../../parsers/index.mjs";
7
8
  import { XMLSetItemLocationsData } from "../../xml/schemas.mjs";
@@ -26,7 +27,7 @@ async function fetchSetItemLocations(parameters, options) {
26
27
  $item/identification,
27
28
  $item/coordinates,
28
29
  for $value in $item//properties//property[label/@uuid = $propertyVariableUuids]/value[@uuid]
29
- return <value variable="{$value/../label/@uuid}" uuid="{$value/@uuid}"/>
30
+ return <value variable="{$value/../label/@uuid}" uuid="{$value/@uuid}">{$value/content}</value>
30
31
  }</itemLocation>
31
32
  }</items>`
32
33
  }),
@@ -49,7 +50,8 @@ async function fetchSetItemLocations(parameters, options) {
49
50
  seenPropertyValues.add(key);
50
51
  propertyValues.push({
51
52
  variableUuid: value.variable,
52
- valueUuid: value.uuid
53
+ valueUuid: value.uuid,
54
+ label: parseRequiredContentLike(value, { languages })
53
55
  });
54
56
  }
55
57
  itemsByUuid.set(itemLocation.uuid, {
@@ -576,6 +576,7 @@ export type SetItemLocation<T extends LanguageCodes = LanguageCodes> = {
576
576
  propertyValues: Array<{
577
577
  variableUuid: string;
578
578
  valueUuid: string;
579
+ label: MultilingualString<T>;
579
580
  }>;
580
581
  };
581
582
  /**
@@ -4668,10 +4668,31 @@ export declare const XMLSetItemLocationsData: v.ObjectSchema<{
4668
4668
  }, "XMLCoordinatesSource: Shape error">], undefined>, undefined>;
4669
4669
  }, "XMLCoordinates: Shape error">], "XMLCoordinates: Shape error">, undefined>;
4670
4670
  }, "XMLCoordinates: Shape error">, undefined>;
4671
- readonly value: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
4671
+ readonly value: v.OptionalSchema<v.ArraySchema<v.IntersectSchema<[v.ObjectSchema<{
4672
4672
  readonly variable: v.StringSchema<"XMLSetItemLocation: value variable is string and required">;
4673
4673
  readonly uuid: v.StringSchema<"XMLSetItemLocation: value uuid is string and required">;
4674
- }, "XMLSetItemLocation: value is object with variable and uuid">, undefined>, undefined>;
4674
+ }, "XMLSetItemLocation: value is object with variable and uuid">, v.ObjectSchema<{
4675
+ readonly content: v.ArraySchema<v.ObjectSchema<{
4676
+ readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
4677
+ readonly properties: v.OptionalSchema<v.ObjectSchema<{
4678
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
4679
+ }, undefined>, undefined>;
4680
+ readonly annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
4681
+ readonly string: v.ArraySchema<v.ObjectSchema<{
4682
+ string: v.OptionalSchema<v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLString>>, "XMLString: string is array of XMLString">, undefined>;
4683
+ links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
4684
+ properties: v.OptionalSchema<v.ObjectSchema<{
4685
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
4686
+ }, undefined>, undefined>;
4687
+ annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
4688
+ payload: v.OptionalSchema<v.StringSchema<"XMLString: payload is string and optional">, undefined>;
4689
+ rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
4690
+ whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
4691
+ }, "XMLString: Shape error">, undefined>;
4692
+ readonly title: v.OptionalSchema<v.StringSchema<"XMLContent: title is string and optional">, undefined>;
4693
+ readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
4694
+ }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
4695
+ }, "XMLContent: Shape error">], undefined>, undefined>, undefined>;
4675
4696
  }, "XMLSetItemLocation: Shape error">, "XMLSetItemLocationsData: itemLocation is array of XMLSetItemLocation">, undefined>;
4676
4697
  }, "XMLSetItemLocationsData: items is object with totalCount">;
4677
4698
  }, "XMLSetItemLocationsData: ochre">;
@@ -933,10 +933,10 @@ const XMLSetItemLocation = v.object({
933
933
  category: v.string("XMLSetItemLocation: category is string and required"),
934
934
  identification: XMLIdentification,
935
935
  coordinates: v.optional(XMLCoordinates),
936
- value: v.optional(v.array(v.object({
936
+ value: v.optional(v.array(v.intersect([v.object({
937
937
  variable: v.string("XMLSetItemLocation: value variable is string and required"),
938
938
  uuid: v.string("XMLSetItemLocation: value uuid is string and required")
939
- }, "XMLSetItemLocation: value is object with variable and uuid")))
939
+ }, "XMLSetItemLocation: value is object with variable and uuid"), XMLContent])))
940
940
  }, "XMLSetItemLocation: Shape error");
941
941
  const XMLSetItemLocationsData = v.object({ result: v.object({ ochre: v.object({ items: v.object({
942
942
  totalCount: XMLNumber,
@@ -897,7 +897,7 @@ export type XMLSetItemLocation = {
897
897
  value?: Array<{
898
898
  variable: string;
899
899
  uuid: string;
900
- }>;
900
+ } & XMLContent>;
901
901
  };
902
902
  export type XMLSetItemLocationsData = {
903
903
  result: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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",