ochre-sdk 1.0.57 → 1.0.60
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/constants.d.mts +0 -1
- package/dist/fetchers/gallery.d.mts +0 -1
- package/dist/fetchers/item-children.d.mts +0 -1
- package/dist/fetchers/item-links.d.mts +0 -1
- package/dist/fetchers/item.d.mts +0 -1
- package/dist/fetchers/set/items.d.mts +0 -1
- package/dist/fetchers/set/property-values.d.mts +0 -1
- package/dist/fetchers/website-metadata.d.mts +0 -1
- package/dist/fetchers/website.d.mts +0 -1
- package/dist/getters.d.mts +3 -2
- package/dist/helpers.d.mts +0 -1
- package/dist/parsers/helpers.d.mts +0 -1
- package/dist/parsers/index.d.mts +0 -1
- package/dist/parsers/index.mjs +1 -1
- package/dist/parsers/multilingual.d.mts +5 -2
- package/dist/parsers/string.d.mts +0 -1
- package/dist/parsers/website/index.d.mts +0 -1
- package/dist/parsers/website/reader.d.mts +0 -1
- package/dist/query.d.mts +0 -1
- package/dist/schemas.d.mts +0 -1
- package/dist/types/index.d.mts +2 -3
- package/dist/types/website.d.mts +1 -2
- package/dist/utilities.d.mts +0 -1
- package/dist/xml/schemas.d.mts +0 -1
- package/package.json +10 -10
package/dist/constants.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ContainedItemCategoryFromOption, ContainedItemCategoryOption, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemContainerCategory, SetItemCategory, TreeItemCategory } from "../types/index.mjs";
|
|
2
2
|
import { FetchBaseOptions, FetchLanguages } from "../parsers/helpers.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/fetchers/item-children.d.ts
|
|
5
4
|
type FetchItemChildrenResult<TItems> = Promise<{
|
|
6
5
|
items: TItems;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ContainedItemCategoryFromOption, ContainedItemCategoryOption, Item, ItemCategory, ItemContainerCategory } from "../types/index.mjs";
|
|
2
2
|
import { FetchBaseOptions, FetchLanguages } from "../parsers/helpers.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/fetchers/item-links.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Fetches linked OCHRE items by source-item UUID.
|
package/dist/fetchers/item.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ContainedItemCategoryFromOption, ContainedItemCategoryOption, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemWithoutEmbeddedItems } from "../types/index.mjs";
|
|
2
2
|
import { FetchBaseOptions, FetchLanguages } from "../parsers/helpers.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/fetchers/item.d.ts
|
|
5
4
|
type FetchItemResult<TItem> = Promise<{
|
|
6
5
|
item: TItem;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Query, SetItem, SetItemCategory, SetItemsSort } from "../../types/index.mjs";
|
|
2
2
|
import { FetchBaseOptions, FetchLanguages } from "../../parsers/helpers.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/fetchers/set/items.d.ts
|
|
5
4
|
type FetchSetItemsCategory<TContainedItemCategories extends ReadonlyArray<SetItemCategory> | undefined> = TContainedItemCategories extends ReadonlyArray<infer U> ? Extract<U, SetItemCategory> : SetItemCategory;
|
|
6
5
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Website } from "../types/website.mjs";
|
|
2
2
|
import { LanguageCodes } from "../types/index.mjs";
|
|
3
3
|
import { FetchFunction } from "../parsers/helpers.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/fetchers/website.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Fetches and parses a website configuration from the OCHRE API
|
package/dist/getters.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { LanguageCodes, Property, PropertyLike, PropertyValueContent, SetItemProperty, SetItemSimplifiedProperty, SimplifiedProperty } from "./types/index.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/getters.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Options for property search operations.
|
|
6
5
|
*/
|
|
7
6
|
type PropertyOptions = {
|
|
8
|
-
/** Whether to recursively search through nested properties. */
|
|
7
|
+
/** Whether to recursively search through nested properties. */
|
|
8
|
+
includeNestedProperties?: boolean;
|
|
9
|
+
/** Whether to limit property values to leaf values. */
|
|
9
10
|
limitToLeafPropertyValues?: boolean;
|
|
10
11
|
};
|
|
11
12
|
type PropertyContent<T extends LanguageCodes> = PropertyValueContent<T>["content"];
|
package/dist/helpers.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ContainedItemCategory, Item, ItemCategory, ItemPayloadKind, LanguageCodes, SetItemProperty } from "./types/index.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/helpers.d.ts
|
|
4
3
|
type FlattenedItem<U, T extends LanguageCodes> = Omit<U, "properties"> & {
|
|
5
4
|
properties: Array<SetItemProperty<T>>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MultilingualString } from "./multilingual.mjs";
|
|
2
2
|
import { License } from "../types/index.mjs";
|
|
3
3
|
import { XMLContent, XMLString } from "../xml/types.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/parsers/helpers.d.ts
|
|
6
5
|
type FetchFunction = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
7
6
|
type FetchBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
package/dist/parsers/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { Webpage } from "../types/website.mjs";
|
|
|
2
2
|
import { Bibliography, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Gallery, Identification, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemContainerCategory, ItemLinks, Metadata, Note, Person, Property, Resource, SetItem, SetItemCategory, SimplifiedProperty } from "../types/index.mjs";
|
|
3
3
|
import { XMLBibliography, XMLData, XMLDataItem, XMLGalleryData, XMLIdentification, XMLItemLinks, XMLLink, XMLMetadata, XMLNote, XMLPerson, XMLProperty, XMLResource, XMLSetItems, XMLSimplifiedProperty } from "../xml/types.mjs";
|
|
4
4
|
import { ParserOptions, getParserOptions, parseStringLike } from "./helpers.mjs";
|
|
5
|
-
|
|
6
5
|
//#region src/parsers/index.d.ts
|
|
7
6
|
type RawOchre = XMLData["result"]["ochre"];
|
|
8
7
|
type ResourceViewParser<T extends ReadonlyArray<string>> = (view: XMLResource["view"], context: Pick<Resource<T, "topLevel">, "belongsTo" | "metadata">) => Webpage<T> | null;
|
package/dist/parsers/index.mjs
CHANGED
|
@@ -478,7 +478,7 @@ function parsePropertyValueContent(value, options) {
|
|
|
478
478
|
uuid: value.uuid == null || value.uuid === "" ? null : value.uuid,
|
|
479
479
|
publicationDateTime: value.publicationDateTime ?? null,
|
|
480
480
|
unit: value.unit ?? null,
|
|
481
|
-
href:
|
|
481
|
+
href: value.href ?? null,
|
|
482
482
|
height: value.height ?? null,
|
|
483
483
|
width: value.width ?? null,
|
|
484
484
|
fileSize: value.fileSize ?? null,
|
|
@@ -26,8 +26,11 @@ type MultilingualStringEntries<T extends ReadonlyArray<string> = ReadonlyArray<s
|
|
|
26
26
|
* Options for creating and working with multilingual strings
|
|
27
27
|
*/
|
|
28
28
|
type MultilingualOptions = {
|
|
29
|
-
/** Default language to use for fallbacks */
|
|
30
|
-
|
|
29
|
+
/** Default language to use for fallbacks */
|
|
30
|
+
defaultLanguage?: string;
|
|
31
|
+
/** Available languages for this string */
|
|
32
|
+
availableLanguages?: ReadonlyArray<string>;
|
|
33
|
+
/** Alias values carried by OCHRE as zxx content */
|
|
31
34
|
aliases?: ReadonlyArray<string>;
|
|
32
35
|
};
|
|
33
36
|
type MultilingualContent<T extends ReadonlyArray<string>> = Partial<Record<T[number], ReadonlyArray<MultilingualStringEntry>>>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MultilingualString, MultilingualStringText } from "./multilingual.mjs";
|
|
2
2
|
import { XMLContent, XMLString } from "../xml/types.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/parsers/string.d.ts
|
|
5
4
|
declare function transformPermanentIdentificationUrl(url: string): string;
|
|
6
5
|
declare function parseXMLString(string: XMLString): MultilingualStringText;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Webpage, Website } from "../../types/website.mjs";
|
|
2
2
|
import { XMLWebsiteData, XMLWebsiteResource } from "../../xml/types.mjs";
|
|
3
3
|
import { ParserOptions } from "../helpers.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/parsers/website/index.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Parses raw bounds data into a standardized bounds structure
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MultilingualString } from "../multilingual.mjs";
|
|
2
2
|
import { LanguageCodes, PropertyValueContent, SimplifiedProperty } from "../../types/index.mjs";
|
|
3
3
|
import { ParserOptions } from "../helpers.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/parsers/website/reader.d.ts
|
|
6
5
|
type WebsitePropertyContent<T extends LanguageCodes> = PropertyValueContent<T>["content"];
|
|
7
6
|
declare class WebsitePresentationReader<T extends LanguageCodes> {
|
package/dist/query.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Query } from "./types/index.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/query.d.ts
|
|
4
3
|
declare function buildAndCtsQueryExpression(queryExpressions: Array<string>): string | null;
|
|
5
4
|
declare function buildBelongsToCollectionQueryExpression(belongsToCollectionScopeUuids: Array<string>, belongsToCollectionPropertyVariableUuid: string): string | null;
|
package/dist/schemas.d.mts
CHANGED
package/dist/types/index.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { MultilingualString } from "../parsers/multilingual.mjs";
|
|
2
2
|
import { Webpage } from "./website.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/types/index.d.ts
|
|
5
|
-
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
4
|
+
type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
6
5
|
/**
|
|
7
6
|
* Language-code tuple or array used by OCHRE multilingual fields.
|
|
8
7
|
*
|
|
@@ -511,7 +510,7 @@ type Set<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes =
|
|
|
511
510
|
properties: Array<Property<T>>;
|
|
512
511
|
items: Array<SetItem<U, T>>;
|
|
513
512
|
}>;
|
|
514
|
-
type SetBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded"> extends infer U ? U extends {
|
|
513
|
+
type SetBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded"> extends (infer U) ? U extends {
|
|
515
514
|
properties: Array<Property<T>>;
|
|
516
515
|
} ? Prettify<Omit<U, "properties" | "items"> & {
|
|
517
516
|
properties: Array<SetItemProperty<T>>;
|
package/dist/types/website.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MultilingualString } from "../parsers/multilingual.mjs";
|
|
2
2
|
import { Bibliography, Identification, ItemCategory, LanguageCodes, License, Metadata, Person, Prettify, QueryablePropertyValueDataType } from "./index.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/types/website.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Represents a context tree level item with a variable and value
|
|
@@ -126,7 +125,7 @@ type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
|
126
125
|
type: WebsiteType;
|
|
127
126
|
status: "development" | "preview" | "production";
|
|
128
127
|
versionLabel: "experimental" | "alpha" | "beta" | "test" | "staging" | "pre-release" | "release";
|
|
129
|
-
privacy: "public" | "password" | "
|
|
128
|
+
privacy: "public" | "password" | "password-ochre";
|
|
130
129
|
contact: {
|
|
131
130
|
name: string;
|
|
132
131
|
email: string | null;
|
package/dist/utilities.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LanguageCodes, Property, SetItemProperty } from "./types/index.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
|
|
4
3
|
//#region src/utilities.d.ts
|
|
5
4
|
type SchemaValidationIssue = v.BaseIssue<unknown>;
|
|
6
5
|
declare function getErrorOutput(error: unknown, fallbackMessage: string): {
|
package/dist/xml/schemas.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { XMLData as XMLData$1, XMLDataItem as XMLDataItem$1, XMLGalleryData as XMLGalleryData$1, XMLItemLinksData as XMLItemLinksData$1, XMLLink as XMLLink$1, XMLSetItemsData as XMLSetItemsData$1, XMLWebsiteData as XMLWebsiteData$1 } from "./types.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
|
|
4
3
|
//#region src/xml/schemas.d.ts
|
|
5
4
|
declare const XMLLink: v.GenericSchema<unknown, XMLLink$1>;
|
|
6
5
|
declare const XMLDataItem: v.GenericSchema<unknown, XMLDataItem$1>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ochre-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.60",
|
|
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",
|
|
@@ -46,20 +46,20 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"date-fns": "^4.4.0",
|
|
49
|
-
"fast-equals": "^6.0.
|
|
50
|
-
"fast-xml-parser": "^5.
|
|
51
|
-
"valibot": "^1.4.
|
|
49
|
+
"fast-equals": "^6.0.2",
|
|
50
|
+
"fast-xml-parser": "^5.10.0",
|
|
51
|
+
"valibot": "^1.4.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@antfu/eslint-config": "^9.1.0",
|
|
55
|
-
"@types/node": "^24.13.
|
|
55
|
+
"@types/node": "^24.13.3",
|
|
56
56
|
"bumpp": "^11.1.0",
|
|
57
|
-
"eslint": "^10.
|
|
58
|
-
"knip": "^6.
|
|
59
|
-
"oxfmt": "^0.
|
|
60
|
-
"tsdown": "^0.22.
|
|
57
|
+
"eslint": "^10.7.0",
|
|
58
|
+
"knip": "^6.26.0",
|
|
59
|
+
"oxfmt": "^0.58.0",
|
|
60
|
+
"tsdown": "^0.22.5",
|
|
61
61
|
"typescript": "^6.0.3",
|
|
62
|
-
"vitest": "^4.1.
|
|
62
|
+
"vitest": "^4.1.10"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"dev": "tsdown src/index.ts --watch",
|