import { getRequiredEnv, getStdout, type HealthCheckInput, HealthCheckOutput, type IEither, type ITraceable, TraceUtil, } from "@emprespresso/pengueno"; import {} from "../../u/trace/mod.ts"; const healthCheck = ( input: ITraceable, ): Promise> => input.bimap(TraceUtil.withFunctionTrace(healthCheck)) .move(getRequiredEnv("LAMINAR_HOST")) // we need to test LAMINAR_HOST is propagated to getStdout for other procedures .map(({ item }) => item.moveRight(["laminarc", "show-jobs"])) .map((i) => i.item.mapRight(i.move.apply) .flatMapAsync(getStdout.apply) .then((gotJobs) => gotJobs.moveRight(HealthCheckOutput.YAASQUEEN)) ) .item; //export class LizCIServer { // private constructor( // private readonly healthCheckActivity = HealthCheckActivity(healthCheck), // private readonly jobHookActivity = JobHookActivity(jobQueuer) // ) {} // // private async route(req: ITraceable) { // return req.flatMap((req) => { // const { logger, item: { method, pathname } } = req; // if (pathname === "/health") { // return this.healthCheckActivity.healthCheck(req); // } // return this.jobHookActivity.processHook(req); // }); // } // // public async serve(req: Request): Promise { // return LogTraceable(req).bimap(TraceUtil.withClassTrace(this)).map(this.route) // } //} //private route( // req: Traceable, //): Traceable> { // return req.flatMap((req) => { // const { logger, item: { method, pathname } } = req; // if (pathname === "/health") { // return this.healthCheckActivity.healthCheck(req); // } // return this.jobHookActivity.processHook(req); // }); //}