Member Junction
    Preparing search index...

    Lightweight adapter for PostgreSQL reachability, sign-in checks, and running the installer's setup steps.

    const adapter = new PostgresAdapter();
    const login = await adapter.TryLogin({ Host: 'localhost', Port: 5432, Database: 'mj', User: 'MJ_Connect', Password: 'secret' });
    console.log(login.Ok ? 'OK' : login.ErrorMessage);
    Index

    Constructors

    Methods

    • Test TCP connectivity to a PostgreSQL server. No credentials are sent.

      Parameters

      • host: string

        PostgreSQL hostname or IP address.

      • port: number

        PostgreSQL TCP port (typically 5432).

      • timeoutMs: number = 5000

        Maximum time to wait for the connection, in milliseconds (default: 5000).

      Returns Promise<PgConnectivityResult>

      Connectivity result with reachability status, optional error, and latency.

    • Run setup steps in order, each as its own plain query outside any transaction block. A new connection is opened whenever a step targets a different database than the one before it; every connection is closed before this method returns, whether it succeeds or throws.

      Parameters

      • server: Omit<PgLoginTarget, "Database">

        Server and credentials; each step supplies its own database.

      • steps: PgSetupStep[]

        The ordered setup steps.

      • onMessage: (message: string) => void

        Receives a line per step (run or skipped) and each server NOTICE.

      Returns Promise<void>

      For the first step that fails; later steps do not run.

    • Sign in to PostgreSQL and open target.Database, then disconnect.

      Parameters

      • target: PgLoginTarget

        Server, database, and credentials to try.

      Returns Promise<PgLoginResult>

      Whether the sign-in worked and, if not, whether PostgreSQL refused it.