| 1 | import { Branch } from "@/Neon/Branch"; |
| 2 | import { Bucket } from "@/Neon/Bucket"; |
| 3 | import { Object as NeonObject } from "@/Neon/Object"; |
| 4 | import { Project } from "@/Neon/Project"; |
| 5 | import * as Effect from "effect/Effect"; |
| 6 | import * as Schema from "effect/Schema"; |
| 7 | |
| 8 | export const StorageProject = Project("StorageBindingProject", { |
| 9 | region: "aws-us-east-2", |
| 10 | }); |
| 11 | export const StorageBranch = Effect.gen(function* () { |
| 12 | return yield* Branch("StorageBindingBranch", { |
| 13 | project: yield* StorageProject, |
| 14 | }); |
| 15 | }); |
| 16 | export const StorageBucket = Effect.gen(function* () { |
| 17 | return yield* Bucket("StorageBindingBucket", { |
| 18 | branch: yield* StorageBranch, |
| 19 | forceDestroy: true, |
| 20 | }); |
| 21 | }); |
| 22 | export const StorageSettings = Effect.gen(function* () { |
| 23 | const bucket = yield* StorageBucket; |
| 24 | return yield* NeonObject("StorageSettings", { |
| 25 | bucket, |
| 26 | key: "settings.json", |
| 27 | value: { theme: "system", pageSize: 25 }, |
| 28 | schema: Schema.Struct({ theme: Schema.String, pageSize: Schema.Number }), |
| 29 | }); |
| 30 | }); |