import type { ResourceEvent } from "../../types/events.js"; import type { DeploymentContext } from "../../types/deployment/DeploymentTypes.js"; import { type ApplicationStack } from "../../types/operations.js"; import type { ParallelDeploymentResult } from "../../types/deployment/parallel.js"; import type { AppResourceFlags } from "../../types/detection/patternDetection.js"; import { type Result } from "@fjall/generator"; import { ApplicationError, type StackDeploymentData } from "../../types/application/ApplicationServiceTypes.js"; import type { ApplicationStackService } from "./ApplicationStackService.js"; import type { CloudFormationService } from "../infrastructure/CloudFormationService.js"; import type { DeployCallbacks } from "../../types/callbacks.js"; import type { DeployParams } from "../../types/params.js"; import { LeaseDeniedError } from "../../orchestration/application/leaseGate.js"; /** Shared with ApplicationStackService.destroyAllStacks — the two signatures must not drift. */ export interface DestroyAllStacksCallbacks { onOutput?: (chunk: string, stackId?: ApplicationStack) => void; onResourceProgress?: (event: ResourceEvent, stackId?: ApplicationStack) => void; onLog?: DeployCallbacks["onLog"]; onStackCleanupProgress?: DeployCallbacks["onStackCleanupProgress"]; onStackStart?: (stackType: ApplicationStack, stackName: string) => void; onStackComplete?: (stackType: ApplicationStack, result: Result) => void | Promise; onParallelPhaseStart?: (stacks: readonly ApplicationStack[], description: string) => void; onParallelPhaseComplete?: (results: ParallelDeploymentResult[]) => void; } /** * Handle destroy errors and determine if we should continue or fail */ export declare function handleDestroyError(result: Result, stackType: ApplicationStack): { continue: boolean; result: Result<{ message: string; }, ApplicationError | LeaseDeniedError>; } | null; /** * What the destroy orchestrator resolved for the lane. The order comes from * the state file (the post-deploy manifest truth) — it is never re-derived * here from the builder plan, whose Docker defaults carry no Cdn or us-east-1 * flags: a lane iterating that pre-synth guess skips a docker app's * `Cdn`/`UsEast1*` stacks outright, and the orphaned `UsEast1CdnLogging` * stack then holds the Cdn stack's cross-region exports against a later * delete. */ export interface ApplicationDestroyPlan { readonly destroyOrder: readonly ApplicationStack[]; /** OpenNext patterns destroy in the resource-aware parallel groups. */ readonly parallel: boolean; /** The state-derived flags that splice the us-east-1 phases into those groups. */ readonly resources?: AppResourceFlags; } /** * Destroy all stacks for an application in reverse order. * Supports parallel destruction for OpenNext patterns (nextjs/payload). */ export declare function destroyAllStacks(service: ApplicationStackService, cfnService: CloudFormationService, context: DeploymentContext, plan: ApplicationDestroyPlan, callbacks?: DestroyAllStacksCallbacks, abortSignal?: AbortSignal, assertLeaseForStack?: DeployParams["assertLeaseForStack"]): Promise>; /** * Map Promise.allSettled results to ParallelDeploymentResult[], handling * rejected promises with a fallback stack identity. */ export declare function mapSettledResults(settled: Array>, stacks: readonly ApplicationStack[]): ParallelDeploymentResult[]; /** * Resolve the website URL for an application from CloudFormation stack outputs. * Checks Compute stack for LoadBalancer URL, then CDN stack for CloudFront distribution. */ export declare function resolveWebsiteUrl(appName: string, cloudFormationService: CloudFormationService): Promise;