/** * `getRenderProgress` — read-only progress + cost snapshot for a single * render started by {@link renderToLambda}. * * Pulls one `DescribeExecution` + one `GetExecutionHistory` per call. The * history is paginated server-side; the helper loops until exhausted so a * 1,000-event Step Functions execution still produces a single * `RenderProgress` snapshot. * * Progress math: * - 0 before Plan completes (no frame count is known yet) * - 0.1 once Plan completes (we know `totalFrames`) * - 0.1 + 0.8 × framesEncoded / totalFrames during chunk render * - 1.0 after Assemble completes * * Frame counts come from the parsed Lambda result payloads on each * `TaskSucceeded` event — Plan reports `TotalFrames`, RenderChunk reports * `FramesEncoded`. The shape mirrors what the handler produces in * `events.ts`, so the parser doesn't need to know anything beyond * "JSON.parse this string and grab two fields." */ import { SFNClient } from "@aws-sdk/client-sfn"; import { type RenderCost } from "./costAccounting.js"; /** Options for {@link getRenderProgress}. */ export interface GetRenderProgressOptions { /** Execution ARN from a {@link renderToLambda} call. */ executionArn: string; /** * Default memory size in MB to assume for Lambda invocations when the * history event payload doesn't carry it explicitly. Matches the * `LambdaMemoryMb` parameter the stack was deployed with. */ defaultMemorySizeMb?: number; region?: string; /** Test injection seam. */ sfn?: SFNClient; } /** Render-status discriminant; mirrors Step Functions execution states. */ export type RenderStatus = "RUNNING" | "SUCCEEDED" | "FAILED" | "TIMED_OUT" | "ABORTED" | "PENDING_REDRIVE"; export interface RenderError { /** State name where the failure surfaced (`Plan`, `RenderChunk`, `Assemble`, or ``). */ state: string; /** Error class / type as Step Functions reports it. */ error: string; /** Cause string Step Functions surfaces (often a stringified JSON payload from the handler). */ cause: string; } /** Snapshot of a single render's progress + cost + errors at one point in time. */ export interface RenderProgress { status: RenderStatus; /** `[0, 1]`; see module doc for the math. */ overallProgress: number; framesRendered: number; /** `null` until Plan completes. */ totalFrames: number | null; /** Total Lambda invocations scheduled so far (both optimized + raw task integrations). */ lambdasInvoked: number; costs: RenderCost; /** Final output object if Assemble succeeded; `null` otherwise. */ outputFile: { s3Uri: string; bytes: number | null; } | null; errors: RenderError[]; /** `true` once the execution has terminated in a non-`SUCCEEDED` state. */ fatalErrorEncountered: boolean; startedAt: string; endedAt: string | null; } /** Pull a current progress snapshot for one render. */ export declare function getRenderProgress(opts: GetRenderProgressOptions): Promise; //# sourceMappingURL=getRenderProgress.d.ts.map