ochre-sdk 1.1.6 → 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.
@@ -68,6 +68,7 @@ const XMLContent = v.object({ content: v.array(v.object({
68
68
  lang: v.string("XMLContent: lang is string and required"),
69
69
  ...XMLRichTextEnvelope
70
70
  }), "XMLContent: content is array of object with string, title, and lang") }, "XMLContent: Shape error");
71
+ const XMLOptionalContent = v.optional(v.pipe(v.union([XMLContent, v.object({ payload: v.literal("", "XMLOptionalContent: payload is an empty string") }, "XMLOptionalContent: empty element is object with empty payload")], "XMLOptionalContent: content is XMLContent or an empty element"), v.transform((content) => "content" in content ? content : void 0)));
71
72
  const XMLNumber = v.pipe(v.union([v.string("XMLNumber: string is string and required"), XMLString]), v.check(isXMLNumber, "XMLNumber: string is not a number"), v.transform(parseXMLNumber));
72
73
  const XMLOptionalNumber = v.optional(v.pipe(v.union([v.string("XMLNumber: string is string and required"), XMLString]), v.check(isOptionalXMLNumber, "XMLNumber: string is not a number"), v.transform(parseOptionalXMLNumber)));
73
74
  const XMLBoolean = v.pipe(v.union([v.string("XMLBoolean: string is string and required"), XMLString]), v.check((value) => {
@@ -152,7 +153,7 @@ const XMLEvent = v.object({
152
153
  uuid: v.pipe(v.string("XMLEvent: uuid is string and required"), v.check(isPseudoUuid, "XMLEvent: uuid is not a valid pseudo-UUID")),
153
154
  publicationDateTime: v.optional(customDateTime("XMLEvent: publicationDateTime is not a valid datetime"))
154
155
  }, "XMLEvent: location is object with uuid")),
155
- comment: v.optional(XMLContent),
156
+ comment: XMLOptionalContent,
156
157
  label: XMLContent,
157
158
  other: v.optional(v.object({
158
159
  ...XMLContent.entries,
@@ -267,7 +268,7 @@ const XMLProperty = v.lazy(() => v.object({
267
268
  href: v.optional(v.string("XMLProperty: href is string and optional")),
268
269
  payload: v.optional(v.string("XMLProperty: payload is string and optional"))
269
270
  }), "XMLProperty: value is array of objects with payload")),
270
- comment: v.optional(XMLContent),
271
+ comment: XMLOptionalContent,
271
272
  styleProperties: v.optional(v.object({ payload: v.string("XMLProperty: styleProperties payload is string and required") }, "XMLProperty: styleProperties is object with payload")),
272
273
  property: v.optional(v.array(XMLProperty, "XMLProperty: property is array of XMLProperty"))
273
274
  }, "XMLProperty: Shape error"));
@@ -290,7 +291,7 @@ const XMLBaseItem = v.object({
290
291
  identification: v.optional(XMLIdentification, { label: { content: [] } }),
291
292
  context: v.optional(XMLContext),
292
293
  creators: v.optional(v.object({ creator: v.array(v.lazy(() => XMLPerson)) }, "XMLBaseItem: creators is object with creator array of XMLPerson")),
293
- description: v.optional(XMLContent),
294
+ description: XMLOptionalContent,
294
295
  events: v.optional(v.object({ event: v.array(XMLEvent) }, "XMLBaseItem: events is object with event array of XMLEvent"))
295
296
  }, "XMLBaseItem: Shape error");
296
297
  const XMLLinkedBaseItem = v.object({
@@ -643,7 +644,7 @@ const XMLResource = v.object({
643
644
  width: XMLOptionalNumber,
644
645
  image: v.optional(XMLImage),
645
646
  imagemap: v.optional(XMLImageMap),
646
- document: v.optional(XMLContent),
647
+ document: XMLOptionalContent,
647
648
  coordinates: v.optional(XMLCoordinates),
648
649
  periods: v.optional(v.object({ period: v.array(XMLPeriod) })),
649
650
  links: v.optional(v.lazy(() => XMLLink)),
@@ -718,7 +719,7 @@ const XMLWebsiteContextLevel = v.intersect([XMLString, v.object({
718
719
  }, "XMLWebsiteContextLevel: Shape error")]);
719
720
  const XMLWebsiteContextItemEntries = {
720
721
  identification: XMLIdentification,
721
- description: v.optional(XMLContent),
722
+ description: XMLOptionalContent,
722
723
  levels: v.optional(v.object({ level: v.array(XMLWebsiteContextLevel) }, "XMLWebsiteContextItem: levels is object with level"))
723
724
  };
724
725
  const XMLWebsiteContextItem = v.object(XMLWebsiteContextItemEntries, "XMLWebsiteContextItem: Shape error");
@@ -814,7 +815,7 @@ const XMLWebsiteResource = v.lazy(() => v.object({
814
815
  width: XMLOptionalNumber,
815
816
  image: v.optional(XMLImage),
816
817
  imagemap: v.optional(XMLImageMap),
817
- document: v.optional(XMLContent),
818
+ document: XMLOptionalContent,
818
819
  coordinates: v.optional(XMLCoordinates),
819
820
  periods: v.optional(v.object({ period: v.array(XMLPeriod) })),
820
821
  links: v.optional(v.lazy(() => XMLLink)),
@@ -927,6 +928,20 @@ const XMLSetItems = v.intersect([XMLItemLinks, v.object({
927
928
  pageSize: XMLNumber
928
929
  }, "XMLSetItems: Shape error")]);
929
930
  const XMLSetItemsData = v.object({ result: v.object({ ochre: v.object({ items: XMLSetItems }, "XMLSetItemsData: ochre") }) }, "XMLSetItemsData: Shape error");
931
+ const XMLSetItemLocation = v.object({
932
+ uuid: v.string("XMLSetItemLocation: uuid is string and required"),
933
+ category: v.string("XMLSetItemLocation: category is string and required"),
934
+ identification: XMLIdentification,
935
+ coordinates: v.optional(XMLCoordinates),
936
+ value: v.optional(v.array(v.intersect([v.object({
937
+ variable: v.string("XMLSetItemLocation: value variable is string and required"),
938
+ uuid: v.string("XMLSetItemLocation: value uuid is string and required")
939
+ }, "XMLSetItemLocation: value is object with variable and uuid"), XMLContent])))
940
+ }, "XMLSetItemLocation: Shape error");
941
+ const XMLSetItemLocationsData = v.object({ result: v.object({ ochre: v.object({ items: v.object({
942
+ totalCount: XMLNumber,
943
+ itemLocation: v.optional(v.array(XMLSetItemLocation, "XMLSetItemLocationsData: itemLocation is array of XMLSetItemLocation"))
944
+ }, "XMLSetItemLocationsData: items is object with totalCount") }, "XMLSetItemLocationsData: ochre") }) }, "XMLSetItemLocationsData: Shape error");
930
945
  const XMLData = v.object({ result: v.object({ ochre: v.intersect([v.object({
931
946
  uuid: v.pipe(v.string("XMLData: uuid is string and required"), v.check(isPseudoUuid, "XMLData: uuid is not a valid pseudo-UUID")),
932
947
  belongsTo: v.string("XMLData: belongsTo is string and required"),
@@ -947,4 +962,4 @@ const XMLWebsiteData = v.object({ result: v.object({ ochre: v.object({
947
962
  tree: v.array(XMLWebsiteTree)
948
963
  }, "XMLWebsiteData: ochre is object with website tree") }, "XMLWebsiteData: result is object with ochre") }, "XMLWebsiteData: Shape error");
949
964
  //#endregion
950
- export { XMLData, XMLDataItem, XMLGalleryData, XMLItemLinksData, XMLLink, XMLSetItemsData, XMLWebsiteData };
965
+ export { XMLData, XMLDataItem, XMLGalleryData, XMLItemLinksData, XMLLink, XMLSetItemLocationsData, XMLSetItemsData, XMLWebsiteData };
@@ -1,5 +1,5 @@
1
1
  declare namespace types_d_exports {
2
- export { XMLBaseItem, XMLBibliography, XMLConcept, XMLContent, XMLContext, XMLContextGroup, XMLContextItem, XMLContextValue, XMLCoordinate, XMLCoordinates, XMLCoordinatesSource, XMLData, XMLDataItem, XMLDictionaryUnit, XMLEmptyContext, XMLEvent, XMLGallery, XMLGalleryData, XMLHeading, XMLHeadingItemCategory, XMLIdentification, XMLImage, XMLImageMap, XMLImageMapArea, XMLInterpretation, XMLItemCategory, XMLItemLinks, XMLItemLinksData, XMLLicense, XMLLink, XMLLinkedBaseItem, XMLLinkedBibliography, XMLLinkedConcept, XMLLinkedPeriod, XMLLinkedPerson, XMLLinkedPropertyValue, XMLLinkedPropertyVariable, XMLLinkedResource, XMLLinkedSet, XMLLinkedSpatialUnit, XMLLinkedText, XMLLinkedTree, XMLMetadata, XMLNote, XMLObservation, XMLPeriod, XMLPerson, XMLProperty, XMLPropertyRelation, XMLPropertyValue, XMLPropertyVariable, XMLRecursiveItemCategory, XMLResource, XMLRichTextEnvelope, XMLSection, XMLSet, XMLSetItems, XMLSetItemsData, XMLSetStyle, XMLSimplifiedProperty, XMLSpatialUnit, XMLString, XMLText, XMLTree, XMLWebsiteContext, XMLWebsiteContextItem, XMLWebsiteContextLevel, XMLWebsiteData, XMLWebsiteFilterContext, XMLWebsiteFilterContextItem, XMLWebsiteOptions, XMLWebsiteProperties, XMLWebsiteResource, XMLWebsiteResourceGroup, XMLWebsiteResourceItem, XMLWebsiteScope, XMLWebsiteSegment, XMLWebsiteStyle, XMLWebsiteTree };
2
+ export { XMLBaseItem, XMLBibliography, XMLConcept, XMLContent, XMLContext, XMLContextGroup, XMLContextItem, XMLContextValue, XMLCoordinate, XMLCoordinates, XMLCoordinatesSource, XMLData, XMLDataItem, XMLDictionaryUnit, XMLEmptyContext, XMLEvent, XMLGallery, XMLGalleryData, XMLHeading, XMLHeadingItemCategory, XMLIdentification, XMLImage, XMLImageMap, XMLImageMapArea, XMLInterpretation, XMLItemCategory, XMLItemLinks, XMLItemLinksData, XMLLicense, XMLLink, XMLLinkedBaseItem, XMLLinkedBibliography, XMLLinkedConcept, XMLLinkedPeriod, XMLLinkedPerson, XMLLinkedPropertyValue, XMLLinkedPropertyVariable, XMLLinkedResource, XMLLinkedSet, XMLLinkedSpatialUnit, XMLLinkedText, XMLLinkedTree, XMLMetadata, XMLNote, XMLObservation, XMLPeriod, XMLPerson, XMLProperty, XMLPropertyRelation, XMLPropertyValue, XMLPropertyVariable, XMLRecursiveItemCategory, XMLResource, XMLRichTextEnvelope, XMLSection, XMLSet, XMLSetItemLocation, XMLSetItemLocationsData, XMLSetItems, XMLSetItemsData, XMLSetStyle, XMLSimplifiedProperty, XMLSpatialUnit, XMLString, XMLText, XMLTree, XMLWebsiteContext, XMLWebsiteContextItem, XMLWebsiteContextLevel, XMLWebsiteData, XMLWebsiteFilterContext, XMLWebsiteFilterContextItem, XMLWebsiteOptions, XMLWebsiteProperties, XMLWebsiteResource, XMLWebsiteResourceGroup, XMLWebsiteResourceItem, XMLWebsiteScope, XMLWebsiteSegment, XMLWebsiteStyle, XMLWebsiteTree };
3
3
  }
4
4
  export type XMLItemCategory = "tree" | "bibliography" | "spatialUnit" | "concept" | "period" | "person" | "propertyVariable" | "variable" | "propertyValue" | "value" | "text" | "resource" | "set";
5
5
  export type XMLRecursiveItemCategory = Exclude<XMLItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
@@ -889,6 +889,26 @@ export type XMLSetItemsData = {
889
889
  };
890
890
  };
891
891
  };
892
+ export type XMLSetItemLocation = {
893
+ uuid: string;
894
+ category: string;
895
+ identification: XMLIdentification;
896
+ coordinates?: XMLCoordinates;
897
+ value?: Array<{
898
+ variable: string;
899
+ uuid: string;
900
+ } & XMLContent>;
901
+ };
902
+ export type XMLSetItemLocationsData = {
903
+ result: {
904
+ ochre: {
905
+ items: {
906
+ totalCount: number;
907
+ itemLocation?: Array<XMLSetItemLocation>;
908
+ };
909
+ };
910
+ };
911
+ };
892
912
  export type XMLData = {
893
913
  result: {
894
914
  ochre: {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.1.6",
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",
7
- "author": "Firat Ciftci <firatciftci@uchicago.edu> (https://digitalculture.uchicago.edu)",
7
+ "author": "Firat Ciftci <firatciftci@uchicago.edu> (https://corpus.uchicago.edu)",
8
8
  "homepage": "https://github.com/uchicago-digitalculture-webdev/ochre-sdk",
9
9
  "bugs": {
10
10
  "url": "https://github.com/uchicago-digitalculture-webdev/ochre-sdk/issues"