@digitalculture/ochre-sdk 0.14.4 → 0.14.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.mjs +3 -3
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -3020,8 +3020,8 @@ async function fetchByUuid(uuid, options) {
|
|
|
3020
3020
|
const response = await (customFetch ?? fetch)(isVersion2 ? `https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?uuid=${parsedUuid}&format=json&lang="*"` : `https://ochre.lib.uchicago.edu/ochre?uuid=${parsedUuid}&format=json&lang="*"`);
|
|
3021
3021
|
if (!response.ok) throw new Error("Failed to fetch OCHRE data");
|
|
3022
3022
|
const dataRaw = await response.json();
|
|
3023
|
-
if (!("ochre" in dataRaw)) throw new Error("Invalid OCHRE data: API response missing 'ochre' key");
|
|
3024
|
-
return [null, dataRaw];
|
|
3023
|
+
if (isVersion2 && (!("result" in dataRaw) || !("ochre" in dataRaw.result)) || !isVersion2 && !("ochre" in dataRaw)) throw new Error("Invalid OCHRE data: API response missing 'ochre' key");
|
|
3024
|
+
return [null, "result" in dataRaw && !Array.isArray(dataRaw.result) && "ochre" in dataRaw.result ? dataRaw.result : "ochre" in dataRaw ? dataRaw : null];
|
|
3025
3025
|
} catch (error) {
|
|
3026
3026
|
return [error instanceof Error ? error.message : "Unknown error", null];
|
|
3027
3027
|
}
|
|
@@ -3358,7 +3358,7 @@ async function fetchWebsite(abbreviation, options) {
|
|
|
3358
3358
|
let metadata = null;
|
|
3359
3359
|
let tree = null;
|
|
3360
3360
|
if (isVersion2) {
|
|
3361
|
-
const response = await (customFetch ?? fetch)(`https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?xquery=${encodeURIComponent(`collection('ochre/tree')/ochre[tree/identification/abbreviation/content/string='${cleanAbbreviation}']`)}&format=json&lang="*"`);
|
|
3361
|
+
const response = await (customFetch ?? fetch)(`https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?xquery=${encodeURIComponent(`collection('ochre/tree')/ochre[tree/identification/abbreviation/content/string='${cleanAbbreviation.replace("-v2", "")}']`)}&format=json&lang="*"`);
|
|
3362
3362
|
if (!response.ok) throw new Error("Failed to fetch website");
|
|
3363
3363
|
const data = await response.json();
|
|
3364
3364
|
if (Array.isArray(data.result) || !("tree" in data.result.ochre)) throw new Error("Failed to fetch website");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalculture/ochre-sdk",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.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",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@antfu/eslint-config": "^6.7.1",
|
|
47
|
-
"@types/node": "^24.10.
|
|
47
|
+
"@types/node": "^24.10.4",
|
|
48
48
|
"bumpp": "^10.3.2",
|
|
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.1",
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
54
|
"vitest": "^4.0.16"
|
|
55
55
|
},
|