import { R2Bucket, DurableObjectNamespace } from '@cloudflare/workers-types'; /** * `@cimplify/sdk/server/tanstack` - TanStack Start/Nitro cache support. * * The deployment adapter binds: * - CIMPLIFY_CACHE_R2_BUCKET * - CIMPLIFY_CACHE_R2_PREFIX * - CIMPLIFY_PATH_INDEX * * This driver consumes those bindings and mirrors the Next/OpenNext eviction * contract: reserve cimplify:* tags in PathIndex, write to R2, then confirm * that no eviction crossed the write. Tagged values fail closed when indexing * is unavailable or their reservation is invalidated, so the central eviction * worker can always delete exact R2 objects before purging edge HTML. */ declare const TANSTACK_R2_BUCKET_BINDING = "CIMPLIFY_CACHE_R2_BUCKET"; declare const TANSTACK_R2_PREFIX_ENV = "CIMPLIFY_CACHE_R2_PREFIX"; declare const TANSTACK_PATH_INDEX_BINDING = "CIMPLIFY_PATH_INDEX"; declare const TANSTACK_CACHE_NAMESPACE = "nitro"; declare const CIMPLIFY_TAG_PREFIX = "cimplify:"; declare const CIMPLIFY_CACHE_META_FIELD = "__cimplifyCache"; type Awaitable = T | Promise; type R2PutValue = NonNullable[1]>; interface CimplifyTanstackCacheEnv { [TANSTACK_R2_BUCKET_BINDING]?: R2Bucket; [TANSTACK_R2_PREFIX_ENV]?: string; [TANSTACK_PATH_INDEX_BINDING]?: DurableObjectNamespace; } interface CimplifyCacheIndexMetadata { tags?: readonly string[]; cacheKey?: string; isFetch?: boolean; } interface CimplifyTanstackCacheSetOptions { tags?: readonly string[]; cimplifyTags?: readonly string[]; cacheTags?: readonly string[]; cacheKey?: string; cimplifyCacheKey?: string; isFetch?: boolean; cimplifyIsFetch?: boolean; [CIMPLIFY_CACHE_META_FIELD]?: CimplifyCacheIndexMetadata; [key: string]: unknown; } interface CimplifyTanstackCacheDriverOptions { env?: CimplifyTanstackCacheEnv; getEnv?: () => Awaitable; prefix?: string; namespace?: string; tags?: readonly string[] | ((key: string, value: unknown, options?: unknown) => readonly string[]); cacheKey?: string | ((key: string, value: unknown, options?: unknown) => string | undefined); isFetch?: boolean | ((key: string, value: unknown, options?: unknown) => boolean); } interface CimplifyTanstackCacheDriver { name: string; options: CimplifyTanstackCacheDriverOptions; hasItem(key: string): Promise; getItem(key: string): Promise; getItemRaw(key: string): Promise; setItem(key: string, value: unknown, options?: CimplifyTanstackCacheSetOptions): Promise; setItemRaw(key: string, value: R2PutValue, options?: CimplifyTanstackCacheSetOptions): Promise; removeItem(key: string): Promise; getKeys(base?: string): Promise; clear(base?: string): Promise; } declare function cimplifyTanstackR2Key(prefix: string, key: string, namespace?: string): string; declare function cimplifyTanstackCacheOptions(metadata: CimplifyCacheIndexMetadata): CimplifyTanstackCacheSetOptions; declare function withCimplifyCacheMetadata>(value: T, metadata: CimplifyCacheIndexMetadata): T & { [CIMPLIFY_CACHE_META_FIELD]: CimplifyCacheIndexMetadata; }; declare function createCimplifyTanstackCacheDriver(options?: CimplifyTanstackCacheDriverOptions): CimplifyTanstackCacheDriver; declare const cimplifyTanstackCacheDriver: typeof createCimplifyTanstackCacheDriver; export { CIMPLIFY_CACHE_META_FIELD, CIMPLIFY_TAG_PREFIX, type CimplifyCacheIndexMetadata, type CimplifyTanstackCacheDriver, type CimplifyTanstackCacheDriverOptions, type CimplifyTanstackCacheEnv, type CimplifyTanstackCacheSetOptions, TANSTACK_CACHE_NAMESPACE, TANSTACK_PATH_INDEX_BINDING, TANSTACK_R2_BUCKET_BINDING, TANSTACK_R2_PREFIX_ENV, cimplifyTanstackCacheDriver, cimplifyTanstackCacheOptions, cimplifyTanstackR2Key, createCimplifyTanstackCacheDriver, withCimplifyCacheMetadata };