import { Knex } from "knex"; import { ERPObjType } from "../../types/erp-types.js"; import { CacheMetrics } from "./index.js"; type HashedCacheManagerOptions = { ttl?: number; tableName?: string; /** Injectable Knex handle (tests); defaults to the SDK's local SQLite. */ db?: Knex; }; export declare class HashedCacheManager { private static TABLE_NAME; private db; private ownsDb; private options; private static readonly SEED; private isDestroyed; private metrics; constructor(options?: HashedCacheManagerOptions); /** * Checks if the cache manager is still valid * @throws Error if the cache manager has been destroyed */ private checkValid; /** * Generates a stable hash of a record using JSON stringify + xxhash */ static hashRecord(record: object): string; /** * Derives a stable per-entity identity for a record, or null when it cannot be * computed (e.g. required key fields are missing). A null identity means the * record is never deduped and never cached — we must not silently drop a write * for a record we cannot identify. */ private static entityKeyFor; /** * Gets the stored content hash for an entity, keyed by its primary key. * @returns the stored row's content hash, or null if the entity is uncached */ private getRecord; /** * Stores (upserts) an entity's last-sent content hash, keyed by its primary key. * @returns true if the stored content changed (new entity or different content) */ store(type: ERPObjType, record: object): Promise; /** * Checks if a record has changed since the last content we sent for that entity. * @param type The type of record * @param record The record to check * @returns true if the record is new, its content differs from the last stored * content for that entity, or its identity cannot be computed */ hasChanged(type: ERPObjType, record: object): Promise; /** * Checks if a record has changed and stores it if it has * @param type The type of record * @param record The record to check and store * @returns true if the record was changed or is new */ upsert(type: ERPObjType, record: object): Promise; /** * Removes expired records based on TTL */ removeExpiredObjects(): Promise; /** * Gets the entity keys of all cached records of a specific type */ getRecordsByType(type: ERPObjType): Promise; /** * Removes all records of a specific type */ removeRecordsByType(type: ERPObjType): Promise; /** * Removes a specific record */ removeRecord(type: ERPObjType, record: object): Promise; /** * Clears all records from the cache */ clear(): Promise; /** * Cleans up database connection and marks the cache manager as destroyed */ destroy(): Promise; /** * Gets the current cache metrics * @returns The current cache metrics */ getMetrics(): Promise; } export {}; //# sourceMappingURL=hashed-cache-manager.d.ts.map