| 1 | import * as Prisma from "@/Prisma"; |
| 2 | import * as Alchemy from "@/index.ts"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import ReadCompute from "./read-compute.ts"; |
| 5 | import ReadWriteCompute from "./readwrite-compute.ts"; |
| 6 | import WriteCompute from "./write-compute.ts"; |
| 7 | |
| 8 | /** |
| 9 | * Deploys three Prisma Compute apps that all bind one shared Prisma Object |
| 10 | * Store bucket — read / write / read-write. Extracted into its own stack file |
| 11 | * so it can be deployed by the test suite AND inspected directly, e.g. |
| 12 | * |
| 13 | * ```sh |
| 14 | * alchemy logs --tail --stage test --config ./test/Prisma/fixtures/stack.ts |
| 15 | * ``` |
| 16 | * |
| 17 | * State is file-local (`.alchemy/` on the runner) — a Prisma-only suite must |
| 18 | * not require another cloud's credentials just to store state, and the Prisma |
| 19 | * Compute live smoke likewise keeps its state out of the cloud. An |
| 20 | * interrupted run's resources stay reclaimable from the same checkout. |
| 21 | */ |
| 22 | export default Alchemy.Stack( |
| 23 | "PrismaBucketBindingStack", |
| 24 | { providers: Prisma.providers(), state: Alchemy.localState() }, |
| 25 | Effect.gen(function* () { |
| 26 | const read = yield* ReadCompute; |
| 27 | const write = yield* WriteCompute; |
| 28 | const readWrite = yield* ReadWriteCompute; |
| 29 | return { |
| 30 | read: read.url.as<string>(), |
| 31 | write: write.url.as<string>(), |
| 32 | readWrite: readWrite.url.as<string>(), |
| 33 | }; |
| 34 | }), |
| 35 | ); |