UNPKG

@hotmeshio/hotmesh

Version:

Permanent-Memory Workflows & AI Agents

88 lines (87 loc) 2.66 kB
export interface PostgresClientOptions { host?: string; port?: number; user?: string; password?: string; database?: string; max?: number; idleTimeoutMillis?: number; } export type PostgresJobEnumType = 'status' | 'jdata' | 'adata' | 'udata' | 'jmark' | 'hmark' | 'other'; export type PostgresClassType = { new (options: PostgresClientOptions): PostgresClientType; }; export type PostgresPoolType = { new (options: PostgresClientOptions): PostgresPoolClientType; connect: (options: PostgresClientOptions) => Promise<PostgresClientType>; query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>; }; export interface PostgresNotification { channel: string; payload: string; } export interface PostgresClientType { connect: () => Promise<PostgresClientType>; query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>; end: () => Promise<void>; on?: (event: 'notification', listener: (notification: PostgresNotification) => void) => void; off?: (event: 'notification', listener: (notification: PostgresNotification) => void) => void; removeAllListeners?: (event?: string) => void; } export interface PostgresPoolClientType { connect: () => Promise<PostgresClientType>; release: () => void; end: () => Promise<void>; query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>; idleCount: number; totalCount: number; } export interface PostgresQueryResultType { rows: any[]; rowCount: number; } export interface PostgresQueryConfigType { text: string; values?: any[]; } export interface PostgresStreamOptions extends PostgresClientOptions { schema?: string; maxRetries?: number; retryDelay?: number; streamTablePrefix?: string; consumerTablePrefix?: string; } export interface PostgresStreamMessage { id: string; stream: string; message: any; created_at: Date; sequence?: number; } export interface PostgresConsumerGroup { stream: string; group_name: string; last_message_id: string; created_at: Date; updated_at: Date; } export interface PostgresPendingMessage { stream: string; group_name: string; consumer_name: string; message_id: string; delivered_at: Date; delivery_count: number; } export interface PostgresTransaction { client: PostgresPoolClientType; queryBuffer: { text: string; values: any[]; }[]; begin(): Promise<void>; query(text: string, values?: any[]): Promise<PostgresQueryResultType>; commit(): Promise<void>; rollback(): Promise<void>; release(): void; }