import type { ResourceCtx } from '../../../core/extend-resource.js'; /** * Progress reported on each poll where the fleet has NOT yet fully * converged on the target release. `onLatest` of `total` relevant * dynos are running a version `>= version`. */ export type WaitForReleaseProgress = { onLatest: number; total: number; version: number; }; export type WaitForReleaseOptions = { /** * Maximum number of polls before giving up with * {@link ReleaseNotConvergedError}. Omitted (the default) means * unbounded — the wait runs until the fleet converges or the * caller's {@link WaitForReleaseOptions.signal} aborts, matching a * long-running `ps:wait`. */ attempts?: number; /** Delay between polls in milliseconds. Defaults to 10000. */ delayMs?: number; /** * Fires after every poll where the fleet has NOT yet converged * (i.e. `onLatest < total`), before the next wait. It never fires * on the converged poll — a fleet already on the latest release * when the first poll runs produces no `onPoll` calls at all. Use * it to drive a live progress indicator; the converged result is * the resolved value, not an `onPoll` call. */ onPoll?: (progress: WaitForReleaseProgress) => void; signal?: AbortSignal; /** Only wait for dynos of this process type. */ type?: string; /** Include one-off `run` dynos in the wait. Mutually exclusive with `type`. */ withRun?: boolean; }; export type WaitForReleaseResult = { total: number; version: number; }; /** * Thrown by {@link waitForRelease} when {@link WaitForReleaseOptions.attempts} * was set and the fleet did not converge on the target release within * that many polls. Carries the last observed progress so callers can * report how far the fleet got. */ export declare class ReleaseNotConvergedError extends Error { readonly attempts: number; readonly progress: undefined | WaitForReleaseProgress; readonly id = "release_not_converged"; constructor(attempts: number, progress: undefined | WaitForReleaseProgress); } /** * Poll an app's dynos until every relevant one is `up` and running a * release version at least the app's latest, then resolve with the * converged `{total, version}`. * * "Relevant" excludes `release` dynos always, and one-off `run` dynos * unless {@link WaitForReleaseOptions.withRun} is set or * {@link WaitForReleaseOptions.type} names `'run'`; when * {@link WaitForReleaseOptions.type} is given, only that process type * is considered. * * The latest release is resolved once up front via * `GET /apps/{app}/releases` scoped to `Range: version ..; max=1, * order=desc`. If the app has no releases (or the latest has no * version), resolves `undefined` without polling — the caller should * report "no releases" rather than wait forever. * * Polling is unbounded by default (runs until convergence or an * aborted {@link WaitForReleaseOptions.signal}); pass * {@link WaitForReleaseOptions.attempts} to cap it, after which it * throws {@link ReleaseNotConvergedError}. */ export declare function waitForRelease(ctx: Pick, appIdentity: string, options?: WaitForReleaseOptions): Promise;