import { type Result } from "@fjall/generator"; import { type ServiceArtefact } from "@fjall/util"; import { type ManifestLambdaDockerEntry } from "@fjall/util/manifest"; import type { DeployParams } from "../../types/params.js"; import type { ApplicationOperation } from "../../types/operations.js"; import type { DeployServices } from "../serviceFactory.js"; import type { RolledLambdaFunction } from "./rollbackRestore.js"; /** * Lambda-parallel rollout logic for `deployCodeOnly`'s three modes, mirroring * the ECS rollout helpers in `codeOnlyDeploy.ts`. Unlike ECS, Lambda needs no * CloudFormation-export-based discovery step: `computeLambda.ts` sets * `functionName: id` verbatim on the underlying `Function` construct, and * `compute.ts`'s manifest branch sets `manifestLambda.name = id` — the SAME * `id`. So the manifest's `ManifestLambdaDockerEntry.name` IS the live * function's exact `FunctionName`; `parseLambdaDockerEntriesFromManifest` is * a complete, sufficient "what to update, and by what name" source. */ export interface LambdaRolloutOutcome { outputs: Record; artefacts: ServiceArtefact[]; failures: string[]; /** * Distinct `{imageKey, tag}` pairs actually rolled, deduped by imageKey: * the reconcile's image-tag parameters and nothing else (rollback modes * only; the primary path never reconciles, matching ECS's asymmetry). */ rolledImageKeys: Array<{ serviceName: string; imageTag: string; }>; /** * Each function rolled, by its own name, with the digest applied: what a * rollback's hold puts back (`holdRollback`). Several functions can share * an image key, so a function is never addressed by its key. */ rolledFunctions: RolledLambdaFunction[]; } /** * Exact case-insensitive match on a manifest Lambda function name. Deliberately * NOT `matchesServiceName` (serviceImageTagsRollback.ts): its `endsWith` suffix * fallback exists for ECS live-ARN names that carry cluster prefixes, but a * manifest Lambda `name` IS the exact `FunctionName` (see the module JSDoc * above), so suffix matching would let `--service order` silently roll * `processOrder`. Callers in `codeOnlyDeploy.ts` (the not-found gate) must use * this same matcher — an exact filter behind a fuzzy gate turns a typo into a * silent zero-artefact no-op. */ export declare function matchesLambdaFunctionName(manifestName: string, candidate: string): boolean; /** * Primary path: roll every container Lambda whose `imageKey` was rebuilt * this cycle. Builds a digest-pinned `ImageUri` directly from * `imageDigestsByService` — no ECR `BatchGetImage` call needed, since * `runDockerBuild` already resolved that digest for anything it just built. */ export declare function rolloutLambdaPrimary(services: DeployServices, operation: ApplicationOperation, contentHashTagsByService: Record, imageDigestsByService: Record, repoUri: string, callbacks: DeployParams["callbacks"], targetService: string | undefined, abortSignal?: AbortSignal): Promise; /** * `--image-tag ` rollback: re-base the supplied tag onto each Lambda's * `imageKey` family via `rebaseRollbackTagForService` — reused UNCHANGED, * it's pure string manipulation with no ECS-specific logic. `allFamilyNames` * MUST be the combined ECS-service-name ∪ Lambda-imageKey set so a supplied * tag re-bases correctly across both entity types in one rollback; passing * only ECS names here would let an ECS-family tag silently misapply to an * unrelated Lambda. */ export declare function rolloutLambdaImageTag(services: DeployServices, operation: ApplicationOperation, explicitRollbackTag: string, allFamilyNames: readonly string[], callbacks: DeployParams["callbacks"], targetService: string | undefined, abortSignal?: AbortSignal): Promise; /** * Everything the `serviceImageTags` execute phase needs, resolved BEFORE any * mutation on either entity type. `repoUri` is "" when nothing matched (no * account/region lookup was needed). */ export interface LambdaServiceImageTagsPreflight { matched: Array<{ entry: ManifestLambdaDockerEntry; tag: string; }>; digestsByFunctionName: Map; repoUri: string; } /** * `serviceImageTags` map rollback, preflight half: exact-name match against * manifest Lambda entries (simpler than ECS's ARN-suffix matching — Lambda * function names are deterministic and exact, no live-ARN fuzziness to * resolve), then resolve every matched entry's digest, mirroring * `preflightResolveServiceImageTagDigests`'s atomic-fail-closed behaviour: a * single bad tag fails the whole rollback. Split from the execute half so * `deployCodeOnly` can run BOTH namespaces' preflights before mutating * EITHER — a bad Lambda tag must abort while ECS is still untouched, and * vice versa. */ export declare function preflightLambdaServiceImageTags(services: DeployServices, operation: ApplicationOperation, serviceImageTags: Record, abortSignal?: AbortSignal): Promise>; /** * `serviceImageTags` map rollback, execute half: roll every preflighted * function to its digest-pinned image. Never fails fatally — per-function * failures land in `outcome.failures`, matching the ECS roll loop's * continue-on-failure semantics. */ export declare function executeLambdaServiceImageTagsRollout(services: DeployServices, preflight: LambdaServiceImageTagsPreflight, callbacks: DeployParams["callbacks"], abortSignal?: AbortSignal): Promise;