@digitalculture/ochre-sdk 0.14.8 → 0.14.10
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/index.d.mts +19 -7
- package/dist/index.mjs +17 -9
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -132,6 +132,10 @@ type Image = {
|
|
|
132
132
|
width: number | null;
|
|
133
133
|
height: number | null;
|
|
134
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Represents a file format
|
|
137
|
+
*/
|
|
138
|
+
type FileFormat = "image/jpeg" | "image/gif" | "image/tiff" | "image/bmp" | "image/png" | "image/svg+xml" | "image/jpeg-imageMap" | "image/gif-imageMap" | "image/tiff-imageMap" | "image/bmp-imageMap" | "image/png-imageMap" | "image/svg+xml-imageMap" | "video/mpeg" | "video/mp4" | "video/quicktime" | "video/x-msvideo" | "video/x-ms-wmv" | "video/x-ms-asf" | "drawing/dwg" | "audio/aiff" | "audio/basic" | "audio/midi" | "audio/mp4" | "audio/mpeg" | "audio/x-ms-wax" | "audio/x-ms-wma" | "audio/wav" | "text/pdf" | "text/doc" | "text/ppt" | "text/html" | "text/plain" | "application/xls" | "application/xlsx" | "application/ai" | "application/octet-stream" | "application/iiif" | "image/fits" | "image/ptm" | "model/obj";
|
|
135
139
|
/**
|
|
136
140
|
* Represents a link to another item with optional image and bibliographic references
|
|
137
141
|
*/
|
|
@@ -144,7 +148,7 @@ type Link = {
|
|
|
144
148
|
description: string | null;
|
|
145
149
|
content: string | null;
|
|
146
150
|
href: string | null;
|
|
147
|
-
fileFormat:
|
|
151
|
+
fileFormat: FileFormat | null;
|
|
148
152
|
fileSize: number | null;
|
|
149
153
|
image: {
|
|
150
154
|
isInline: boolean;
|
|
@@ -247,17 +251,25 @@ type Observation = {
|
|
|
247
251
|
* Represents an event with date, label and optional agent
|
|
248
252
|
*/
|
|
249
253
|
type Event = {
|
|
250
|
-
|
|
254
|
+
dateTime: Date | null;
|
|
255
|
+
date: string | null;
|
|
251
256
|
label: string;
|
|
252
257
|
agent: {
|
|
253
258
|
uuid: string;
|
|
259
|
+
publicationDateTime: Date | null;
|
|
254
260
|
content: string;
|
|
255
261
|
} | null;
|
|
256
262
|
location: {
|
|
257
263
|
uuid: string;
|
|
264
|
+
publicationDateTime: Date | null;
|
|
258
265
|
content: string;
|
|
259
266
|
} | null;
|
|
260
267
|
comment: string | null;
|
|
268
|
+
other: {
|
|
269
|
+
uuid: string | null;
|
|
270
|
+
category: string | null;
|
|
271
|
+
content: string;
|
|
272
|
+
} | null;
|
|
261
273
|
value: string | null;
|
|
262
274
|
};
|
|
263
275
|
/**
|
|
@@ -293,7 +305,7 @@ type Resource = {
|
|
|
293
305
|
coordinates: Array<Coordinate>;
|
|
294
306
|
document: string | null;
|
|
295
307
|
href: string | null;
|
|
296
|
-
fileFormat:
|
|
308
|
+
fileFormat: FileFormat | null;
|
|
297
309
|
fileSize: number | null;
|
|
298
310
|
imageMap: ImageMap | null;
|
|
299
311
|
periods: Array<Period>;
|
|
@@ -710,7 +722,7 @@ type WebElementComponent = {
|
|
|
710
722
|
} | {
|
|
711
723
|
component: "annotated-image";
|
|
712
724
|
imageUuid: string;
|
|
713
|
-
|
|
725
|
+
isFilterInputDisplayed: boolean;
|
|
714
726
|
isOptionsDisplayed: boolean;
|
|
715
727
|
isAnnotationHighlightsDisplayed: boolean;
|
|
716
728
|
isAnnotationTooltipsDisplayed: boolean;
|
|
@@ -730,7 +742,7 @@ type WebElementComponent = {
|
|
|
730
742
|
component: "entries";
|
|
731
743
|
entriesId: string;
|
|
732
744
|
variant: "entry" | "item";
|
|
733
|
-
|
|
745
|
+
isFilterInputDisplayed: boolean;
|
|
734
746
|
} | {
|
|
735
747
|
component: "button";
|
|
736
748
|
variant: "default" | "transparent" | "link";
|
|
@@ -811,7 +823,7 @@ type WebElementComponent = {
|
|
|
811
823
|
} | {
|
|
812
824
|
component: "image-gallery";
|
|
813
825
|
galleryId: string;
|
|
814
|
-
|
|
826
|
+
isFilterInputDisplayed: boolean;
|
|
815
827
|
} | {
|
|
816
828
|
component: "map";
|
|
817
829
|
mapId: string;
|
|
@@ -1286,4 +1298,4 @@ declare function filterProperties(property: Property, filter: {
|
|
|
1286
1298
|
value: string | number | boolean | Date;
|
|
1287
1299
|
}, options?: PropertyOptions): boolean;
|
|
1288
1300
|
//#endregion
|
|
1289
|
-
export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinate, Data, DataCategory, Event, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyContexts, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Section, Set, SpatialUnit, Style, Text, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, Website, fetchByUuidMetadata, fetchGallery, fetchItem, fetchPropertyQuery, fetchWebsite, filterProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
|
|
1301
|
+
export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinate, Data, DataCategory, Event, FileFormat, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyContexts, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Section, Set, SpatialUnit, Style, Text, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, Website, fetchByUuidMetadata, fetchGallery, fetchItem, fetchPropertyQuery, fetchWebsite, filterProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
|
package/dist/index.mjs
CHANGED
|
@@ -1174,17 +1174,25 @@ function parseObservations(observations) {
|
|
|
1174
1174
|
function parseEvents(events) {
|
|
1175
1175
|
const returnEvents = [];
|
|
1176
1176
|
for (const event of events) returnEvents.push({
|
|
1177
|
-
|
|
1177
|
+
dateTime: event.dateTime != null ? new Date(event.dateTime) : null,
|
|
1178
|
+
date: event.partialDates?.year != null ? `${event.partialDates.year}-01-01/${event.partialDates.endYear ?? event.partialDates.year}-12-31` : null,
|
|
1178
1179
|
label: parseStringContent(event.label),
|
|
1179
1180
|
location: event.location ? {
|
|
1180
1181
|
uuid: event.location.uuid,
|
|
1182
|
+
publicationDateTime: event.location.publicationDateTime != null ? new Date(event.location.publicationDateTime) : null,
|
|
1181
1183
|
content: parseStringContent(event.location)
|
|
1182
1184
|
} : null,
|
|
1183
1185
|
agent: event.agent ? {
|
|
1184
1186
|
uuid: event.agent.uuid,
|
|
1187
|
+
publicationDateTime: event.agent.publicationDateTime != null ? new Date(event.agent.publicationDateTime) : null,
|
|
1185
1188
|
content: parseStringContent(event.agent)
|
|
1186
1189
|
} : null,
|
|
1187
1190
|
comment: event.comment ? parseStringContent(event.comment) : null,
|
|
1191
|
+
other: event.other != null ? {
|
|
1192
|
+
uuid: event.other.uuid ?? null,
|
|
1193
|
+
category: event.other.category ?? null,
|
|
1194
|
+
content: parseStringContent(event.other)
|
|
1195
|
+
} : null,
|
|
1188
1196
|
value: event.value ? parseFakeString(event.value) : null
|
|
1189
1197
|
});
|
|
1190
1198
|
return returnEvents;
|
|
@@ -1899,12 +1907,12 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1899
1907
|
case "annotated-image": {
|
|
1900
1908
|
const imageLinks = links.filter((link) => link.type === "image" || link.type === "IIIF");
|
|
1901
1909
|
if (imageLinks.length === 0) throw new Error(`Image link not found for the following component: “${componentName}”`);
|
|
1902
|
-
const
|
|
1910
|
+
const isFilterInputDisplayed = getPropertyValueByLabel(componentProperty.properties, "filter-input-displayed") === true;
|
|
1903
1911
|
const isOptionsDisplayed = getPropertyValueByLabel(componentProperty.properties, "options-displayed") !== false;
|
|
1904
1912
|
const isAnnotationHighlightsDisplayed = getPropertyValueByLabel(componentProperty.properties, "annotation-highlights-displayed") !== false;
|
|
1905
1913
|
const isAnnotationTooltipsDisplayed = getPropertyValueByLabel(componentProperty.properties, "annotation-tooltips-displayed") !== false;
|
|
1906
1914
|
properties.imageUuid = imageLinks[0].uuid;
|
|
1907
|
-
properties.
|
|
1915
|
+
properties.isFilterInputDisplayed = isFilterInputDisplayed;
|
|
1908
1916
|
properties.isOptionsDisplayed = isOptionsDisplayed;
|
|
1909
1917
|
properties.isAnnotationHighlightsDisplayed = isAnnotationHighlightsDisplayed;
|
|
1910
1918
|
properties.isAnnotationTooltipsDisplayed = isAnnotationTooltipsDisplayed;
|
|
@@ -2089,12 +2097,12 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
2089
2097
|
if (!entriesLink) throw new Error(`Entries link not found for the following component: “${componentName}”`);
|
|
2090
2098
|
let variant = getPropertyValueByLabel(componentProperty.properties, "variant");
|
|
2091
2099
|
variant ??= "entry";
|
|
2092
|
-
let
|
|
2093
|
-
const
|
|
2094
|
-
if (
|
|
2100
|
+
let isFilterInputDisplayed = false;
|
|
2101
|
+
const isFilterInputDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-input-displayed");
|
|
2102
|
+
if (isFilterInputDisplayedProperty !== null) isFilterInputDisplayed = isFilterInputDisplayedProperty === true;
|
|
2095
2103
|
properties.entriesId = entriesLink.uuid;
|
|
2096
2104
|
properties.variant = variant;
|
|
2097
|
-
properties.
|
|
2105
|
+
properties.isFilterInputDisplayed = isFilterInputDisplayed;
|
|
2098
2106
|
break;
|
|
2099
2107
|
}
|
|
2100
2108
|
case "iframe": {
|
|
@@ -2204,9 +2212,9 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
2204
2212
|
case "image-gallery": {
|
|
2205
2213
|
const galleryLink = links.find((link) => link.category === "tree" || link.category === "set");
|
|
2206
2214
|
if (!galleryLink) throw new Error(`Image gallery link not found for the following component: “${componentName}”`);
|
|
2207
|
-
const
|
|
2215
|
+
const isFilterInputDisplayed = getPropertyValueByLabel(componentProperty.properties, "filter-input-displayed") === true;
|
|
2208
2216
|
properties.galleryId = galleryLink.uuid;
|
|
2209
|
-
properties.
|
|
2217
|
+
properties.isFilterInputDisplayed = isFilterInputDisplayed;
|
|
2210
2218
|
break;
|
|
2211
2219
|
}
|
|
2212
2220
|
case "map": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalculture/ochre-sdk",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.10",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"eslint": "^9.39.2",
|
|
50
50
|
"prettier": "^3.7.4",
|
|
51
51
|
"terser": "^5.44.1",
|
|
52
|
-
"tsdown": "^0.18.
|
|
52
|
+
"tsdown": "^0.18.3",
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
54
|
"vitest": "^4.0.16"
|
|
55
55
|
},
|