@pwngh/economy-lab
    Preparing search index...

    Interface PostgresStoreOptions

    Configuration for postgresStore. Everything beyond url has a working default: pg's pool size of 10, no connection timeout, the deterministic SHA-256 digest, the wall clock, a one-hour velocity window, and the 'assert' schema policy.

    interface PostgresStoreOptions {
        clock?: Clock;
        connectionTimeoutMillis?: number;
        digest?: Digest;
        layout?: "standard" | "partitioned";
        logger?: Logger;
        meter?: Meter;
        pool?: PgPool;
        poolMax?: number;
        schema?: "assert" | "skip";
        schemaName?: string;
        url: string;
        velocityWindowMs?: number;
    }
    Index
    clock?: Clock

    Time source for postedAt and window math; defaults to wall-clock time.

    connectionTimeoutMillis?: number

    Max time (ms) to wait for a connection before failing. pg's default is no timeout, so a routable-but-stalled host would otherwise hang indefinitely.

    digest?: Digest

    Hash service for chain links; defaults to the deterministic web-standard SHA-256.

    layout?: "standard" | "partitioned"

    Table layout the isolated schema is provisioned with: 'partitioned' hash-partitions the growth tables (a provisioning choice, runtime-identical). Only meaningful with schemaName; a database provisioned externally chooses its layout at migration time.

    logger?: Logger
    meter?: Meter

    Optional runtime ports for the engine's own telemetry (transient-retry pressure). The composition passes the runtime meter and logger; unset emits nothing.

    pool?: PgPool

    The driver seam: a caller-built pool takes the place of the default pg pool — the same PgPool surface with any wire implementation behind it. The caller points it at the right database and returns int8/numeric columns as BigInt (the default pool's type parsers); with schemaName, its connections must also resolve unqualified names to that schema (the default pool does this via a search_path startup option). The store owns the pool it is given and ends it on close(). poolMax and connectionTimeoutMillis do not apply.

    poolMax?: number

    Max connections in the pool. Each in-flight transaction holds one connection for its whole BEGIN..COMMIT, so this caps how many submits can run at once: a caller that drives N concurrent submits must size this to at least N or the extra ones block waiting for a connection. Left unset, pg's default of 10 applies.

    schema?: "assert" | "skip"

    Open-path schema policy: 'assert' (the default) requires the schema_meta stamp to match this build; 'skip' is break-glass. Migration is an external job — never an open option.

    schemaName?: string

    Optional dedicated Postgres schema name, created/loaded then dropped on close, so parallel test runs don't collide. Omit to use the schema the connection already points at.

    url: string

    Connection URL the default pg pool connects with; unused when pool is supplied.

    velocityWindowMs?: number

    Rolling window (ms) the trust store applies when summing a subject's recent spend for the velocity check. Defaults to one hour; the composition passes config.velocityWindowMs.