import { Condition } from "../../condition/Condition"; import { CosmosDatabase, CosmosDocument, CosmosId } from "../../CosmosDatabase"; import { CosmosContainer } from "../../CosmosContainer"; import { Pool } from "pg"; /** Derives an `_expireAt` epoch second value when ttl is a valid number. */ export declare const addExpireAt: (data: Record) => number | undefined; /** Throws when the provided identifier is empty or invalid. */ export declare const ensureIdentifier: (value: string, label: string) => void; /** * CosmosDatabase implementation that stores JSON documents inside * PostgreSQL tables and partitions them by schema/table mapping. */ export declare class PostgresDatabaseImpl implements CosmosDatabase { /** Shared pg Pool reused for each container. */ private readonly pool; /** Database name provided by the Cosmos API. */ private readonly dbName; /** Cached CosmosContainers keyed by logical collection name. */ private readonly collectionMap; /** * @param pool pg Pool used for queries. * @param dbName Logical database name, used to scope containers. */ constructor(pool: Pool, dbName: string); /** Lazily creates a CosmosContainer for a collection. */ createCollection(coll: string): Promise; /** Removes cached metadata for a collection. */ deleteCollection(coll: string): Promise; /** Gets or creates the CosmosContainer for the provided collection. */ getCollection(coll: string): Promise; /** Inserts a new document into `.` jsonb table. */ create(coll: string, data: CosmosDocument, partition?: string): Promise; /** Reads a document and throws 404 when not found. */ read(coll: string, id: string, partition?: string): Promise; /** Reads a document and falls back to default when missing. */ readOrDefault(coll: string, id: string, partition: string, defaultValue: CosmosDocument | null): Promise; /** Inserts or replaces a document by id. */ upsert(coll: string, data: CosmosDocument, partition?: string): Promise; /** Updates an existing document and merges payload with stored value. */ update(coll: string, data: CosmosDocument, partition?: string): Promise; /** Deletes a document by id and returns the CosmosId when successful. */ delete(coll: string, id: string, partition?: string): Promise; /** Finds documents by translating a Condition into SQL. */ find(coll: string, condition: Condition, partition?: string): Promise; /** Not implemented helper, kept for Cosmos interface compatibility. */ findBySQL(coll: string, query: string, partition?: string): Promise; /** Counts documents matching the provided Condition. */ count(coll: string, condition: Condition, partition?: string): Promise; /** Extracts the first row data or throws CosmosError when empty. */ private extractResource; } //# sourceMappingURL=PostgresDatabaseImpl.d.ts.map