Packages narrative
packages / tagtree / core

tagtree / core

Functions

NameDescription
runAdapterContractRegisters a Vitest
composeChains multiple
computeFanoutExpands a single entity reference into its full set of invalidation tags, from the most-specific leaf tag down to the namespace root, following the hierarchy declared in the schema.
createCacheInstanceWires a
defineCacheValidates and freezes a cache schema definition, rejecting namespace or entity names that contain
encodeSegmentEncodes a single cache-key segment so it is safe to join with
joinSegmentsCombines an ordered list of raw segments into a dotted-path cache tag, encoding each segment before joining so no raw value can break the path structure.
memoryAdapterCreates a synchronous, in-process

Interfaces

NameDescription
ContractTestOptionsConfiguration passed to
AdapterCtxRuntime context passed to every adapter operation, carrying the schema definition and a logger so adapters can emit structured diagnostics tied to the call site.
CacheAdapterContract that every cache backend must implement to integrate with tagtree's tag-aware invalidation model. Adapters are responsible for storage, tag-index maintenance, and optional features like response decoration or native wrap delegation.
CacheInstanceFully-typed runtime handle returned by
CacheKeyStructured cache-key object produced by a
CacheSchemaOpaque wrapper returned by
CacheSchemaShapeFully-resolved schema descriptor held at runtime; carries namespace, optional tenant and qualifier configs, and the entity declarations that drive key building and fanout expansion.
EntityDeclDeclares a single entity within a cache schema, specifying the optional params it accepts for leaf-level key building and the parent entity names whose cache entries should also be invalidated when this entity is purged.
FanoutInputArguments to
ILoggerMinimal structured-log interface that cache adapters and the instance internals use to report events without pulling in a concrete logging dependency.
MemoryAdapterOptionsConfiguration for the in-process memory adapter; controls the LRU eviction ceiling so memory use stays bounded in long-running processes.
QualifierConfigDeclares how a qualifier value (e.g., a locale or currency code) appends a
TenantConfigDeclares how a tenant value maps to a cache-key prefix; the
WrapOptsPer-call options for
WriteOptsOptions that govern how a cache entry is stored; controls TTL expiry, stale-while-revalidate behavior, and a staleness-guard timestamp that prevents a racing webhook from being overwritten by a fetch that started before the invalidation arrived.

Types

NameDescription
BrandNominal branding wrapper that makes otherwise structurally equivalent types distinguishable at the type level; used to prevent
EntitiesMapConstraint type for the
InvalidateNamespaceTyped invalidation surface generated from a
KeyFactoryPer-entity key builder map derived from a
ParamMapType constraint for the
ParamTypeUnion of the two supported cache-key param kinds (
ParamTypeShapeUnwraps a
ParamValuesConverts a

Variables

NameDescription
consoleLoggerReady-made
numBrand token that marks a
strBrand token that marks a

On this page