ochre-sdk 1.1.5 → 1.2.0
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/README.md +8 -0
- package/dist/constants.mjs +1 -0
- package/dist/fetchers/container-items.mjs +12 -0
- package/dist/fetchers/set/item-locations.d.mts +35 -0
- package/dist/fetchers/set/item-locations.mjs +78 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +2 -1
- package/dist/parsers/index.d.mts +3 -2
- package/dist/parsers/index.mjs +29 -1
- package/dist/parsers/website/components.mjs +2 -0
- package/dist/schemas.d.mts +20 -0
- package/dist/schemas.mjs +17 -1
- package/dist/types/index.d.mts +43 -1
- package/dist/types/website.d.mts +1 -0
- package/dist/xml/schemas.d.mts +1630 -180
- package/dist/xml/schemas.mjs +30 -7
- package/dist/xml/types.d.mts +36 -1
- package/package.json +7 -7
package/dist/xml/schemas.mjs
CHANGED
|
@@ -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:
|
|
156
|
+
comment: XMLOptionalContent,
|
|
156
157
|
label: XMLContent,
|
|
157
158
|
other: v.optional(v.object({
|
|
158
159
|
...XMLContent.entries,
|
|
@@ -267,7 +268,8 @@ 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:
|
|
271
|
+
comment: XMLOptionalContent,
|
|
272
|
+
styleProperties: v.optional(v.object({ payload: v.string("XMLProperty: styleProperties payload is string and required") }, "XMLProperty: styleProperties is object with payload")),
|
|
271
273
|
property: v.optional(v.array(XMLProperty, "XMLProperty: property is array of XMLProperty"))
|
|
272
274
|
}, "XMLProperty: Shape error"));
|
|
273
275
|
/**
|
|
@@ -289,7 +291,7 @@ const XMLBaseItem = v.object({
|
|
|
289
291
|
identification: v.optional(XMLIdentification, { label: { content: [] } }),
|
|
290
292
|
context: v.optional(XMLContext),
|
|
291
293
|
creators: v.optional(v.object({ creator: v.array(v.lazy(() => XMLPerson)) }, "XMLBaseItem: creators is object with creator array of XMLPerson")),
|
|
292
|
-
description:
|
|
294
|
+
description: XMLOptionalContent,
|
|
293
295
|
events: v.optional(v.object({ event: v.array(XMLEvent) }, "XMLBaseItem: events is object with event array of XMLEvent"))
|
|
294
296
|
}, "XMLBaseItem: Shape error");
|
|
295
297
|
const XMLLinkedBaseItem = v.object({
|
|
@@ -433,6 +435,12 @@ const XMLTree = v.object({
|
|
|
433
435
|
set: v.optional(v.array(v.lazy(() => XMLSet)))
|
|
434
436
|
}))
|
|
435
437
|
}, "XMLTree: Shape error");
|
|
438
|
+
const XMLSetStyle = v.object({
|
|
439
|
+
content: v.optional(XMLContent.entries.content),
|
|
440
|
+
date: v.optional(customDateTime("XMLSetStyle: date is not a valid datetime")),
|
|
441
|
+
authors: v.optional(v.object({ author: v.array(v.lazy(() => XMLPerson)) }, "XMLSetStyle: authors is object with author array of XMLPerson")),
|
|
442
|
+
properties: v.optional(v.object({ property: v.array(XMLProperty) }, "XMLSetStyle: properties is object with property array of XMLProperty"))
|
|
443
|
+
}, "XMLSetStyle: Shape error");
|
|
436
444
|
const XMLSet = v.object({
|
|
437
445
|
...XMLBaseItem.entries,
|
|
438
446
|
type: v.optional(v.string("XMLSet: type is string and optional")),
|
|
@@ -446,6 +454,7 @@ const XMLSet = v.object({
|
|
|
446
454
|
])),
|
|
447
455
|
notes: v.optional(v.object({ note: v.array(XMLNote) })),
|
|
448
456
|
properties: v.optional(v.object({ property: v.array(XMLProperty) })),
|
|
457
|
+
styles: v.optional(v.object({ style: v.array(XMLSetStyle) }, "XMLSet: styles is object with style array of XMLSetStyle")),
|
|
449
458
|
items: v.optional(v.object({
|
|
450
459
|
tree: v.optional(v.array(v.lazy(() => XMLTree))),
|
|
451
460
|
bibliography: v.optional(v.array(v.lazy(() => XMLBibliography))),
|
|
@@ -635,7 +644,7 @@ const XMLResource = v.object({
|
|
|
635
644
|
width: XMLOptionalNumber,
|
|
636
645
|
image: v.optional(XMLImage),
|
|
637
646
|
imagemap: v.optional(XMLImageMap),
|
|
638
|
-
document:
|
|
647
|
+
document: XMLOptionalContent,
|
|
639
648
|
coordinates: v.optional(XMLCoordinates),
|
|
640
649
|
periods: v.optional(v.object({ period: v.array(XMLPeriod) })),
|
|
641
650
|
links: v.optional(v.lazy(() => XMLLink)),
|
|
@@ -710,7 +719,7 @@ const XMLWebsiteContextLevel = v.intersect([XMLString, v.object({
|
|
|
710
719
|
}, "XMLWebsiteContextLevel: Shape error")]);
|
|
711
720
|
const XMLWebsiteContextItemEntries = {
|
|
712
721
|
identification: XMLIdentification,
|
|
713
|
-
description:
|
|
722
|
+
description: XMLOptionalContent,
|
|
714
723
|
levels: v.optional(v.object({ level: v.array(XMLWebsiteContextLevel) }, "XMLWebsiteContextItem: levels is object with level"))
|
|
715
724
|
};
|
|
716
725
|
const XMLWebsiteContextItem = v.object(XMLWebsiteContextItemEntries, "XMLWebsiteContextItem: Shape error");
|
|
@@ -806,7 +815,7 @@ const XMLWebsiteResource = v.lazy(() => v.object({
|
|
|
806
815
|
width: XMLOptionalNumber,
|
|
807
816
|
image: v.optional(XMLImage),
|
|
808
817
|
imagemap: v.optional(XMLImageMap),
|
|
809
|
-
document:
|
|
818
|
+
document: XMLOptionalContent,
|
|
810
819
|
coordinates: v.optional(XMLCoordinates),
|
|
811
820
|
periods: v.optional(v.object({ period: v.array(XMLPeriod) })),
|
|
812
821
|
links: v.optional(v.lazy(() => XMLLink)),
|
|
@@ -919,6 +928,20 @@ const XMLSetItems = v.intersect([XMLItemLinks, v.object({
|
|
|
919
928
|
pageSize: XMLNumber
|
|
920
929
|
}, "XMLSetItems: Shape error")]);
|
|
921
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.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")))
|
|
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");
|
|
922
945
|
const XMLData = v.object({ result: v.object({ ochre: v.intersect([v.object({
|
|
923
946
|
uuid: v.pipe(v.string("XMLData: uuid is string and required"), v.check(isPseudoUuid, "XMLData: uuid is not a valid pseudo-UUID")),
|
|
924
947
|
belongsTo: v.string("XMLData: belongsTo is string and required"),
|
|
@@ -939,4 +962,4 @@ const XMLWebsiteData = v.object({ result: v.object({ ochre: v.object({
|
|
|
939
962
|
tree: v.array(XMLWebsiteTree)
|
|
940
963
|
}, "XMLWebsiteData: ochre is object with website tree") }, "XMLWebsiteData: result is object with ochre") }, "XMLWebsiteData: Shape error");
|
|
941
964
|
//#endregion
|
|
942
|
-
export { XMLData, XMLDataItem, XMLGalleryData, XMLItemLinksData, XMLLink, XMLSetItemsData, XMLWebsiteData };
|
|
965
|
+
export { XMLData, XMLDataItem, XMLGalleryData, XMLItemLinksData, XMLLink, XMLSetItemLocationsData, XMLSetItemsData, XMLWebsiteData };
|
package/dist/xml/types.d.mts
CHANGED
|
@@ -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, 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">;
|
|
@@ -215,6 +215,9 @@ export type XMLProperty = {
|
|
|
215
215
|
payload?: string;
|
|
216
216
|
}>;
|
|
217
217
|
comment?: XMLContent;
|
|
218
|
+
styleProperties?: {
|
|
219
|
+
payload: string;
|
|
220
|
+
};
|
|
218
221
|
property?: Array<XMLProperty>;
|
|
219
222
|
};
|
|
220
223
|
/**
|
|
@@ -741,6 +744,15 @@ export type XMLWebsiteTree = Omit<XMLTree, "items" | "properties"> & {
|
|
|
741
744
|
resource?: Array<XMLWebsiteResourceItem>;
|
|
742
745
|
};
|
|
743
746
|
};
|
|
747
|
+
export type XMLSetStyle = Partial<XMLContent> & {
|
|
748
|
+
date?: Date;
|
|
749
|
+
authors?: {
|
|
750
|
+
author: Array<XMLPerson>;
|
|
751
|
+
};
|
|
752
|
+
properties?: {
|
|
753
|
+
property: Array<XMLProperty>;
|
|
754
|
+
};
|
|
755
|
+
};
|
|
744
756
|
export type XMLSet = XMLBaseItem & {
|
|
745
757
|
type?: string;
|
|
746
758
|
suppressBlanks?: boolean;
|
|
@@ -753,6 +765,9 @@ export type XMLSet = XMLBaseItem & {
|
|
|
753
765
|
properties?: {
|
|
754
766
|
property: Array<XMLProperty>;
|
|
755
767
|
};
|
|
768
|
+
styles?: {
|
|
769
|
+
style: Array<XMLSetStyle>;
|
|
770
|
+
};
|
|
756
771
|
items?: {
|
|
757
772
|
tree?: Array<XMLTree>;
|
|
758
773
|
bibliography?: Array<XMLBibliography>;
|
|
@@ -874,6 +889,26 @@ export type XMLSetItemsData = {
|
|
|
874
889
|
};
|
|
875
890
|
};
|
|
876
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
|
+
}>;
|
|
901
|
+
};
|
|
902
|
+
export type XMLSetItemLocationsData = {
|
|
903
|
+
result: {
|
|
904
|
+
ochre: {
|
|
905
|
+
items: {
|
|
906
|
+
totalCount: number;
|
|
907
|
+
itemLocation?: Array<XMLSetItemLocation>;
|
|
908
|
+
};
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
};
|
|
877
912
|
export type XMLData = {
|
|
878
913
|
result: {
|
|
879
914
|
ochre: {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ochre-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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://
|
|
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"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"fast-equals": "^6.0.4",
|
|
49
|
-
"fast-xml-parser": "^5.11.
|
|
49
|
+
"fast-xml-parser": "^5.11.2",
|
|
50
50
|
"valibot": "^1.5.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"eslint": "^10.11.0",
|
|
57
57
|
"eslint-plugin-erasable-syntax-only": "^0.7.2",
|
|
58
58
|
"eslint-plugin-slop": "^0.1.3",
|
|
59
|
-
"eslint-plugin-sonarjs": "^4.2.
|
|
60
|
-
"knip": "^6.
|
|
61
|
-
"oxfmt": "^0.
|
|
59
|
+
"eslint-plugin-sonarjs": "^4.2.2",
|
|
60
|
+
"knip": "^6.39.0",
|
|
61
|
+
"oxfmt": "^0.71.0",
|
|
62
62
|
"tsdown": "^0.23.0",
|
|
63
63
|
"typescript": "^6.0.3",
|
|
64
|
-
"vitest": "^5.0.
|
|
64
|
+
"vitest": "^5.0.3"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"dev": "tsdown src/index.ts --watch",
|