import { type StatePrefixConfig } from "../state-prefix.js"; import type { PathwayDeliveryStore } from "../types.js"; import type { PostgresPoolConfig } from "./postgres-adapter.js"; /** Configuration for the PostgreSQL delivery store using a connection string */ export interface PostgresPathwayDeliveryStoreConnectionStringConfig extends StatePrefixConfig { /** Complete PostgreSQL connection string */ connectionString: string; /** These properties are not used when a connection string is provided */ host?: never; port?: never; user?: never; password?: never; database?: never; ssl?: never; /** Explicit table name. Overrides `statePrefix`. Default: `"pathway_delivery_state"`. */ tableName?: string; /** Connection pool configuration */ pool?: PostgresPoolConfig; } /** Configuration for the PostgreSQL delivery store using individual parameters */ export interface PostgresPathwayDeliveryStoreParametersConfig extends StatePrefixConfig { /** Not used when individual parameters are provided */ connectionString?: never; /** PostgreSQL server hostname */ host: string; /** PostgreSQL server port */ port: number; /** PostgreSQL username */ user: string; /** PostgreSQL password */ password: string; /** PostgreSQL database name */ database: string; /** Whether to use SSL for the connection */ ssl?: boolean; /** Explicit table name. Overrides `statePrefix`. Default: `"pathway_delivery_state"`. */ tableName?: string; /** Connection pool configuration */ pool?: PostgresPoolConfig; } /** Configuration options for the PostgreSQL delivery store */ export type PostgresPathwayDeliveryStoreConfig = PostgresPathwayDeliveryStoreConnectionStringConfig | PostgresPathwayDeliveryStoreParametersConfig; /** * PostgreSQL implementation of {@link PathwayDeliveryStore}. * * Holds the delivery pause of a pathway so it outlives the process. Without a durable * store a redeploy, a pod restart or a cluster leader change brings the pathway back * delivering, silently, while the operator still sees "paused". * * The row is shared by every instance of a deployable, so a new cluster leader reads the * same pause the old leader wrote. * * @example * ```typescript * const deliveryStore = createPostgresPathwayDeliveryStore({ * connectionString: "postgres://user:password@localhost:5432/mydb", * statePrefix: "compute_api", // optional, yields compute_api_pathway_delivery_state * }) * * pathways.withPathwayDeliveryStore(deliveryStore) * ``` */ export declare class PostgresPathwayDeliveryStore implements PathwayDeliveryStore { private config; private static readonly DEFAULT_TABLE_NAME; private postgres; private readonly tableName; private initialized; constructor(config: PostgresPathwayDeliveryStoreConfig); /** The resolved table name */ get table(): string; private initialize; getPausedPumps(pathwayKey: string): Promise; setPausedPumps(pathwayKey: string, pumpKeys: string[]): Promise; /** Close the underlying connection pool */ close(): Promise; } /** Creates a {@link PostgresPathwayDeliveryStore} */ export declare function createPostgresPathwayDeliveryStore(config: PostgresPathwayDeliveryStoreConfig): PostgresPathwayDeliveryStore; //# sourceMappingURL=postgres-pathway-delivery-store.d.ts.map