import { getRequiredEnv, getStdout, type HealthChecker, type HealthCheckInput, HealthCheckOutput, type IEither, type ITraceable, type ServerTrace, TraceUtil, } from "@emprespresso/pengueno"; export const healthCheck: HealthChecker = ( input: ITraceable, ): Promise> => input.bimap(TraceUtil.withFunctionTrace(healthCheck)) .move(getRequiredEnv("LAMINAR_HOST")) // ensure LAMINAR_HOST is propagated to getStdout for other procedures .map((e) => e.get().moveRight(["laminarc", "show-jobs"])) .map((i) => i.get().mapRight(i.move.apply) .flatMapAsync(getStdout.apply) .then((gotJobs) => gotJobs.moveRight(HealthCheckOutput.YAASSSLAYQUEEN)) ) .get();