/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; export interface Env { MUTAGENT_API_KEY?: string | undefined; MUTAGENT_BEARER_AUTH?: string | undefined; MUTAGENT_DEBUG?: boolean | undefined; } export const envSchema: z.ZodMiniType = z.object({ MUTAGENT_API_KEY: z.optional(z.string()), MUTAGENT_BEARER_AUTH: z.optional(z.string()), MUTAGENT_DEBUG: z.optional(z.coerce.boolean()), }); /** * Checks for the existence of the Deno global object to determine the environment. * @returns {boolean} True if the runtime is Deno, false otherwise. */ function isDeno() { if ("Deno" in globalThis) { return true; } return false; } let envMemo: Env | undefined = undefined; /** * Reads and validates environment variables. */ export function env(): Env { if (envMemo) { return envMemo; } const globals = globalThis as { Deno?: { env?: { toObject?: () => Record } }; process?: { env?: Record }; }; let envObject: Record = {}; if (isDeno()) { envObject = globals.Deno?.env?.toObject?.() ?? {}; } else { envObject = globals.process?.env ?? {}; } envMemo = envSchema.parse(envObject); return envMemo; } /** * Clears the cached env object. Useful for testing with a fresh environment. */ export function resetEnv() { envMemo = undefined; }