ochre-sdk 0.22.5 → 0.22.6
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 +5 -1
- package/dist/index.mjs +62 -17
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -776,7 +776,11 @@ type LevelContext = {
|
|
|
776
776
|
type PropertyContexts = {
|
|
777
777
|
flatten: Array<LevelContext>;
|
|
778
778
|
suppress: Array<LevelContext>;
|
|
779
|
-
filter: Array<LevelContext
|
|
779
|
+
filter: Array<LevelContext & {
|
|
780
|
+
isInlineDisplayed: boolean;
|
|
781
|
+
isSidebarDisplayed: boolean;
|
|
782
|
+
isSidebarOpen: boolean;
|
|
783
|
+
}>;
|
|
780
784
|
sort: Array<LevelContext>;
|
|
781
785
|
detail: Array<LevelContext>;
|
|
782
786
|
download: Array<LevelContext>;
|
package/dist/index.mjs
CHANGED
|
@@ -1018,7 +1018,7 @@ function parseMetadata(metadata) {
|
|
|
1018
1018
|
* @param contextItem - Raw context item data from OCHRE format
|
|
1019
1019
|
* @returns Parsed ContextItem object
|
|
1020
1020
|
*/
|
|
1021
|
-
function parseContextItem(contextItem) {
|
|
1021
|
+
function parseContextItem$1(contextItem) {
|
|
1022
1022
|
return {
|
|
1023
1023
|
uuid: contextItem.uuid,
|
|
1024
1024
|
publicationDateTime: parseOptionalDate(contextItem.publicationDateTime),
|
|
@@ -1035,9 +1035,9 @@ function parseContextItem(contextItem) {
|
|
|
1035
1035
|
function parseContext(context) {
|
|
1036
1036
|
return {
|
|
1037
1037
|
nodes: ensureArray(context.context).map((ctx) => ({
|
|
1038
|
-
tree: parseContextItem(ctx.tree),
|
|
1039
|
-
project: parseContextItem(ctx.project),
|
|
1040
|
-
spatialUnit: "spatialUnit" in ctx && ctx.spatialUnit ? ensureArray(ctx.spatialUnit).map((element) => parseContextItem(element)) : []
|
|
1038
|
+
tree: parseContextItem$1(ctx.tree),
|
|
1039
|
+
project: parseContextItem$1(ctx.project),
|
|
1040
|
+
spatialUnit: "spatialUnit" in ctx && ctx.spatialUnit ? ensureArray(ctx.spatialUnit).map((element) => parseContextItem$1(element)) : []
|
|
1041
1041
|
})),
|
|
1042
1042
|
displayPath: context.displayPath
|
|
1043
1043
|
};
|
|
@@ -3713,10 +3713,13 @@ function parseAllOptionContexts(options) {
|
|
|
3713
3713
|
function handleContexts(v) {
|
|
3714
3714
|
return parseContexts(v != null ? ensureArray(v) : []);
|
|
3715
3715
|
}
|
|
3716
|
+
function handleFilterContexts(v) {
|
|
3717
|
+
return parseFilterContexts(v != null ? ensureArray(v) : []);
|
|
3718
|
+
}
|
|
3716
3719
|
return {
|
|
3717
3720
|
flatten: handleContexts(options.flattenContexts),
|
|
3718
3721
|
suppress: handleContexts(options.suppressContexts),
|
|
3719
|
-
filter:
|
|
3722
|
+
filter: handleFilterContexts(options.filterContexts),
|
|
3720
3723
|
sort: handleContexts(options.sortContexts),
|
|
3721
3724
|
detail: handleContexts(options.detailContexts),
|
|
3722
3725
|
download: handleContexts(options.downloadContexts),
|
|
@@ -4919,12 +4922,11 @@ function parseWebsiteProperties(properties, websiteTree, sidebar) {
|
|
|
4919
4922
|
if ("styleOptions" in websiteTree && websiteTree.styleOptions != null) returnProperties.options.stylesheets.properties = parseStylesheets(ensureArray(websiteTree.styleOptions.style));
|
|
4920
4923
|
return returnProperties;
|
|
4921
4924
|
}
|
|
4922
|
-
function
|
|
4923
|
-
const
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
const levels = levelsToParse.map((level) => {
|
|
4925
|
+
function parseContextItem(contextItemToParse) {
|
|
4926
|
+
const levelsToParse = ensureArray(contextItemToParse.levels.level);
|
|
4927
|
+
let type = "";
|
|
4928
|
+
return {
|
|
4929
|
+
context: levelsToParse.map((level) => {
|
|
4928
4930
|
let variableUuid = "";
|
|
4929
4931
|
let valueUuid = null;
|
|
4930
4932
|
if (typeof level === "string") {
|
|
@@ -4941,13 +4943,56 @@ function parseContexts(contexts) {
|
|
|
4941
4943
|
variableUuid,
|
|
4942
4944
|
valueUuid
|
|
4943
4945
|
};
|
|
4944
|
-
})
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4946
|
+
}),
|
|
4947
|
+
type,
|
|
4948
|
+
identification: parseIdentification(contextItemToParse.identification)
|
|
4949
|
+
};
|
|
4950
|
+
}
|
|
4951
|
+
function parseFilterContextDisplay(filterOption) {
|
|
4952
|
+
switch (filterOption) {
|
|
4953
|
+
case "inline-displayed": return {
|
|
4954
|
+
isInlineDisplayed: true,
|
|
4955
|
+
isSidebarDisplayed: false,
|
|
4956
|
+
isSidebarOpen: false
|
|
4957
|
+
};
|
|
4958
|
+
case "inline-sidebar-displayed-closed": return {
|
|
4959
|
+
isInlineDisplayed: true,
|
|
4960
|
+
isSidebarDisplayed: true,
|
|
4961
|
+
isSidebarOpen: false
|
|
4962
|
+
};
|
|
4963
|
+
case "inline-sidebar-displayed-open": return {
|
|
4964
|
+
isInlineDisplayed: true,
|
|
4965
|
+
isSidebarDisplayed: true,
|
|
4966
|
+
isSidebarOpen: true
|
|
4967
|
+
};
|
|
4968
|
+
case "sidebar-displayed-closed": return {
|
|
4969
|
+
isInlineDisplayed: false,
|
|
4970
|
+
isSidebarDisplayed: true,
|
|
4971
|
+
isSidebarOpen: false
|
|
4972
|
+
};
|
|
4973
|
+
case "sidebar-displayed-open": return {
|
|
4974
|
+
isInlineDisplayed: false,
|
|
4975
|
+
isSidebarDisplayed: true,
|
|
4976
|
+
isSidebarOpen: true
|
|
4977
|
+
};
|
|
4978
|
+
default: return {
|
|
4979
|
+
isInlineDisplayed: false,
|
|
4980
|
+
isSidebarDisplayed: false,
|
|
4981
|
+
isSidebarOpen: false
|
|
4982
|
+
};
|
|
4950
4983
|
}
|
|
4984
|
+
}
|
|
4985
|
+
function parseContexts(contexts) {
|
|
4986
|
+
const contextsParsed = [];
|
|
4987
|
+
for (const mainContext of contexts) for (const contextItemToParse of ensureArray(mainContext.context)) contextsParsed.push(parseContextItem(contextItemToParse));
|
|
4988
|
+
return contextsParsed;
|
|
4989
|
+
}
|
|
4990
|
+
function parseFilterContexts(contexts) {
|
|
4991
|
+
const contextsParsed = [];
|
|
4992
|
+
for (const mainContext of contexts) for (const contextItemToParse of ensureArray(mainContext.context)) contextsParsed.push({
|
|
4993
|
+
...parseContextItem(contextItemToParse),
|
|
4994
|
+
...parseFilterContextDisplay(contextItemToParse.filterOption)
|
|
4995
|
+
});
|
|
4951
4996
|
return contextsParsed;
|
|
4952
4997
|
}
|
|
4953
4998
|
function parseWebsite(websiteTree, metadata, belongsTo, { version = 2 } = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ochre-sdk",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.6",
|
|
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,11 +49,11 @@
|
|
|
49
49
|
"zod": "^4.3.6"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@antfu/eslint-config": "^8.1.
|
|
52
|
+
"@antfu/eslint-config": "^8.1.1",
|
|
53
53
|
"@types/node": "^24.12.2",
|
|
54
54
|
"bumpp": "^11.0.1",
|
|
55
55
|
"eslint": "^10.2.0",
|
|
56
|
-
"prettier": "^3.8.
|
|
56
|
+
"prettier": "^3.8.2",
|
|
57
57
|
"tsdown": "^0.21.7",
|
|
58
58
|
"typescript": "^6.0.2",
|
|
59
59
|
"vitest": "^4.1.4"
|