The best way to control Claude Code, Codex and more from any computer or phone

main
ts 39 lines 1.4 KB
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import * as Effect from "effect/Effect";
3 import * as Schedule from "effect/Schedule";
4 import { serveProbes } from "../../bindingHost.ts";
5
6 /** SCORE key the assessment is created against. */
7 export const Signup = GCP.RecaptchaEnterprise.Key("Signup", {
8 displayName: "alchemy recaptcha assess",
9 testingOptions: { testingScore: 0.8 },
10 webSettings: { integrationType: "SCORE", allowAllDomains: true },
11 });
12
13 /**
14 * Effect-native Cloud Run service exercising the reCAPTCHA Enterprise
15 * binding as its own runtime service account. Deployed from
16 * {@link ../Bindings.test.ts}.
17 */
18 export default class RecaptchaBindingsHost extends GCP.Function<RecaptchaBindingsHost>()(
19 "RecaptchaBindingsHost",
20 { main: import.meta.url, invokerIamDisabled: true },
21 Effect.gen(function* () {
22 const createAssessment = yield* GCP.RecaptchaEnterprise.CreateAssessment(Signup);
23
24 return {
25 fetch: serveProbes({
26 createAssessment: createAssessment({
27 body: { event: { token: "03AGdBq27", expectedAction: "login" } },
28 }).pipe(
29 Effect.retry({
30 // A just-created key takes a moment to propagate.
31 while: (error) => error._tag === "InvalidSiteKey",
32 schedule: Schedule.spaced("2 seconds"),
33 times: 8,
34 }),
35 ),
36 }),
37 };
38 }).pipe(Effect.provide(GCP.RecaptchaEnterprise.CreateAssessmentHttp)),
39 ) {}