/** * Organisation destroy orchestration. * * Receives pre-authenticated credentials and destroys all organisation * infrastructure in cascade order: * 1. Member accounts across ALL regions in parallel * 2. Platform account in its home region * 3. Organisation root stack * * Auth, verification, and interactive prompts are the caller's job * (per engine/consumer boundary). */ import { type Result } from "@fjall/generator"; import { BaseServiceError } from "../../types/errors/ServiceError.js"; import type { DestroyParams, DestroyResult } from "../../types/params.js"; import type { OrganisationOperation } from "../../types/operations.js"; import type { DeployServices } from "../serviceFactory.js"; /** * One cascade target's failure, keyed by account AND region — a member swept * across N regions can fail in each, so accountId alone is not a key. The * platform entry carries its single resolved region. `error` is already * masked by the producer. */ export interface CascadeDestroyTargetFailure { accountId: string; region: string; error: string; } /** * The cascade left member/platform stacks standing, so the organisation root * stack was withheld (destroying the root would orphan the survivors' * resources). A typed FAILURE, not success-with-warnings: infrastructure * remains, so consumers must not clean up local state or record success. * Mirrors {@link LeaseDeniedError}'s typed-failure idiom; the name is a * literal so name-keyed classification survives a dist minified without * keepNames. */ export declare class CascadeDestroyFailedError extends BaseServiceError { readonly failures: readonly CascadeDestroyTargetFailure[]; /** Stacks that DID go before the gate — the maximal-teardown residue. */ readonly stacksDestroyed: readonly string[]; /** The org root stack was deliberately not destroyed and still stands. */ readonly orgRootWithheld = true; constructor(message: string, failures: readonly CascadeDestroyTargetFailure[], /** Stacks that DID go before the gate — the maximal-teardown residue. */ stacksDestroyed: readonly string[]); } /** * Destroy organisation infrastructure with cascade. * * The cascade ordering is: members (parallel, multi-region) -> platform -> org stack. * If any member or platform destruction fails, the org stack is NOT destroyed * (to avoid orphaning resources) and the run returns a typed * {@link CascadeDestroyFailedError} carrying every per-target failure. */ export declare function destroyOrganisation(params: DestroyParams, services: DeployServices, operation: OrganisationOperation): Promise>;