ochre-sdk 0.20.21 → 0.20.22
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 +14 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2533,7 +2533,13 @@ async function fetchSetItems(params, itemCategories, options) {
|
|
|
2533
2533
|
page,
|
|
2534
2534
|
pageSize
|
|
2535
2535
|
}, { version });
|
|
2536
|
-
|
|
2536
|
+
let response;
|
|
2537
|
+
if (version === 2) response = await (options?.fetch ?? fetch)("https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?xquery&format=json", {
|
|
2538
|
+
method: "POST",
|
|
2539
|
+
body: xquery,
|
|
2540
|
+
headers: { "Content-Type": "application/xquery" }
|
|
2541
|
+
});
|
|
2542
|
+
else response = await (options?.fetch ?? fetch)(`https://ochre.lib.uchicago.edu/ochre?xquery=${encodeURIComponent(xquery)}&format=json&lang="*"`);
|
|
2537
2543
|
if (!response.ok) throw new Error(`OCHRE API responded with status: ${response.status}`);
|
|
2538
2544
|
const data = await response.json();
|
|
2539
2545
|
if (Array.isArray(data.result) || Object.keys(data.result).length === 0) throw new Error("No items found");
|
|
@@ -2847,7 +2853,13 @@ async function fetchSetPropertyValuesByPropertyVariables(params, options) {
|
|
|
2847
2853
|
attributes,
|
|
2848
2854
|
isLimitedToLeafPropertyValues
|
|
2849
2855
|
}, { version });
|
|
2850
|
-
|
|
2856
|
+
let response;
|
|
2857
|
+
if (version === 2) response = await (options?.fetch ?? fetch)("https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?xquery&format=json", {
|
|
2858
|
+
method: "POST",
|
|
2859
|
+
body: xquery,
|
|
2860
|
+
headers: { "Content-Type": "application/xquery" }
|
|
2861
|
+
});
|
|
2862
|
+
else response = await (options?.fetch ?? fetch)(`https://ochre.lib.uchicago.edu/ochre?xquery=${encodeURIComponent(xquery)}&format=json&lang="*"`);
|
|
2851
2863
|
if (!response.ok) throw new Error(`OCHRE API responded with status: ${response.status}`);
|
|
2852
2864
|
const data = await response.json();
|
|
2853
2865
|
const parsedResultRaw = responseSchema.parse(data);
|