import { Cache } from '../cache/index.js'; import { Env } from '../boundary/components/env/types.js'; import { Fetcher, LocalResourceHandle, ResourceEvictor, ResourceHandle } from './types.js'; export { Cache } from '../cache/index.js'; /** * Default in-memory `Cache` used when {@link Resource} is constructed * without an explicit one. Each fetcher gets its own slot via the * outer `WeakMap` so unrelated Resources don't share a string-key * namespace. * * @internal */ export declare const defaults: WeakMap; /** * Returns the {@link Cache} bound to `fetcher`, allocating a fresh * in-memory Cache on first access. * * @internal */ export declare function defaultCache(fetcher: object): Cache; /** * Stable string key derived from the call-site `params`. Two calls with * the same logical params (same key order, same primitive values) hit * the same slot. JSON.stringify is sufficient for the March Hare params * convention (primitive-leaf objects); callers who need order-stable * keying should normalise the object before passing it in. * * @internal */ export declare function key(params: object): string; /** * Per-Resource eviction callbacks. Each `Resource` declaration registers * one entry on construction; the public `nuke(...)` (defined in * {@link "./index.ts"}) iterates them to drop cache slots across every * Resource in the process. * * @internal */ export declare const evictors: Array; /** * Mints the next namespace id for an app-shared cache. Each `app.Resource` * declaration consumes one id so the shared {@link Cache} can keep * resource-specific slots from colliding on shared params keys. * * @internal */ export declare function nextResourceId(fetcher: object): string; /** * Allocates the per-Resource closure shared by `app.Resource` and * `shared.Resource`. The returned callable produces an * {@link Invocation} on every call — pass it to * `context.actions.resource(...)` for fetch/evict. `.get(params)` reads * the per-params cache slot synchronously. * * @internal */ export declare function build(ƒ: Fetcher, backing: Cache, namespace: string | null, getEnv: () => Env | undefined): ResourceHandle; /** * Allocates the per-Resource closure for a fetcherless (local) * declaration. The returned callable produces a {@link LocalInvocation} * on every call — pass it to `context.actions.resource(...)` for * `.set(value)`/`.evict(where?)`. The invocation carries no `run`, so * it cannot be awaited and the fetch chain never applies. `.set` walks * the same write path a successful fetch would: cache write first, then * the auto-broadcast with the call params as the channel. * * @internal */ export declare function buildLocal(backing: Cache, namespace: string | null, getEnv: () => Env | undefined): LocalResourceHandle;