MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / fetchItemManifest

Function fetchItemManifest

packages/cli/src/registry/remote.ts:108–122  ·  view source on GitHub ↗
(
  name: string,
  type: ItemType,
  baseUrl: string = DEFAULT_REGISTRY_URL,
)

Source from the content-addressed store, hash-verified

106 * Throws on network failure (callers decide whether to degrade gracefully).
107 */
108export async function fetchItemManifest(
109 name: string,
110 type: ItemType,
111 baseUrl: string = DEFAULT_REGISTRY_URL,
112): Promise<RegistryItem> {
113 const dir = ITEM_TYPE_DIRS[type];
114 const cacheFile = cachePath(baseUrl, `${dir}__${name}`);
115 const cached = readCache<RegistryItem>(cacheFile);
116 if (cached) return cached;
117
118 const url = `${baseUrl}/${dir}/${name}/registry-item.json`;
119 const item = await fetchJson<RegistryItem>(url);
120 writeCache(cacheFile, item);
121 return item;
122}
123
124/**
125 * Download a single file referenced by an item to a local destination.

Callers 2

loadAllItemsFunction · 0.85
getItemFunction · 0.85

Calls 3

cachePathFunction · 0.85
readCacheFunction · 0.85
writeCacheFunction · 0.85

Tested by

no test coverage detected