import { DurationString } from "./types.js"; //#region src/lib/duration.d.ts /** * Parse a duration value into whole seconds. * * Accepted formats: * - a positive finite **number** → interpreted as seconds (must be an integer) * - a **string** of the form `` where unit is one of `s`, `m`, `h`, `d`, `w` * (e.g. `30s`, `5m`, `1h`, `7d`, `2w`) * * A **unit is required** on strings: a bare numeric string like `"7"` is rejected — pass a * `number` (`7`) for raw seconds instead. This removes the ambiguity where `"7"` silently * meant 7 seconds rather than, say, `"7d"`. * * Returns `{ seconds }` on success or `{ error }` on failure. Pure function — never throws. */ declare function parseDuration(input: string | number): { seconds: number; } | { error: string; }; /** Neon's branch-expiration ceiling: the API rejects an `expires_at` more than 30 days out. */ declare const MAX_BRANCH_TTL_SECONDS: number; /** * Parse a branch TTL into seconds, enforcing Neon's branch-expiration limit on top of the * shared {@link parseDuration} rules: the result must be `> 0` and at most 30 days * ({@link MAX_BRANCH_TTL_SECONDS}), since the API caps `expires_at` at 30 days from now. * * Returns `{ seconds }` on success or `{ error }` on failure. Pure function — never throws. */ declare function parseBranchTtl(input: string | number): { seconds: number; } | { error: string; }; /** * Render a TTL in seconds back to the canonical "" form. Used for round-trip * serialization when {@link pullConfig} emits a TTL value (it always falls back to seconds * when no clean unit boundary matches). The output always carries a unit, so it is a valid * {@link DurationString}. */ declare function formatDurationSeconds(totalSeconds: number): DurationString; /** * Parse a suspend timeout value into seconds for the Neon API. * * Accepted formats: * - `false` → -1 (never suspend) * - `undefined` → 0 (use platform default) * - duration string → parsed seconds ("5m", "1h", "7d") * - number → validated seconds (must be 60-604800 or -1/0) * * Returns `{ seconds }` on success or `{ error }` on failure. Pure function — never throws. */ declare function parseSuspendTimeout(input: false | string | number | undefined): { seconds: number; } | { error: string; }; /** * Format a suspend timeout value from API seconds back to the user-facing type. * Returns `false` for -1 (never suspend), `undefined` for 0 (default), or a duration string. */ declare function formatSuspendTimeout(seconds: number): false | DurationString | undefined; //#endregion export { MAX_BRANCH_TTL_SECONDS, formatDurationSeconds, formatSuspendTimeout, parseBranchTtl, parseDuration, parseSuspendTimeout }; //# sourceMappingURL=duration.d.ts.map