sailfork / t3code-github / .repos/ alchemy-effect/ packages/ integration-tests/ test/ GCP/ Jobs/ common.ts

import { GcpEnvironment } from "@alchemy.run/gcp/Environment";
import * as Effect from "effect/Effect";
import { MinimumLogLevel } from "effect/References";

export const logLevel = Effect.provideService(
  MinimumLogLevel,
  process.env.DEBUG ? "Debug" : "Info",
);

// Cloud Talent Solution needs a console-only data-permission opt-in
// (GCP_TEST_TALENT_ONBOARDED=1). Without it, every call except deletes fails
// with `BadRequest: Service must be permitted to access job and behavioral
// data to improve common machine learning models ...`.
export const runLifecycle = !!process.env.GCP_TEST_TALENT_ONBOARDED;

export const currentProject = GcpEnvironment.current.pipe(Effect.map((env) => env.project));