/** * Maps tags to the endpoints that carry them. * * Membership is recorded where the tag is declared — on the `queryOptions` * call — so the query itself stays the single place an endpoint's cache * behaviour is described. Nothing has to be mirrored into a second registry. * * Granularity is per `${method} ${path}`, not per key: invalidating a tag * invalidates every cached variant of the endpoints under it, whatever their * params. That is what "refetch the user list" almost always means, and it * keeps the registry bounded by endpoint count rather than by cache size. */ export type TagRegistry = { register: (tag: TTag, method: string, path: string) => void; assertKnown: (tag: TTag) => void; /** * Whether `tag` may be acted on, warning once per unknown tag rather than * throwing. For tags that only materialize *after* a request has already * succeeded — the ones an `invalidates` callback derives from a mutation's * result — where a throw would report the successful mutation as failed. */ acceptOrWarn: (tag: TTag) => boolean; /** Whether a `[method, path, …]` query key belongs to `tag`. */ matches: (tag: TTag, queryKey: readonly unknown[]) => boolean; /** The `${method} ${path}` tokens currently registered under `tag`. */ endpoints: (tag: TTag) => readonly string[]; }; export declare function createTagRegistry(vocabulary?: readonly TTag[]): TagRegistry;