import type { CleanedEnv, ZenvOptions, ZenvSpec } from "./types.cjs"; /** * @module zenv * @description Zod-based environment variable validation with client/server separation. * Validates environment variables against a schema specification and returns a type-safe, * immutable environment object. * * @param specs - Object mapping environment variable names to Zod schemas * @param options - Optional configuration for validation behavior * @returns Validated environment object with NODE_ENV convenience properties * * @example * Basic Usage * ```ts * import { zenv, str, num, bool } from 'zenvalidate'; * * const env = zenv({ * NODE_ENV: str({ choices: ['development', 'production', 'test'] }), * PORT: num({ default: 3000 }), * DEBUG: bool({ default: false }), * API_KEY: str() // Server-only by default * }); * * console.log(env.PORT); // number * console.log(env.isDevelopment); // boolean * ``` * * @example * Client Exposure with Transform * ```ts * const env = zenv({ * // Expose to client with transform * API_URL: url({ * client: { * expose: true, * transform: (url) => url.replace('internal', 'public') * } * }), * // Server-only (secure by default) * SECRET_KEY: str() * // Auto-exposed to client based on prefix config below * NEXT_PUBLIC_APP_NAME: str(), * }, { * clientSafePrefixes: ['NEXT_PUBLIC_', 'VITE_'] * }); * ``` * * @example * Environment-Specific Defaults * ```ts * const env = zenv({ * LOG_LEVEL: str({ * default: 'info', * devDefault: 'debug', * testDefault: 'error' * }), * FEATURE_FLAG: bool({ * default: false, * client: { * expose: true, * default: true // Different default on client * } * }) * }); * ``` * * @throws {ZenvError} When validation fails and onError is 'throw' * @throws {ReferenceError} When accessing non-validated variables in strict mode * @throws {Error} When accessing server-only variables on client (if configured) */ export declare function zenv(specs: T, options?: ZenvOptions): CleanedEnv;