1import * as GCP from "@/GCP";
2import * as Effect from "effect/Effect";
3import { serveProbes } from "../../bindingHost.ts";
4
5/** Workflow that echoes its `name` argument. */
6export const Greet = GCP.Workflows.Workflow("Greet", {
7 location: "us-central1",
8 sourceContents: `main:
9 params: [args]
10 steps:
11 - done:
12 return: \${"hello " + args.name}
13`,
14});
15
16/**
17 * Effect-native Cloud Run service exercising the Workflows binding as its
18 * own runtime service account. Deployed from {@link ../Bindings.test.ts}.
19 */
20export default class WorkflowsBindingsHost extends GCP.Function<WorkflowsBindingsHost>()(
21 "WorkflowsBindingsHost",
22 { main: import.meta.url, invokerIamDisabled: true },
23 Effect.gen(function* () {
24 const createExecution = yield* GCP.Workflows.CreateExecution(Greet);
25
26 return {
27 fetch: serveProbes({
28 createExecution: createExecution({
29 body: { argument: JSON.stringify({ name: "alchemy" }) },
30 }),
31 }),
32 };
33 }).pipe(Effect.provide(GCP.Workflows.CreateExecutionHttp)),
34) {}