1import * as Cloudflare from "@/Cloudflare/index.ts";
2import * as Effect from "effect/Effect";
3import * as HttpServerResponse from "effect/http/HttpServerResponse";
4import { App } from "./access-worker.ts";
5
6/**
7 * Second Worker enrolling into the SAME shared application as
8 * `access-worker.ts`. Pins the many-Workers-one-application merge through
9 * the binding contract.
10 */
11export default class SecondAccessWorker extends Cloudflare.Worker<SecondAccessWorker>()(
12 "SecondAccessWorker",
13 {
14 main: import.meta.url,
15 access: App,
16 },
17 Effect.gen(function* () {
18 return {
19 fetch: Effect.gen(function* () {
20 const access = yield* Cloudflare.Access.Context;
21 return yield* HttpServerResponse.json({
22 marker: "alchemy-access-worker-b-open",
23 authenticated: access !== undefined,
24 });
25 }),
26 };
27 }),
28) {}