MCPcopy Index your code
hub / github.com/epicweb-dev/epic-stack / loader

Function loader

app/routes/admin+/cache_.sqlite.$cacheKey.ts:11–31  ·  view source on GitHub ↗
({ request, params }: LoaderFunctionArgs)

Source from the content-addressed store, hash-verified

9import { requireUserWithRole } from '#app/utils/permissions.server.ts'
10
11export async function loader({ request, params }: LoaderFunctionArgs) {
12 await requireUserWithRole(request, 'admin')
13 const searchParams = new URL(request.url).searchParams
14 const currentInstanceInfo = await getInstanceInfo()
15 const allInstances = await getAllInstances()
16 const instance =
17 searchParams.get('instance') ?? currentInstanceInfo.currentInstance
18 await ensureInstance(instance)
19
20 const { cacheKey } = params
21 invariantResponse(cacheKey, 'cacheKey is required')
22 return json({
23 instance: {
24 hostname: instance,
25 region: allInstances[instance],
26 isPrimary: currentInstanceInfo.primaryInstance === instance,
27 },
28 cacheKey,
29 value: cache.get(cacheKey),
30 })
31}

Callers

nothing calls this directly

Calls 1

requireUserWithRoleFunction · 0.90

Tested by

no test coverage detected