t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/GCP/Smoke/fixtures/job.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

25 lines
879 B
TypeScript

import * as GCP from "@/GCP";
import * as Config from "effect/Config";
import * as Effect from "effect/Effect";
import { Store } from "./serverless-resources.ts";
/**
* Effect-native Cloud Run Job the API triggers through `GCP.Run.RunJob`.
* Each execution records `executions/{CLOUD_RUN_EXECUTION}` in Firestore.
*/
export default class SmokeJob extends GCP.Run.Job<SmokeJob>()(
"SmokeJob",
{ main: import.meta.url, location: "us-central1" },
Effect.gen(function* () {
const store = yield* GCP.Firestore.WriteDatabase(Store);
return {
run: Effect.gen(function* () {
const execution = yield* Config.String("CLOUD_RUN_EXECUTION");
yield* store.set(`executions/${execution}`, {
execution,
ranAt: new Date(),
});
}).pipe(Effect.orDie),
};
}).pipe(Effect.provide(GCP.Firestore.WriteDatabaseHttp)),
) {}