/** * Thin S3 transport for the Lambda handler. * * The OSS distributed primitives are pure functions over local file paths; * the Lambda handler bridges S3 ↔ Lambda's `/tmp` filesystem on each * invocation. Functions here are intentionally narrow: parse a URI, download * an object to a local path, upload a path/directory, tar-extract a planDir, * tar-pack a planDir back out. * * Tar (not zip) for planDir transit: * - planDirs contain symlinks (extract stage materializes them but the * compiled/ subtree may include linked assets); tar preserves them, zip * does not. * - We use the `tar` npm package (pure JS over `node:zlib`) — AWS * Lambda's `nodejs:22` base image ships neither `tar` nor `unzip` in * `/usr/bin`, so a system-binary tar would ENOENT in the actual * deployment. */ import { type S3Client } from "@aws-sdk/client-s3"; /** Parsed `s3://bucket/key` URI. */ export interface S3Location { bucket: string; key: string; } /** Parse `s3://bucket/key/path` → `{ bucket, key }`. Throws on malformed input. */ export declare function parseS3Uri(uri: string): S3Location; /** Build `s3://bucket/key` from a location. */ export declare function formatS3Uri(loc: S3Location): string; /** Stream an S3 object to a local file path. Throws if the body is missing. */ export declare function downloadS3ObjectToFile(client: S3Client, uri: string, destPath: string): Promise; /** Download and verify an immutable plan-v2 artifact before materialization. */ export declare function downloadS3ObjectToFileVerified(client: S3Client, uri: string, destPath: string, expectedSha256: string): Promise; /** * Upload a local file's contents to an S3 URI using a streaming * `PutObjectCommand`. PutObject's 5 GB cap comfortably exceeds the * distributed pipeline's 2 GB planDir limit and the typical * chunk size (≤ 200 MB), so a single PUT works for every artifact this * adapter handles. */ export declare function uploadFileToS3(client: S3Client, localPath: string, uri: string, contentType?: string): Promise; /** * Upload one content-addressed plan-v2 artifact exactly once. * * Existing objects are reused only when their immutable digest metadata and * byte length agree. A conflicting object is never overwritten: doing so * could change a plan already being consumed by another chunk invocation. */ export declare function uploadContentAddressedFileToS3(client: S3Client, localPath: string, uri: string, expectedSha256: string, contentType?: string): Promise<"uploaded" | "reused">; export declare function sha256File(path: string): Promise; /** * Pack a directory into a `.tar.gz` at `destTarball`. Uses the `tar` npm * package (pure JS over `node:zlib`) rather than spawning a system tar * binary — the AWS Lambda Node 22 base image ships a minimal set of * userland tools and does NOT include `tar` in `/usr/bin`. */ export declare function tarDirectory(sourceDir: string, destTarball: string): Promise; /** * Extract a `.tar.gz` produced by {@link tarDirectory} into `destDir`. * The directory is created (or cleared) before extraction so a retried * invocation doesn't observe stale files from a prior run on the same * warm Lambda container. */ export declare function untarDirectory(tarballPath: string, destDir: string): Promise; //# sourceMappingURL=s3Transport.d.ts.map