MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / loadOrama

Function loadOrama

apps/site/components/withSearch.tsx:38–51  ·  view source on GitHub ↗
(db: AnyOrama)

Source from the content-addressed store, hash-verified

36};
37
38const loadOrama = async (db: AnyOrama): Promise<void> => {
39 const indexes = await Promise.all(
40 Object.entries(ORAMA_DB_URLS).map(async ([key, url]) => {
41 const response = await fetch(url);
42 const fetchedDb = (await response.json()) as SerializedOramaDb;
43
44 return addPrefixToDocs(fetchedDb, key);
45 })
46 );
47
48 for (const index of indexes) {
49 await insertMultiple(db, Object.values(index.docs.docs) as Array<never>);
50 }
51};
52
53export const useOrama = () => {
54 const loadPromiseRef = useRef<Promise<void> | null>(null);

Callers 1

useOramaFunction · 0.85

Calls 2

fetchFunction · 0.85
addPrefixToDocsFunction · 0.85

Tested by

no test coverage detected