ochre-sdk 1.3.13 → 1.3.14
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/categories.d.mts +1 -3
- package/dist/categories.mjs +1 -2
- package/dist/constants.d.mts +1 -3
- package/dist/constants.mjs +11 -4
- package/dist/errors.d.mts +0 -2
- package/dist/errors.mjs +1 -2
- package/dist/fetchers/container-items.d.mts +1 -3
- package/dist/fetchers/container-items.mjs +1 -2
- package/dist/fetchers/gallery.d.mts +1 -3
- package/dist/fetchers/gallery.mjs +1 -2
- package/dist/fetchers/item-children.d.mts +0 -2
- package/dist/fetchers/item-children.mjs +1 -2
- package/dist/fetchers/item-links.d.mts +1 -3
- package/dist/fetchers/item-links.mjs +1 -2
- package/dist/fetchers/item-locations.d.mts +1 -3
- package/dist/fetchers/item-locations.mjs +1 -2
- package/dist/fetchers/item-ocr-data.d.mts +1 -3
- package/dist/fetchers/item-ocr-data.mjs +1 -2
- package/dist/fetchers/item.d.mts +0 -2
- package/dist/fetchers/item.mjs +1 -2
- package/dist/fetchers/map-layers.d.mts +1 -3
- package/dist/fetchers/map-layers.mjs +1 -2
- package/dist/fetchers/request.d.mts +1 -3
- package/dist/fetchers/request.mjs +1 -2
- package/dist/fetchers/set/items.d.mts +0 -2
- package/dist/fetchers/set/items.mjs +1 -2
- package/dist/fetchers/set/property-values.d.mts +1 -3
- package/dist/fetchers/set/property-values.mjs +1 -2
- package/dist/fetchers/tree/items.d.mts +0 -2
- package/dist/fetchers/tree/items.mjs +1 -2
- package/dist/fetchers/website-metadata.d.mts +1 -3
- package/dist/fetchers/website-metadata.mjs +1 -2
- package/dist/fetchers/website.d.mts +1 -3
- package/dist/fetchers/website.mjs +1 -2
- package/dist/getters.d.mts +0 -2
- package/dist/getters.mjs +1 -2
- package/dist/helpers.d.mts +0 -2
- package/dist/helpers.mjs +1 -2
- package/dist/index.d.mts +2 -2
- package/dist/languages.d.mts +1 -3
- package/dist/languages.mjs +1 -2
- package/dist/ocr.d.mts +1 -3
- package/dist/ocr.mjs +1 -2
- package/dist/parsers/helpers.d.mts +1 -3
- package/dist/parsers/helpers.mjs +1 -2
- package/dist/parsers/index.d.mts +0 -2
- package/dist/parsers/index.mjs +11 -2
- package/dist/parsers/languages.d.mts +1 -3
- package/dist/parsers/languages.mjs +1 -2
- package/dist/parsers/mdx.d.mts +1 -3
- package/dist/parsers/mdx.mjs +1 -2
- package/dist/parsers/multilingual.d.mts +0 -2
- package/dist/parsers/multilingual.mjs +1 -2
- package/dist/parsers/property-token.d.mts +0 -2
- package/dist/parsers/property-token.mjs +1 -2
- package/dist/parsers/string.d.mts +1 -3
- package/dist/parsers/string.mjs +1 -2
- package/dist/parsers/website/bounds.d.mts +1 -3
- package/dist/parsers/website/bounds.mjs +1 -2
- package/dist/parsers/website/components.d.mts +0 -2
- package/dist/parsers/website/components.mjs +1 -2
- package/dist/parsers/website/index.d.mts +1 -3
- package/dist/parsers/website/index.mjs +1 -2
- package/dist/parsers/website/links.d.mts +1 -3
- package/dist/parsers/website/links.mjs +1 -2
- package/dist/parsers/website/messages.d.mts +1 -3
- package/dist/parsers/website/messages.mjs +1 -2
- package/dist/parsers/website/options.d.mts +1 -3
- package/dist/parsers/website/options.mjs +1 -2
- package/dist/parsers/website/properties.d.mts +1 -3
- package/dist/parsers/website/properties.mjs +1 -2
- package/dist/parsers/website/reader.d.mts +0 -2
- package/dist/parsers/website/reader.mjs +1 -2
- package/dist/parsers/website/slug.d.mts +1 -3
- package/dist/parsers/website/slug.mjs +1 -2
- package/dist/parsers/website/styles.d.mts +1 -3
- package/dist/parsers/website/styles.mjs +1 -2
- package/dist/parsers/website/walk.d.mts +1 -3
- package/dist/parsers/website/walk.mjs +1 -2
- package/dist/query.d.mts +0 -2
- package/dist/query.mjs +1 -2
- package/dist/reflection.d.mts +1 -3
- package/dist/reflection.mjs +1 -2
- package/dist/schemas.d.mts +1 -3
- package/dist/schemas.mjs +1 -2
- package/dist/types/index.d.mts +11 -2
- package/dist/types/utilities.d.mts +1 -3
- package/dist/types/website.d.mts +1 -3
- package/dist/xml/dates.d.mts +1 -3
- package/dist/xml/dates.mjs +1 -2
- package/dist/xml/metadata.d.mts +1 -3
- package/dist/xml/metadata.mjs +1 -2
- package/dist/xml/schemas.d.mts +22 -3
- package/dist/xml/schemas.mjs +14 -2
- package/dist/xml/types.d.mts +11 -3
- package/dist/xquery.d.mts +1 -3
- package/dist/xquery.mjs +1 -2
- package/package.json +7 -6
package/dist/reflection.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/reflection.ts
|
|
2
2
|
/**
|
|
3
3
|
* Reading values whose shape is not known at compile time
|
|
4
4
|
*
|
|
@@ -75,5 +75,4 @@ function readStringProperty(value, key) {
|
|
|
75
75
|
const property = readProperty(value, key);
|
|
76
76
|
return typeof property === "string" ? property : null;
|
|
77
77
|
}
|
|
78
|
-
//#endregion
|
|
79
78
|
export { isObject, readArrayProperty, readEntries, readProperty, readStringProperty };
|
package/dist/schemas.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Query } from "./types/index.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
//#region src/schemas.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Validates a pseudo-UUID string
|
|
6
5
|
* @param value - The string to validate
|
|
@@ -147,5 +146,4 @@ export declare const treeItemsParametersSchema: v.ObjectSchema<{
|
|
|
147
146
|
readonly page: v.OptionalSchema<v.GenericSchema<unknown, number>, 1>;
|
|
148
147
|
readonly pageSize: v.OptionalSchema<v.GenericSchema<unknown, number>, 48>;
|
|
149
148
|
readonly treeScopeUuids: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, v.MinLengthAction<string[], 1, "At least one tree scope UUID is required">]>;
|
|
150
|
-
}, undefined>;
|
|
151
|
-
//#endregion
|
|
149
|
+
}, undefined>;
|
package/dist/schemas.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./constants.mjs";
|
|
2
2
|
import { getOchreLanguageCode, isOchreLanguageCode } from "./languages.mjs";
|
|
3
3
|
import * as v from "valibot";
|
|
4
|
-
|
|
4
|
+
// src/schemas.ts
|
|
5
5
|
const PSEUDO_UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/i;
|
|
6
6
|
/**
|
|
7
7
|
* Validates a pseudo-UUID string
|
|
@@ -290,5 +290,4 @@ const treeItemsParametersSchema = v.object({
|
|
|
290
290
|
treeScopeUuids: v.pipe(v.array(uuidSchema), v.minLength(1, "At least one tree scope UUID is required")),
|
|
291
291
|
...containerItemsParametersEntries
|
|
292
292
|
});
|
|
293
|
-
//#endregion
|
|
294
293
|
export { componentSchema, gallerySchema, isPseudoUuid, itemLocationsParametersSchema, itemOcrDataParametersSchema, ochreLanguageCodeSchema, renderOptionsSchema, setItemsParametersSchema, setPropertyValuesParametersSchema, treeItemsParametersSchema, uuidSchema };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MultilingualString } from "../parsers/multilingual.mjs";
|
|
2
2
|
import { Prettify } from "./utilities.mjs";
|
|
3
3
|
import { Style, Webpage } from "./website.mjs";
|
|
4
|
-
//#region src/types/index.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Language-code tuple or array used by OCHRE multilingual fields.
|
|
7
6
|
*
|
|
@@ -226,6 +225,14 @@ export type Image<T extends LanguageCodes = LanguageCodes> = {
|
|
|
226
225
|
fileSize: number | null;
|
|
227
226
|
base64: string | null;
|
|
228
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* Download option of an item in OCHRE
|
|
230
|
+
*/
|
|
231
|
+
export type DownloadOption = {
|
|
232
|
+
type: "highQualityImage" | "iiifManifest" | "document" | "ocr";
|
|
233
|
+
href: string;
|
|
234
|
+
fileFormat: string;
|
|
235
|
+
};
|
|
229
236
|
/**
|
|
230
237
|
* Area of an image map in OCHRE
|
|
231
238
|
*/
|
|
@@ -652,6 +659,7 @@ export type Bibliography<T extends LanguageCodes = LanguageCodes, U extends Item
|
|
|
652
659
|
citationFormatSpan: string | null;
|
|
653
660
|
referenceFormatDiv: string | null;
|
|
654
661
|
image: Image<T> | null;
|
|
662
|
+
downloadOptions: Array<DownloadOption>;
|
|
655
663
|
sourceDocument: BibliographySourceDocument | null;
|
|
656
664
|
publicationInfo: {
|
|
657
665
|
publishers: Array<Person<T, "embedded">>;
|
|
@@ -723,6 +731,7 @@ export type Observation<T extends LanguageCodes = LanguageCodes> = {
|
|
|
723
731
|
periods: Array<Period<T, "embedded">>;
|
|
724
732
|
links: ItemLinks<T>;
|
|
725
733
|
reverseLinks: ItemLinks<T>;
|
|
734
|
+
downloadOptions: Array<DownloadOption>;
|
|
726
735
|
notes: Array<Note<T>>;
|
|
727
736
|
properties: Array<Property<T>>;
|
|
728
737
|
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
@@ -764,6 +773,7 @@ export type Resource<T extends LanguageCodes = LanguageCodes, U extends ItemPayl
|
|
|
764
773
|
image: Image<T> | null;
|
|
765
774
|
document: MultilingualString<T> | null;
|
|
766
775
|
imageMap: ImageMap | null;
|
|
776
|
+
downloadOptions: Array<DownloadOption>;
|
|
767
777
|
coordinates: Array<Coordinates<T>>;
|
|
768
778
|
periods: Array<Period<T, "embedded">>;
|
|
769
779
|
links: ItemLinks<T>;
|
|
@@ -1015,5 +1025,4 @@ export type ItemProperty<T extends LanguageCodes = LanguageCodes> = Property<T>
|
|
|
1015
1025
|
*/
|
|
1016
1026
|
export type RecursiveItemCategory = Exclude<ItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
|
|
1017
1027
|
export type TopLevelItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "topLevel">;
|
|
1018
|
-
//#endregion
|
|
1019
1028
|
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
//#region src/types/utilities.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Flatten an intersection so editors show one object instead of `A & B`
|
|
4
3
|
*
|
|
5
4
|
* Deliberately not re-exported from the package root: it is a TypeScript
|
|
6
5
|
* presentation detail, not part of the OCHRE model.
|
|
7
6
|
*/
|
|
8
|
-
export type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
9
|
-
//#endregion
|
|
7
|
+
export type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
package/dist/types/website.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MultilingualString } from "../parsers/multilingual.mjs";
|
|
2
2
|
import { Prettify } from "./utilities.mjs";
|
|
3
3
|
import { Bibliography, Identification, ItemCategory, LanguageCodes, License, Metadata, Person, QueryablePropertyValueDataType } from "./index.mjs";
|
|
4
|
-
//#region src/types/website.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Represents a context tree level item with a variable and value
|
|
7
6
|
*/
|
|
@@ -579,5 +578,4 @@ export type AccordionWebBlock<T extends LanguageCodes = LanguageCodes> = WebBloc
|
|
|
579
578
|
/**
|
|
580
579
|
* Represents a stylesheet item with its UUID and category
|
|
581
580
|
*/
|
|
582
|
-
export type StylesheetCategory = Extract<ItemCategory, "propertyVariable" | "propertyValue">;
|
|
583
|
-
//#endregion
|
|
581
|
+
export type StylesheetCategory = Extract<ItemCategory, "propertyVariable" | "propertyValue">;
|
package/dist/xml/dates.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/xml/dates.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Parses ISO date/time strings and OCHRE's "YYYY-MM-DD HH:mm:ss" format.
|
|
4
3
|
* Like date-fns parseISO: strings without a timezone offset (including
|
|
@@ -9,5 +8,4 @@
|
|
|
9
8
|
* @returns A Date object representing the parsed date/time, or an Invalid Date if parsing fails.
|
|
10
9
|
* @internal
|
|
11
10
|
*/
|
|
12
|
-
export declare function parseDateTime(value: string): Date;
|
|
13
|
-
//#endregion
|
|
11
|
+
export declare function parseDateTime(value: string): Date;
|
package/dist/xml/dates.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/xml/dates.ts
|
|
2
2
|
/**
|
|
3
3
|
* Regular expression to match ISO date/time strings and OCHRE's "YYYY-MM-DD HH:mm:ss" format.
|
|
4
4
|
*/
|
|
@@ -45,5 +45,4 @@ function parseDateTime(value) {
|
|
|
45
45
|
if (timezone == null || timezone === "Z") return date;
|
|
46
46
|
return applyTimezoneOffset(date, timezone);
|
|
47
47
|
}
|
|
48
|
-
//#endregion
|
|
49
48
|
export { parseDateTime };
|
package/dist/xml/metadata.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/xml/metadata.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Read the offset a node started at in the source XML
|
|
4
3
|
* @param value - The parsed node
|
|
@@ -16,5 +15,4 @@ export declare function getXMLSourceIndex(value: unknown): number | null;
|
|
|
16
15
|
* @param input - The raw parsed input to read metadata from
|
|
17
16
|
* @internal
|
|
18
17
|
*/
|
|
19
|
-
export declare function restoreXMLMetadata(output: unknown, input: unknown): void;
|
|
20
|
-
//#endregion
|
|
18
|
+
export declare function restoreXMLMetadata(output: unknown, input: unknown): void;
|
package/dist/xml/metadata.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isObject, readEntries, readProperty } from "../reflection.mjs";
|
|
2
2
|
import { XMLParser } from "fast-xml-parser";
|
|
3
|
-
|
|
3
|
+
// src/xml/metadata.ts
|
|
4
4
|
const XML_METADATA_SYMBOL = XMLParser.getMetaDataSymbol();
|
|
5
5
|
/**
|
|
6
6
|
* Read the source metadata `fast-xml-parser` attaches under a symbol key
|
|
@@ -47,5 +47,4 @@ function restoreXMLMetadata(output, input) {
|
|
|
47
47
|
}
|
|
48
48
|
for (const [key, outputValue] of readEntries(output)) restoreXMLMetadata(outputValue, readProperty(input, key));
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { getXMLSourceIndex, restoreXMLMetadata };
|
package/dist/xml/schemas.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { XMLBibliography, XMLData as XMLData$1, XMLDataItem as XMLDataItem$1, XMLItemLinksData as XMLItemLinksData$1, XMLLink as XMLLink$1, XMLPeriod, XMLPerson, XMLProperty, XMLResource, XMLSetItemsData as XMLSetItemsData$1, XMLString, XMLWebsiteResource, XMLWebsiteResourceItem } from "./types.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
//#region src/xml/schemas.d.ts
|
|
4
3
|
export declare const XMLLink: v.GenericSchema<unknown, XMLLink$1>;
|
|
5
4
|
export declare const XMLDataItem: v.GenericSchema<unknown, XMLDataItem$1>;
|
|
6
5
|
export declare const XMLItemLinksData: v.GenericSchema<unknown, XMLItemLinksData$1>;
|
|
@@ -448,6 +447,13 @@ export declare const XMLGalleryData: v.ObjectSchema<{
|
|
|
448
447
|
whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
|
|
449
448
|
}, "XMLString: Shape error">], undefined>, v.CheckAction<string | XMLString, "XMLNumber: string is not a number">, v.TransformAction<string | XMLString, number>]>;
|
|
450
449
|
}, "XMLImageMap: Shape error">, undefined>;
|
|
450
|
+
readonly downloadOptions: v.OptionalSchema<v.ObjectSchema<{
|
|
451
|
+
readonly option: v.ArraySchema<v.ObjectSchema<{
|
|
452
|
+
readonly type: v.PicklistSchema<["highQualityImage", "iiifManifest", "document", "ocr"], "XMLDownloadOptions: type is highQualityImage, iiifManifest, document, or ocr">;
|
|
453
|
+
readonly href: v.SchemaWithPipe<readonly [v.StringSchema<"XMLDownloadOptions: href is string and required">, v.UrlAction<string, "XMLDownloadOptions: href is not a valid URL">]>;
|
|
454
|
+
readonly fileFormat: v.StringSchema<"XMLDownloadOptions: fileFormat is string and required">;
|
|
455
|
+
}, "XMLDownloadOptions: option is object with type, href, and fileFormat">, undefined>;
|
|
456
|
+
}, "XMLDownloadOptions: Shape error">, undefined>;
|
|
451
457
|
readonly document: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.ObjectSchema<{
|
|
452
458
|
readonly content: v.ArraySchema<v.ObjectSchema<{
|
|
453
459
|
readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
|
|
@@ -1645,6 +1651,13 @@ export declare const XMLGalleryData: v.ObjectSchema<{
|
|
|
1645
1651
|
}, "XMLString: Shape error">], undefined>, v.CheckAction<string | XMLString, "XMLNumber: string is not a number">, v.TransformAction<string | XMLString, number | undefined>]>, undefined>;
|
|
1646
1652
|
readonly payload: v.OptionalSchema<v.StringSchema<"XMLImage: payload is string and optional">, undefined>;
|
|
1647
1653
|
}, "XMLImage: Shape error">, undefined>;
|
|
1654
|
+
readonly downloadOptions: v.OptionalSchema<v.ObjectSchema<{
|
|
1655
|
+
readonly option: v.ArraySchema<v.ObjectSchema<{
|
|
1656
|
+
readonly type: v.PicklistSchema<["highQualityImage", "iiifManifest", "document", "ocr"], "XMLDownloadOptions: type is highQualityImage, iiifManifest, document, or ocr">;
|
|
1657
|
+
readonly href: v.SchemaWithPipe<readonly [v.StringSchema<"XMLDownloadOptions: href is string and required">, v.UrlAction<string, "XMLDownloadOptions: href is not a valid URL">]>;
|
|
1658
|
+
readonly fileFormat: v.StringSchema<"XMLDownloadOptions: fileFormat is string and required">;
|
|
1659
|
+
}, "XMLDownloadOptions: option is object with type, href, and fileFormat">, undefined>;
|
|
1660
|
+
}, "XMLDownloadOptions: Shape error">, undefined>;
|
|
1648
1661
|
readonly publicationInfo: v.OptionalSchema<v.ObjectSchema<{
|
|
1649
1662
|
readonly publishers: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
|
|
1650
1663
|
readonly publisher: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLPerson>>, undefined>;
|
|
@@ -2982,6 +2995,13 @@ export declare const XMLGalleryData: v.ObjectSchema<{
|
|
|
2982
2995
|
}, "XMLString: Shape error">], undefined>, v.CheckAction<string | XMLString, "XMLNumber: string is not a number">, v.TransformAction<string | XMLString, number | undefined>]>, undefined>;
|
|
2983
2996
|
readonly payload: v.OptionalSchema<v.StringSchema<"XMLImage: payload is string and optional">, undefined>;
|
|
2984
2997
|
}, "XMLImage: Shape error">, undefined>;
|
|
2998
|
+
readonly downloadOptions: v.OptionalSchema<v.ObjectSchema<{
|
|
2999
|
+
readonly option: v.ArraySchema<v.ObjectSchema<{
|
|
3000
|
+
readonly type: v.PicklistSchema<["highQualityImage", "iiifManifest", "document", "ocr"], "XMLDownloadOptions: type is highQualityImage, iiifManifest, document, or ocr">;
|
|
3001
|
+
readonly href: v.SchemaWithPipe<readonly [v.StringSchema<"XMLDownloadOptions: href is string and required">, v.UrlAction<string, "XMLDownloadOptions: href is not a valid URL">]>;
|
|
3002
|
+
readonly fileFormat: v.StringSchema<"XMLDownloadOptions: fileFormat is string and required">;
|
|
3003
|
+
}, "XMLDownloadOptions: option is object with type, href, and fileFormat">, undefined>;
|
|
3004
|
+
}, "XMLDownloadOptions: Shape error">, undefined>;
|
|
2985
3005
|
readonly publicationInfo: v.OptionalSchema<v.ObjectSchema<{
|
|
2986
3006
|
readonly publishers: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
|
|
2987
3007
|
readonly publisher: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLPerson>>, undefined>;
|
|
@@ -7784,5 +7804,4 @@ export declare const XMLWebsiteData: v.ObjectSchema<{
|
|
|
7784
7804
|
}, undefined>, undefined>;
|
|
7785
7805
|
}, "XMLWebsiteData: ochre is object with website tree">;
|
|
7786
7806
|
}, "XMLWebsiteData: result is object with ochre">;
|
|
7787
|
-
}, "XMLWebsiteData: Shape error">;
|
|
7788
|
-
//#endregion
|
|
7807
|
+
}, "XMLWebsiteData: Shape error">;
|
package/dist/xml/schemas.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { readArrayProperty } from "../reflection.mjs";
|
|
|
2
2
|
import { isPseudoUuid } from "../schemas.mjs";
|
|
3
3
|
import { parseDateTime } from "./dates.mjs";
|
|
4
4
|
import * as v from "valibot";
|
|
5
|
-
|
|
5
|
+
// src/xml/schemas.ts
|
|
6
6
|
function getXMLStringPayload(value) {
|
|
7
7
|
return typeof value === "string" ? value : value.payload ?? null;
|
|
8
8
|
}
|
|
@@ -221,6 +221,16 @@ const XMLImage = v.object({
|
|
|
221
221
|
fileSize: XMLOptionalNumber,
|
|
222
222
|
payload: v.optional(v.string("XMLImage: payload is string and optional"))
|
|
223
223
|
}, "XMLImage: Shape error");
|
|
224
|
+
const XMLDownloadOptions = v.object({ option: v.array(v.object({
|
|
225
|
+
type: v.picklist([
|
|
226
|
+
"highQualityImage",
|
|
227
|
+
"iiifManifest",
|
|
228
|
+
"document",
|
|
229
|
+
"ocr"
|
|
230
|
+
], "XMLDownloadOptions: type is highQualityImage, iiifManifest, document, or ocr"),
|
|
231
|
+
href: v.pipe(v.string("XMLDownloadOptions: href is string and required"), v.url("XMLDownloadOptions: href is not a valid URL")),
|
|
232
|
+
fileFormat: v.string("XMLDownloadOptions: fileFormat is string and required")
|
|
233
|
+
}, "XMLDownloadOptions: option is object with type, href, and fileFormat")) }, "XMLDownloadOptions: Shape error");
|
|
224
234
|
const XMLImageMapArea = v.object({
|
|
225
235
|
uuid: v.pipe(v.string("XMLImageMapArea: uuid is string and required"), v.check(isPseudoUuid, "XMLImageMapArea: uuid is not a valid pseudo-UUID")),
|
|
226
236
|
publicationDateTime: v.optional(customDateTime("XMLImageMapArea: publicationDateTime is not a valid datetime")),
|
|
@@ -487,6 +497,7 @@ const XMLBibliography = v.object({
|
|
|
487
497
|
publicationDateTime: v.optional(customDateTime("XMLBibliography: publicationDateTime is not a valid datetime"))
|
|
488
498
|
}, "XMLBibliography: sourceDocument is object with uuid and payload")),
|
|
489
499
|
image: v.optional(XMLImage),
|
|
500
|
+
downloadOptions: v.optional(XMLDownloadOptions),
|
|
490
501
|
publicationInfo: v.optional(v.object({
|
|
491
502
|
publishers: v.optional(v.union([v.object({ publisher: v.array(v.lazy(() => XMLPerson)) }), v.object({ publishers: v.object({ person: v.array(v.lazy(() => XMLPerson)) }) })])),
|
|
492
503
|
startDate: v.optional(v.object({
|
|
@@ -556,6 +567,7 @@ const XMLObservation = v.object({
|
|
|
556
567
|
v.lazy(() => XMLDataItem),
|
|
557
568
|
v.array(v.union([v.lazy(() => XMLLink), v.lazy(() => XMLDataItem)]))
|
|
558
569
|
])),
|
|
570
|
+
downloadOptions: v.optional(XMLDownloadOptions),
|
|
559
571
|
notes: v.optional(v.object({ note: v.array(XMLNote) })),
|
|
560
572
|
properties: v.optional(v.object({ property: v.array(XMLProperty) })),
|
|
561
573
|
bibliographies: v.optional(v.object({ bibliography: v.array(XMLBibliography) }))
|
|
@@ -647,6 +659,7 @@ const XMLResource = v.object({
|
|
|
647
659
|
width: XMLOptionalNumber,
|
|
648
660
|
image: v.optional(XMLImage),
|
|
649
661
|
imagemap: v.optional(XMLImageMap),
|
|
662
|
+
downloadOptions: v.optional(XMLDownloadOptions),
|
|
650
663
|
document: XMLOptionalContent,
|
|
651
664
|
coordinates: v.optional(XMLCoordinates),
|
|
652
665
|
periods: v.optional(v.object({ period: v.array(XMLPeriod) })),
|
|
@@ -982,5 +995,4 @@ const XMLWebsiteData = v.object({ result: v.object({ ochre: v.object({
|
|
|
982
995
|
tree: v.array(XMLWebsiteTree),
|
|
983
996
|
styleLabels: v.optional(v.object({ styleLabel: v.optional(v.array(v.intersect([v.object({ valueUuid: v.string("XMLWebsiteData: styleLabel valueUuid is string and required") }, "XMLWebsiteData: styleLabel is object with valueUuid"), XMLContent]))) }))
|
|
984
997
|
}, "XMLWebsiteData: ochre is object with website tree") }, "XMLWebsiteData: result is object with ochre") }, "XMLWebsiteData: Shape error");
|
|
985
|
-
//#endregion
|
|
986
998
|
export { XMLData, XMLDataItem, XMLGalleryData, XMLItemLinksData, XMLItemLocationsData, XMLLink, XMLMapSourcesData, XMLSetItemsData, XMLWebsiteData };
|
package/dist/xml/types.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/xml/types.d.ts
|
|
2
1
|
export type XMLItemCategory = "tree" | "bibliography" | "spatialUnit" | "concept" | "period" | "person" | "propertyVariable" | "variable" | "propertyValue" | "value" | "text" | "resource" | "set";
|
|
3
2
|
export type XMLRecursiveItemCategory = Exclude<XMLItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
|
|
4
3
|
/**
|
|
@@ -167,6 +166,13 @@ export type XMLImage = {
|
|
|
167
166
|
fileSize?: number;
|
|
168
167
|
payload?: string;
|
|
169
168
|
};
|
|
169
|
+
export type XMLDownloadOptions = {
|
|
170
|
+
option: Array<{
|
|
171
|
+
type: "highQualityImage" | "iiifManifest" | "document" | "ocr";
|
|
172
|
+
href: string;
|
|
173
|
+
fileFormat: string;
|
|
174
|
+
}>;
|
|
175
|
+
};
|
|
170
176
|
export type XMLImageMapArea = {
|
|
171
177
|
uuid: string;
|
|
172
178
|
publicationDateTime?: Date;
|
|
@@ -256,6 +262,7 @@ export type XMLBibliography = Partial<XMLBaseItem> & {
|
|
|
256
262
|
publicationDateTime?: Date;
|
|
257
263
|
};
|
|
258
264
|
image?: XMLImage;
|
|
265
|
+
downloadOptions?: XMLDownloadOptions;
|
|
259
266
|
publicationInfo?: {
|
|
260
267
|
publishers?: {
|
|
261
268
|
publisher: Array<XMLPerson>;
|
|
@@ -434,6 +441,7 @@ export type XMLObservation = {
|
|
|
434
441
|
};
|
|
435
442
|
links?: XMLLink;
|
|
436
443
|
reverseLinks?: XMLLink | XMLDataItem | Array<XMLLink | XMLDataItem>;
|
|
444
|
+
downloadOptions?: XMLDownloadOptions;
|
|
437
445
|
notes?: {
|
|
438
446
|
note: Array<XMLNote>;
|
|
439
447
|
};
|
|
@@ -546,6 +554,7 @@ export type XMLResource = XMLBaseItem & {
|
|
|
546
554
|
width?: number;
|
|
547
555
|
image?: XMLImage;
|
|
548
556
|
imagemap?: XMLImageMap;
|
|
557
|
+
downloadOptions?: XMLDownloadOptions;
|
|
549
558
|
document?: XMLContent;
|
|
550
559
|
coordinates?: XMLCoordinates;
|
|
551
560
|
periods?: {
|
|
@@ -966,5 +975,4 @@ export type XMLWebsiteData = {
|
|
|
966
975
|
};
|
|
967
976
|
};
|
|
968
977
|
};
|
|
969
|
-
export type XMLHeadingItemCategory = Exclude<XMLItemCategory, "tree" | "bibliography" | "spatialUnit" | "concept" | "period">;
|
|
970
|
-
//#endregion
|
|
978
|
+
export type XMLHeadingItemCategory = Exclude<XMLItemCategory, "tree" | "bibliography" | "spatialUnit" | "concept" | "period">;
|
package/dist/xquery.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/xquery.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Build a string literal for an XQuery string
|
|
4
3
|
* @param value - The string value to escape
|
|
@@ -74,5 +73,4 @@ export declare function compileOchreQuery(parameters: {
|
|
|
74
73
|
declarations?: ReadonlyArray<string>;
|
|
75
74
|
body: (context: OchreQueryContext) => string;
|
|
76
75
|
contentLanguage?: OchreContentLanguage | null;
|
|
77
|
-
}): string;
|
|
78
|
-
//#endregion
|
|
76
|
+
}): string;
|
package/dist/xquery.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_LANGUAGES } from "./constants.mjs";
|
|
2
|
-
|
|
2
|
+
// src/xquery.ts
|
|
3
3
|
/**
|
|
4
4
|
* Build a string literal for an XQuery string
|
|
5
5
|
* @param value - The string value to escape
|
|
@@ -137,5 +137,4 @@ ${contentLanguage == null ? bodyExpression : `local:select-language((
|
|
|
137
137
|
${bodyExpression}
|
|
138
138
|
), ${stringLiteral(contentLanguage.language)}, ${stringLiteral(contentLanguage.fallbackLanguage)})`}`;
|
|
139
139
|
}
|
|
140
|
-
//#endregion
|
|
141
140
|
export { OCHRE_RESPONSE_PADDING, compileOchreQuery, getContentLanguage, stringLiteral };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ochre-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.14",
|
|
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",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"
|
|
48
|
+
"@nodable/entities": "^3.1.0",
|
|
49
|
+
"fast-equals": "^6.2.1",
|
|
49
50
|
"fast-xml-parser": "^5.11.2",
|
|
50
51
|
"valibot": "^1.5.0"
|
|
51
52
|
},
|
|
@@ -53,15 +54,15 @@
|
|
|
53
54
|
"@antfu/eslint-config": "^9.5.1",
|
|
54
55
|
"@types/node": "^24.19.2",
|
|
55
56
|
"bumpp": "^12.3.0",
|
|
56
|
-
"eslint": "^10.
|
|
57
|
+
"eslint": "^10.13.0",
|
|
57
58
|
"eslint-plugin-erasable-syntax-only": "^0.7.2",
|
|
58
59
|
"eslint-plugin-slop": "^0.1.3",
|
|
59
60
|
"eslint-plugin-sonarjs": "^4.2.2",
|
|
60
|
-
"knip": "^6.
|
|
61
|
-
"oxfmt": "^0.
|
|
61
|
+
"knip": "^6.42.1",
|
|
62
|
+
"oxfmt": "^0.74.0",
|
|
62
63
|
"tsdown": "^0.23.1",
|
|
63
64
|
"typescript": "^6.0.3",
|
|
64
|
-
"vitest": "^5.0.
|
|
65
|
+
"vitest": "^5.0.5"
|
|
65
66
|
},
|
|
66
67
|
"scripts": {
|
|
67
68
|
"dev": "tsdown src/index.ts --watch",
|