import type { ConnectionPoolingCreateOpts, ConnectionPoolingCreateResult } from '@heroku/types/data'; import type { ResourceCtx } from '../../core/extend-resource.js'; import type { ResolvedPgDatabase } from './internal/resolve-pg-database.js'; export type ConnectionPoolingAttachment = ConnectionPoolingCreateResult; /** `name` and `credential` as the API takes them; `credential` defaults to `default`. */ export type AttachConnectionPoolingBody = Omit; export type AttachConnectionPoolingOptions = { /** * Runs once the pool is attached, before the release version fetch. The * attachment already exists at this point, so a throw here doesn't undo it. */ onAttached?: (attachment: ConnectionPoolingAttachment) => Promise | void; /** * Runs once the database is resolved and validated, before the attachment * is created. A throw (or abort) here prevents the create. */ onResolved?: (addon: ResolvedPgDatabase) => Promise | void; signal?: AbortSignal; }; export type AttachConnectionPoolingResult = { addon: ResolvedPgDatabase; attachment: ConnectionPoolingAttachment; releaseVersion?: number; }; /** * Resolves a Postgres database, attaches a connection pooler for it to the * app, and fetches the latest release version. * * `databaseIdentity` resolves through the app's attachments (defaulting to * `DATABASE_URL` when empty). Throws `EssentialDatabaseNotSupportedError` when * the database is Essential-tier. * * The release lookup is best-effort: the pool is already attached by then, so * a failed lookup reports `releaseVersion: undefined` rather than rejecting * (an abort still rejects). * * A rejection doesn't always mean nothing changed: once `onAttached` runs, the * attachment exists, so a throw from `onAttached` or an abort after it still * leaves the pool attached. Don't blindly retry after a rejection — check the * app's attachments first, or retrying may create a second pool attachment. */ export declare function attach(ctx: Pick, appIdentity: string, databaseIdentity?: string, body?: AttachConnectionPoolingBody, options?: AttachConnectionPoolingOptions): Promise; export declare const connectionPoolingExtensions: import("../../core/extend-resource.js").ResourceExtension<"data", "connectionPooling", { attach: (appIdentity: string, databaseIdentity?: string, body?: AttachConnectionPoolingBody, options?: AttachConnectionPoolingOptions) => Promise; }>;