import type { PostgresLevelInfoResult, PostgresPoolInfoResult } from '@heroku/types/data'; /** The maximum number of follower-pool instances a database cluster can hold. */ export declare const MAX_POOL_INSTANCES = 13; /** The name the leader pool always carries; any other name is a follower pool. */ export declare const LEADER_POOL_NAME = "leader"; /** A single compute level from `postgresLevel.info`. */ export type LevelItem = PostgresLevelInfoResult['items'][number]; /** * A level paired with whether it's selectable for a given pool. The level a * pool is already at is reported unavailable (`reason: 'current_level'`), * mirroring the CLI's "current level" disabling; every other level is * available. Callers get the full `LevelItem` (vcpu/memory/connection_limit), * not just a name, so they can render without a second lookup. */ export type AvailableLevel = { level: LevelItem; } & ({ available: false; reason: 'current_level'; } | { available: true; }); /** * An action that can be taken on a pool. A discriminated union on `type`: * `change_level` applies to any pool; `add_ha`/`remove_ha` are the leader's * HA toggle (carrying the instance `count` the mutation sets); `update_count` * (carrying the selectable `min`/`max`) and `destroy` apply to follower pools. */ export type PoolAction = { count: 1; type: 'remove_ha'; } | { count: 2; type: 'add_ha'; } | { max: number; min: number; type: 'update_count'; } | { type: 'change_level'; } | { type: 'destroy'; }; export type ListAvailableActionsOptions = { /** * Total instances across *all* follower pools in the cluster, *including* * the pool being queried. Used to bound a follower's `update_count` range: * the edited pool's own instances are excluded so it can grow back into the * budget they occupy (`max = MAX_POOL_INSTANCES - (count - pool.expected_count)`, * floored at 1). Required so an omitted count can't silently widen the range * to the full budget. Ignored for the leader pool. */ followerInstanceCount: number; }; /** * Derives the selectable compute levels for a pool. Pure — no request. * * Returns every level from `levels`, marking the pool's current * `expected_level` unavailable (`reason: 'current_level'`) so the UI can * disable it. With no `pool`, every level is available (e.g. choosing the * level for a brand-new pool). */ export declare function listAvailableLevels(levels: PostgresLevelInfoResult, pool?: Pick): AvailableLevel[]; /** * Derives the actions available on a pool. Pure — no request. * * The leader pool can always change level and can toggle high availability: * `remove_ha` (down to a single instance) when it currently runs a standby * (`expected_count > 1`), otherwise `add_ha` (up to two instances). A follower * pool can change level, update its instance count (bounded by the cluster's * remaining instance budget), or be destroyed. */ export declare function listAvailableActions(pool: Pick, options: ListAvailableActionsOptions): PoolAction[]; export declare const postgresPoolExtensions: import("../../core/extend-resource.js").ResourceExtension<"data", "postgresPool", { listAvailableActions: typeof listAvailableActions; listAvailableLevels: typeof listAvailableLevels; }>;