The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as S3 from "@distilled.cloud/aws/s3"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import type { Bucket } from "./Bucket.ts"; |
| 5 | |
| 6 | export interface UploadPartRequest extends Omit<S3.UploadPartRequest, "Bucket"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `s3:UploadPart`. |
| 10 | * |
| 11 | * Uploads one part of a multipart upload started with |
| 12 | * `CreateMultipartUpload`. Keep each part's returned `ETag` — the final |
| 13 | * `CompleteMultipartUpload` call needs the full `{ ETag, PartNumber }` list. |
| 14 | * Provide the implementation with `Effect.provide(AWS.S3.UploadPartHttp)`. |
| 15 | * ### Multipart Uploads |
| 16 | * **Example:** Upload a Part |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the bucket |
| 19 | * const uploadPart = yield* AWS.S3.UploadPart(bucket); |
| 20 | * |
| 21 | * // runtime — PartNumber is 1-based; collect the ETag for completion |
| 22 | * const part = yield* uploadPart({ |
| 23 | * Key: "backups/archive.tar", |
| 24 | * UploadId, |
| 25 | * PartNumber: 1, |
| 26 | * Body: chunk, // 5 MiB–5 GiB except the last part |
| 27 | * }); |
| 28 | * parts.push({ ETag: part.ETag, PartNumber: 1 }); |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface UploadPart extends Binding.Service< |
| 34 | UploadPart, |
| 35 | "AWS.S3.UploadPart", |
| 36 | ( |
| 37 | bucket: Bucket, |
| 38 | ) => Effect.Effect< |
| 39 | (request: UploadPartRequest) => Effect.Effect<S3.UploadPartOutput, S3.UploadPartError> |
| 40 | > |
| 41 | > {} |
| 42 | export const UploadPart = Binding.Service<UploadPart>("AWS.S3.UploadPart"); |