/** * Environment utilities * * Handles environment validation and base URL resolution. * API keys are generated via WorkOS and do not encode the environment. * The environment is user-specified and validated by the API. */ import { type Locale } from "@artu-ai/shared"; import { z } from "zod"; /** * SDK environment schema */ export declare const environmentSchema: z.ZodEnum<{ test: "test"; live: "live"; }>; /** * SDK environment type */ export type Environment = z.infer; /** * SDK environment configuration */ export interface SDKEnvironmentConfig { /** * The environment to operate in. * - "test": Uses test data, no real regulatory submissions * - "live": Uses production data, real regulatory submissions */ environment: Environment; /** * Optional custom base URL (overrides default). * Useful for local development or custom deployments. */ baseUrl?: string; } /** * Default production API base URL. * Both test and live environments use the same server. * Environment isolation is handled via the X-Environment header. */ export declare const DEFAULT_BASE_URL = "https://api.artu.ai"; /** * Validates that the environment is valid * * @param env - Environment string to validate * @returns Validated environment * @throws Error if environment is invalid * * @example * ```typescript * const env = validateEnvironment("test"); // "test" * validateEnvironment("staging"); // throws: Invalid environment * ``` */ export declare function validateEnvironment(env: string, locale?: Locale): Environment; /** * Checks if a string is a valid environment * * @param env - Environment string to check * @returns True if valid environment * * @example * ```typescript * isValidEnvironment("test"); // true * isValidEnvironment("staging"); // false * ``` */ export declare function isValidEnvironment(env: string): env is Environment; /** * Gets the default base URL. * Both test and live environments use the same server. * * @returns Default production base URL * * @example * ```typescript * getDefaultBaseUrl(); // "https://api.artu.ai" * ``` */ export declare function getDefaultBaseUrl(): string; /** * Resolves the base URL - uses custom if provided, falls back to env var, then default * * Priority order: * 1. Explicit baseUrl option * 2. ARTU_BASE_URL environment variable * 3. Default production URL * * @param config - SDK environment configuration * @returns Resolved base URL * * @example * ```typescript * resolveBaseUrl({ environment: "test" }); * // "https://api.artu.ai" (or ARTU_BASE_URL if set) * * resolveBaseUrl({ environment: "test", baseUrl: "http://localhost:3001" }); * // "http://localhost:3001" * ``` */ export declare function resolveBaseUrl(config: SDKEnvironmentConfig): string; /** * Resolves the environment - uses explicit value if provided, falls back to env var * * Priority order: * 1. Explicit environment option * 2. ARTU_ENVIRONMENT environment variable * 3. Default to "test" * * @param environment - Optional explicit environment * @returns Resolved environment * * @example * ```typescript * resolveEnvironment("live"); // "live" * resolveEnvironment(); // ARTU_ENVIRONMENT or "test" * ``` */ export declare function resolveEnvironment(environment?: string, locale?: Locale): Environment; /** * Resolves the organization ID from environment variable * * @returns Organization ID from ARTU_ORGANIZATION_ID or undefined */ export declare function resolveOrganizationId(): string | undefined;