import { p as StorageAdapter, f as FlowState, A as AcquireLockOptions, h as Lock } from '../types-D8r3B8Ax.js'; /** * Structural subset of ioredis' `Redis` class. Only the methods we use are * required, so both `ioredis` and compatible clients work. */ interface RedisLike { set(key: string, value: string, ...args: (string | number)[]): Promise; get(key: string): Promise; del(...keys: string[]): Promise; eval(script: string, numKeys: number, ...args: (string | number)[]): Promise; } interface RedisStorageOptions { client: RedisLike; /** Prefix applied to all keys written by this adapter. Default: `kompensa`. */ keyPrefix?: string; /** Polling interval while waiting for a contested lock, in ms. Default: 50. */ lockPollMs?: number; } /** * Redis-backed storage with Redlock-style single-node locks. * * State is serialized to JSON. Locks use `SET NX PX` for atomic acquisition * plus a Lua-verified token on release, so a process whose TTL expired cannot * accidentally release the lock held by a newer owner. * * @example * import Redis from 'ioredis'; * import { RedisStorage } from 'kompensa/storage/redis'; * * const storage = new RedisStorage({ client: new Redis(process.env.REDIS_URL) }); * const flow = createFlow('checkout', { storage }).step(...) */ declare class RedisStorage implements StorageAdapter { private readonly client; private readonly keyPrefix; private readonly lockPollMs; constructor(opts: RedisStorageOptions); private stateKey; private lockKey; load(flowName: string, flowId: string): Promise; save(state: FlowState): Promise; delete(flowName: string, flowId: string): Promise; acquireLock(flowName: string, flowId: string, options: AcquireLockOptions): Promise; private makeLock; } declare function createRedisStorage(opts: RedisStorageOptions): RedisStorage; export { type RedisLike, RedisStorage, type RedisStorageOptions, createRedisStorage };