@rcsb/rcsb-documentation 0.1.31 → 0.1.32
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/package.json +1 -1
- package/server/docsApi.js +12 -1
package/package.json
CHANGED
package/server/docsApi.js
CHANGED
|
@@ -4,7 +4,7 @@ if (typeof fetch === 'undefined') {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
// Use native fetch in the browser environment
|
|
7
|
-
const CONTENT_URL =
|
|
7
|
+
const CONTENT_URL = process.env.RCSB_DOCS_CONTENT_URL;
|
|
8
8
|
const GROUP = 'group';
|
|
9
9
|
const ITEM = 'item';
|
|
10
10
|
const ROOT_ID = 'rcsb-documentation';
|
|
@@ -20,6 +20,15 @@ let index = [],
|
|
|
20
20
|
hrefMap = {},
|
|
21
21
|
itemMap = {};
|
|
22
22
|
|
|
23
|
+
function setContentUrl(url) {
|
|
24
|
+
if (!url) return;
|
|
25
|
+
CONTENT_URL = url.replace(/\/$/, ''); // remove trailing slash
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getContentUrl() {
|
|
29
|
+
return CONTENT_URL;
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
// Fetch the latest 'lastUpdated' value for the top-level id
|
|
24
33
|
async function fetchLastUpdated(env) {
|
|
25
34
|
const url = `${CONTENT_URL}/${env}/by-top-id/${ROOT_ID}/last-updated`;
|
|
@@ -377,6 +386,8 @@ function setParentGroupState(groupMap, o) {
|
|
|
377
386
|
|
|
378
387
|
// Export all functions using CommonJS
|
|
379
388
|
module.exports = {
|
|
389
|
+
setContentUrl,
|
|
390
|
+
getContentUrl,
|
|
380
391
|
fetchLastUpdated,
|
|
381
392
|
fetchIndex,
|
|
382
393
|
fetchItem,
|