MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / getMetadata

Function getMetadata

src/Data/UserData.js:185–199  ·  view source on GitHub ↗
(displayName = null, isRefresh = false, {priority = FOREGROUND_PRIORITY} = {})

Source from the content-addressed store, hash-verified

183 const metadata = await getMetadataBatch([displayName], isRefresh, {priority});
184 return metadata[displayName] ?? metadataWithLatestYear({});
185}
186
187export async function getMetadataBatch(displayNames, isRefresh = false, {priority = FOREGROUND_PRIORITY} = {}) {
188 const uniqueDisplayNames = [...new Set(displayNames)].filter(Boolean);
189 const requestEpoch = getCacheEpoch();
190 const entries = await Promise.all(uniqueDisplayNames.map((displayName) => (
191 readCacheEntry(metadataCacheKey(displayName), {legacyFields: ["result"], requestEpoch})
192 )));
193 if (requestEpoch !== getCacheEpoch()) {
194 return {};
195 }
196
197 const cachedMetadata = Object.fromEntries(uniqueDisplayNames.flatMap((displayName, index) => (
198 entries[index] ? [[displayName, metadataWithLatestYear(entries[index].value)]] : []
199 )));
200 const expiredDisplayNames = uniqueDisplayNames.filter((displayName, index) => (
201 isCacheEntryExpired(entries[index], isRefresh)
202 ));

Callers 15

loaderFunction · 0.90
loaderFunction · 0.90
loaderFunction · 0.90
loaderFunction · 0.90
loaderFunction · 0.90
loaderFunction · 0.90
actionFunction · 0.90
loadApplicantProfileFunction · 0.90
refreshApplicantProfileFunction · 0.90
loaderFunction · 0.90

Calls 3

getDisplayNameFunction · 0.85
getMetadataBatchFunction · 0.85
metadataWithLatestYearFunction · 0.85

Tested by

no test coverage detected