import Valkey from 'iovalkey'; import { type ExecutionScope, type TenantScope } from './keys'; import { type Logger } from './logger'; import type { FlowId, PersistedFlowVariable, StepEnvelope, StepId } from './types'; export type StoreHealth = 'ready' | 'degraded' | 'unavailable'; export interface StoreHealthReport { state: StoreHealth; reason?: string; lastError?: string; since?: string; } export interface ExecutionContextStore { health(): StoreHealthReport; putStep(scope: ExecutionScope, envelope: StepEnvelope): Promise; getStep(scope: ExecutionScope, stepId: StepId): Promise | null>; putFlowVariable(scope: TenantScope, flowId: FlowId, variable: PersistedFlowVariable): Promise; getFlowVariables(scope: TenantScope, flowId: FlowId): Promise>; acquireExecutionLease(scope: ExecutionScope, leaseHolder: string, ttlSeconds: number): Promise; releaseExecutionLease(scope: ExecutionScope, leaseHolder: string): Promise; close(): Promise; } export interface ValkeyStoreOptions { client: Valkey; envelopeMaxBytes?: number; logger?: Logger; } export declare class EnvelopeTooLargeError extends Error { readonly bytes: number; readonly limit: number; constructor(bytes: number, limit: number); } export declare class StoreUnavailableError extends Error { constructor(message: string); } export declare class ValkeyExecutionContextStore implements ExecutionContextStore { private readonly client; private readonly envelopeMaxBytes; private readonly logger; private healthState; private lastError?; private degradedSince?; constructor(options: ValkeyStoreOptions); health(): StoreHealthReport; putStep(scope: ExecutionScope, envelope: StepEnvelope): Promise; getStep(scope: ExecutionScope, stepId: StepId): Promise | null>; putFlowVariable(scope: TenantScope, flowId: FlowId, variable: PersistedFlowVariable): Promise; getFlowVariables(scope: TenantScope, flowId: FlowId): Promise>; acquireExecutionLease(scope: ExecutionScope, leaseHolder: string, ttlSeconds: number): Promise; releaseExecutionLease(scope: ExecutionScope, leaseHolder: string): Promise; close(): Promise; private guarded; private markReady; private markDegraded; private markUnavailable; } export interface ValkeyStoreFactoryConfig { url?: string; host?: string; port?: number; password?: string; db?: number; envelopeMaxBytes?: number; logger?: Logger; } export declare function createValkeyExecutionContextStore(config: ValkeyStoreFactoryConfig): ValkeyExecutionContextStore; //# sourceMappingURL=store.d.ts.map