MCPcopy Create free account
hub / github.com/fontsource/fontsource / getRegistryView

Function getRegistryView

api/worker/src/features/registry/handler.ts:47–68  ·  view source on GitHub ↗
(
	c: Context<AppEnv>,
	path: string,
	notFoundMessage?: string,
)

Source from the content-addressed store, hash-verified

45};
46
47export const getRegistryView = async (
48 c: Context<AppEnv>,
49 path: string,
50 notFoundMessage?: string,
51): Promise<Response> => {
52 const revision = await getCurrentRevision(c);
53 const object = await c.env.REGISTRY.get(`snapshots/${revision}/api/${path}`, {
54 onlyIf: c.req.raw.headers,
55 });
56 if (!object) {
57 if (notFoundMessage) {
58 throw notFound(notFoundMessage);
59 }
60 throw badGateway('Bad Gateway. Registry snapshot is incomplete.');
61 }
62
63 return respondWithObject(
64 object,
65 'application/json; charset=utf-8',
66 CACHE_POLICIES.metadata,
67 );
68};
69
70export const readRegistryView = async <T>(
71 c: Context<AppEnv>,

Callers 9

handleMethod · 0.90
handleMethod · 0.90
handleMethod · 0.90
handleMethod · 0.90
handleMethod · 0.90
handleMethod · 0.90
handleMethod · 0.90
handleMethod · 0.90
handleMethod · 0.90

Calls 5

notFoundFunction · 0.90
badGatewayFunction · 0.90
getCurrentRevisionFunction · 0.85
respondWithObjectFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected