1import * as Cloudflare from "@/Cloudflare";
2import * as Drizzle from "@/Drizzle";
3import * as Alchemy from "@/index";
4import * as Effect from "effect/Effect";
5import * as Layer from "effect/Layer";
6import D1DrizzleWorker from "./drizzle-worker.ts";
7
8/**
9 * Schema → migrations → D1 → Worker, all in one stack. Kept in its own file
10 * so it can also be driven directly, e.g.
11 * `alchemy logs --tail --stage test --config ./test/Cloudflare/D1/fixtures/drizzle-stack.ts`.
12 */
13export default Alchemy.Stack(
14 "D1DrizzleStack",
15 {
16 providers: Layer.mergeAll(Cloudflare.providers(), Drizzle.providers()),
17 state: Cloudflare.state(),
18 },
19 Effect.gen(function* () {
20 const worker = yield* D1DrizzleWorker;
21 return {
22 url: worker.url.as<string>(),
23 };
24 }),
25);