import { type Result } from "@fjall/generator"; import type { DeployParams } from "../../types/params.js"; import type { DeploymentContext } from "../../types/deployment/DeploymentTypes.js"; import type { DeployCallbacks } from "../../types/callbacks.js"; import type { ApplicationOperation, ApplicationStack } from "../../types/operations.js"; import { type RunbookLatch } from "./ecsDeploymentTail.js"; import type { DeployServices } from "../serviceFactory.js"; import type { DetectionResult } from "./detectionPipeline.js"; import { type DockerBuildProducts } from "./dockerBuildHelper.js"; import type { BuildCallbacks } from "../../types/frameworkBuilder.js"; import type { PublishedLambdaVersion } from "../../services/infrastructure/LambdaService.js"; import type { StackDeploySession } from "../../services/application/ApplicationStackService.js"; /** * The ECS tail one stack's deploy runs beside, sequential or parallel: it * narrates ECS's view of the stack's services, and hands the deploy the watch * that ends an update ECS rolled back and CloudFormation stopped driving * (FJL-901). A tail that does not finalise cleanly is a warning, never a * failure of the deploy. */ export declare function ecsTailSession(services: DeployServices, callbacks: DeployCallbacks, abortSignal: AbortSignal | undefined, runbook?: RunbookLatch): StackDeploySession; /** * Single source of the deploy loop's stack-inclusion predicate: a stack * deploys when its template hash changed, when `--force` overrides the hash * gate, or when Compute must run for an image build. The destruction gate * MUST diff exactly this set — a second derivation lets a hash-unchanged * stack deploy under `--force` without the gate ever seeing its live diff * (local v1 templates vs a live stack moved to v2 out-of-band: hashes match, * the stack escapes the plan, and the forced deploy applies a destructive * v2→v1 revert with no ticket). */ export declare function getStackNamesToDeploy(params: { deployOrder: readonly ApplicationStack[]; stackChanges: ReadonlyMap; appName: string; force: boolean; computeBuildPossible: boolean; }): ReadonlySet; /** * Single source of the deploy loop's "will an image build/push run" outcome, * bound into the approval digest (DeployScope.imageBuild) so a token approves * the exact build behaviour, not the flag that requested it. Mirrors the * loop's ACTUAL gates in order: the skip predicate (Compute must be in the * to-deploy set), `runDockerPreCompute`'s provider guard, and its * hasDockerfile branch. Deliberately NOT `computeBuildPossible`: that flag * decides whether Compute must deploy FOR a build (false under * `--infra-only`), but a hash-changed Compute stack still builds regardless — * the loop consults only the three gates above, so `--infra-only` reaches * this predicate solely through the to-deploy set. */ export declare function willRunDockerBuild(params: { stackNamesToDeploy: ReadonlySet; appName: string; hasDockerProvider: boolean; hasDockerfile: boolean; }): boolean; /** * Identify Phase 2 stacks (Storage, Messaging, Database) that are consecutive * in the deploy order and included in the to-deploy set. Returns them for * parallel deployment only if there are at least 2. */ export declare function getParallelPhase2Stacks(deployOrder: readonly ApplicationStack[], currentIndex: number, appName: string, stackNamesToDeploy: ReadonlySet): ApplicationStack[]; /** * The outputs of every stack a deploy has run so far, merged in deploy order * so a later stack's value wins. `outputs` is keyed by output key and * `exports` by CloudFormation export name — the two namespaces a * `DeployResult` carries. */ export interface StackOutputAccumulator { outputs: Record; exports: Record; } /** * Deploy a group of stacks in parallel, reporting step events for each. */ export declare function deployParallelPhase(stacks: ApplicationStack[], operation: ApplicationOperation, services: DeployServices, context: DeploymentContext, callbacks: DeployCallbacks, startIndex: number, totalSteps: number, detection: DetectionResult, accumulator: StackOutputAccumulator, deployedHashes: Map): Promise>; interface DeployStackSequentialOptions { parameters?: Record; abortSignal?: AbortSignal; } /** * Deploy a single stack with step lifecycle events and output collection. */ export declare function deployStackSequential(stack: ApplicationStack, services: DeployServices, context: DeploymentContext, callbacks: DeployCallbacks, stepIndex: number, totalSteps: number, accumulator: StackOutputAccumulator, deployOptions?: DeployStackSequentialOptions): Promise>; /** * What the pre-Compute docker phase produced: the per-service content-hash * tag map (drives `--parameters` plumbing; empty for the legacy fallback and * welcome-image paths) plus the digests/repo URI consumed by full-deploy * artefact collection. */ export type DockerPreComputeOutcome = DockerBuildProducts; /** * Run Docker build/push or welcome image setup before the Compute stack. * Returns a `Result` on success carrying the build * products, a failure on docker error, or `null` when no docker work is * required for this stack. */ export declare function runDockerPreCompute(stack: ApplicationStack, params: DeployParams, services: DeployServices, operation: ApplicationOperation, callbacks: DeployCallbacks, hasDockerfileOnDisk: boolean): Promise | null>; /** * Publish a fresh Lambda version for every container-image Lambda whose * shared `image` build key was actually rebuilt this cycle. * * CDK's `Function.currentVersion` can't be trusted here: its `Version` * logical-id hash is computed from synth-time template shape, and the image * reference is a `CfnParameter` Ref (a constant token across synths, same * mechanism ECS task-definition image tags use) — so the hash doesn't change * between deploys even though the parameter's resolved value (and therefore * the deployed image) does. An explicit `PublishVersion` call after the * Compute stack deploy succeeds sidesteps that entirely. * * Best-effort by contract, matching `artefactCollection.ts`'s post-deploy * discovery: a publish failure degrades (warns, omits that function from the * returned map) rather than failing a deploy that already succeeded. */ export declare function runLambdaVersionPublish(operation: ApplicationOperation, services: DeployServices, callbacks: DeployCallbacks, contentHashTagsByService: Record, abortSignal?: AbortSignal): Promise>; /** * Bridge DeployCallbacks to BuildCallbacks. * Fires both legacy OpenNext-specific callbacks and generic build callbacks * for backwards compatibility during the transition period. */ export declare function createBuildCallbacks(callbacks: DeployCallbacks): BuildCallbacks; export {};