| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as Binding from "../Binding.ts"; |
| 3 | import type { Bucket } from "./Bucket.ts"; |
| 4 | import type { ReadBucketClient } from "./ReadBucket.ts"; |
| 5 | import type { WriteBucketClient } from "./WriteBucket.ts"; |
| 6 | import type { StorageBindingOptions } from "./StorageBinding.ts"; |
| 7 | |
| 8 | export interface ReadWriteBucketClient |
| 9 | extends ReadBucketClient, WriteBucketClient {} |
| 10 | /** |
| 11 | * Read and mutate a bucket with one credential granting storage:read and |
| 12 | * storage:write, or the Function's injected credentials. No per-bucket policy |
| 13 | * is manufactured. |
| 14 | * |
| 15 | * ### Read and Write |
| 16 | * **Example:** Bind uploads during Function initialization |
| 17 | * ```typescript |
| 18 | * const files = yield* Neon.ReadWriteBucket(uploads); |
| 19 | * ``` |
| 20 | * |
| 21 | * @binding |
| 22 | * @product Bucket |
| 23 | */ |
| 24 | export interface ReadWriteBucket extends Binding.Service< |
| 25 | ReadWriteBucket, |
| 26 | "Neon.ReadWriteBucket", |
| 27 | ( |
| 28 | bucket: Bucket, |
| 29 | options?: StorageBindingOptions, |
| 30 | ) => Effect.Effect<ReadWriteBucketClient> |
| 31 | > {} |
| 32 | export const ReadWriteBucket = Binding.Service<ReadWriteBucket>( |
| 33 | "Neon.ReadWriteBucket", |
| 34 | ); |