The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import * as Binding from "alchemy/Binding"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import type { Bucket } from "./Bucket.ts"; |
| 4 | import type { RuntimeStorageMethods, StorageBindingOptions } from "./StorageBinding.ts"; |
| 5 | |
| 6 | export interface ReadBucketClient extends RuntimeStorageMethods<"get" | "head" | "list"> { |
| 7 | /** Presign an object download. This does not make the bucket public. */ |
| 8 | presignGet( |
| 9 | key: string, |
| 10 | options?: { expiresIn?: number }, |
| 11 | ): ReturnType<RuntimeStorageMethods<"presign">["presign"]>; |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Read/list storage on a branch. The bucket name limits this client's surface, |
| 16 | * not credential authorization. Injected Function credentials remain available |
| 17 | * to the entire process; this is not a Function-level security sandbox. |
| 18 | * |
| 19 | * ### Read Objects |
| 20 | * **Example:** Bind a bucket in Function initialization |
| 21 | * ```typescript |
| 22 | * const files = yield* Neon.ReadBucket(uploads); |
| 23 | * const object = yield* files.get("welcome.txt"); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | * @product Bucket |
| 28 | */ |
| 29 | export interface ReadBucket extends Binding.Service< |
| 30 | ReadBucket, |
| 31 | "Neon.ReadBucket", |
| 32 | (bucket: Bucket, options?: StorageBindingOptions) => Effect.Effect<ReadBucketClient> |
| 33 | > {} |
| 34 | export const ReadBucket = Binding.Service<ReadBucket>("Neon.ReadBucket"); |