Skip to content

ContextResolver

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/packages/doc-automation/src/v2/stages/stage-10-generation/context-resolver.ts

ContextResolver - Resolves cross-chunk entity references

When generating documentation for a document, we may need entities that exist in OTHER chunks. This resolver fetches them from the global entity map without loading everything into memory.

Methods

MethodSignatureReturns
setEntityMapsetEntityMap(entityMap: Map<string, Entity>)void
resolveForPlanresolveForPlan(plan: DocumentPlan)Promise<Entity[]>
resolveByNameresolveByName(entityName: string)`Entity
resolveByIdresolveById(entityId: string)`Entity
handleDeepLoadRequesthandleDeepLoadRequest(request: DeepLoadRequest)Promise<DeepLoadResponse>
getByFilePathgetByFilePath(pattern: string)Entity[]
getByTypegetByType(type: Entity['type'])Entity[]
clearCacheclearCache()void
getCacheStatsgetCacheStats(){ size: number; hits: string[] }
hasEntityhasEntity(entityId: string)boolean
getEntityCountgetEntityCount()number

Where it refuses work

  • ContextResolver stops the work with an early return when cached?.found.
  • ContextResolver stops the work with an early return when entity.name === entityName.
  • ContextResolver stops the work with an early return when this.deepLoadedCache.has(cacheKey).

Was this page helpful?

Download as PDF