MCPcopy Create free account
hub / github.com/Devographics/Monorepo / initDbCache

Function initDbCache

api/src/init.ts:51–78  ·  view source on GitHub ↗
({
    context,
    data,
    initList = defaultInitList
}: InitDbCacheProps)

Source from the content-addressed store, hash-verified

49}
50
51export const initDbCache = async ({
52 context,
53 data,
54 initList = defaultInitList
55}: InitDbCacheProps) => {
56 console.log(`// Initializing db cache… (${initList.join()})`)
57 const { surveys, entities } = data
58 if (initList.includes('entities')) {
59 const { entities } = data
60 for (let e of entities) {
61 e = await applyEntityResolvers(e, context)
62 }
63 await cacheSurveysEntities({
64 surveys,
65 entities,
66 context
67 })
68 }
69 if (initList.includes('surveys')) {
70 await cacheSurveys({
71 surveys,
72 context
73 })
74 }
75 if (initList.includes('projects')) {
76 await initProjects({ context })
77 }
78}
79
80export const reinitialize = async ({ context, initList = defaultInitList }: InitProps) => {
81 const data = await initMemoryCache({ context, initList })

Callers

nothing calls this directly

Calls 4

applyEntityResolversFunction · 0.90
cacheSurveysEntitiesFunction · 0.90
cacheSurveysFunction · 0.90
initProjectsFunction · 0.90

Tested by

no test coverage detected