/** * Idempotency Store Service * * Main service for idempotency checking with pluggable adapters. * Supports multiple storage backends: in-memory, Redis, and more. */ import type { StorageExternalIdempotencyStore, StorageIdempotencyRecord } from '@plyaz/types/storage'; import type { LoggerInterface } from '@plyaz/types'; import type { CoreIdempotencyStoreConfig, CoreIdempotencyStoreType } from '@plyaz/types/core'; /** * Idempotency Store Service * * Factory service that creates and manages idempotency store adapters * * @example * ```typescript * import { IdempotencyStoreService } from '@plyaz/storage/idempotency'; * import type { CoreIdempotencyStoreConfig } from '@plyaz/types/core'; * * // In-memory store (default) * const service = new IdempotencyStoreService({ * type: 'in-memory', * options: { * defaultTTL: 3600000, * maxKeys: 10000, * } * }); * * // Redis store * import Redis from 'ioredis'; * const redis = new Redis({ host: 'localhost', port: 6379 }); * * const service = new IdempotencyStoreService({ * type: 'redis', * options: { * redis, * keyPrefix: 'webhook:', * } * }); * ``` */ export declare class IdempotencyStoreService implements StorageExternalIdempotencyStore { private adapter; private logger?; constructor(config: CoreIdempotencyStoreConfig, logger?: LoggerInterface); /** * Create adapter based on type */ private createAdapter; /** * Lazy load Redis adapter (optional dependency) */ private createRedisAdapter; /** * Check if key exists */ has(key: string): Promise; /** * Set key with TTL */ set(key: string, ttl: number, metadata?: Record): Promise; /** * Get record by key */ get(key: string): Promise; /** * Delete key */ delete(key: string): Promise; /** * Clear all keys (optional) */ clear(): Promise; /** * Get underlying adapter (for advanced usage) */ getAdapter(): StorageExternalIdempotencyStore; /** * Health check */ healthCheck(): Promise; }